MCP Server

Connect an external MCP server to an AI Agent — all tools from the server become available to the agent.

When to Use

Use MCP Server when:

  • You want to connect an agent to an existing MCP-compatible service (Stripe MCP, database MCP, etc.)
  • You need tools that are defined and maintained externally
  • You are integrating with third-party MCP tool providers

For tools that are Tensorify workflows themselves, connect action nodes directly to the agent's Tools handle instead. For direct API calls without MCP, use HTTP Request.

Inputs

HandleTypeDescription
inputanyTool connection handle. Connect from an AI Agent's Tools output — the agent registers this MCP server at runtime.

Output

None — MCP Server is a tool provider marker node. It does not emit data to the main workflow. Discovered MCP tools are invoked by the connected agent during its ReAct loop.

Settings

SettingTypeDefaultDescription
serverUrlstringMCP server URL (e.g. https://mcp.stripe.com or http://localhost:3100/mcp). Required. Supports {{ }} bindings.
serverNamestring""Friendly name for this MCP server. Shown in logs and used as a prefix for discovered tool names.
transportTypeselecthttpTransport protocol for communicating with the MCP server. Options: http (Streamable HTTP), sse (Server-Sent Events).

SSE transport (transportType = "sse") is not yet implemented. Use http (Streamable HTTP) — it covers the majority of MCP servers.

Required Secrets

Configure on the Environment Variables page:

VariableRequiredDescription
MCP_API_KEYNoAPI key for authenticating with the MCP server. Sent as a Bearer token on HTTP requests. This is a single global key shared across all MCP servers connected to an agent.

Example

Canvas

Connect an agent to Stripe's MCP server:

  1. Add an API Endpoint trigger with openai-chat protocol
  2. Add an AI Agent node and connect the trigger to the agent's message input
  3. Add an MCP Server node and connect the agent's Tools handle to the MCP node's input handle
  4. Configure MCP Server:
    • Server URL: https://mcp.stripe.com
    • Server Name: stripe
    • Transport Type: http
  5. Add MCP_API_KEY to Environment Variables with your Stripe secret key
  6. Connect the agent's response output to a Return node

The agent discovers all tools exposed by the Stripe MCP server on the first request and can list customers, create charges, check subscription status, and use any other tool the server provides.

How it works:

  1. The transpiler emits module-scope code that registers the MCP server with the agent's tool registry
  2. On the first agent request, the runtime connects to the MCP server and discovers tools via the MCP tools/list method
  3. Each discovered tool is converted to a schema the LLM understands (name, description, parameters)
  4. During the ReAct loop, when the LLM calls an MCP tool, the runtime invokes it via the MCP tools/call method
  5. The tool result is passed back to the LLM for the next reasoning step

TSL

import api from @tensorify/api-trigger:1.0.0
import agent from @tensorify/ai-agent:1.0.0
import mcp from @tensorify/mcp-tool-provider:1.0.0
import respond from @tensorify/return:3.0.0

node api @tensorify/api-trigger:1.0.0 {
    path = "/v1"
    method = "POST"
    responseMode = "use-workflow-response"
    protocol = "openai-chat"
}

node agent @tensorify/ai-agent:1.0.0 {
    provider = "openai"
    model = "gpt-4o"
    systemPrompt = "You can use Stripe tools to help with billing questions."
}

node mcp @tensorify/mcp-tool-provider:1.0.0 {
    serverUrl = "https://mcp.stripe.com"
    serverName = "stripe"
    transportType = "http"
}

node respond @tensorify/return:3.0.0 {
    returnMode = "simple"
}

api.payload -> agent.message
agent.tools -> mcp.input
agent.response -> respond.input

Common Gotchas

  • Server must be reachable: The MCP server URL must be accessible from where the workflow runs (your runner's machine for CLI mode, or Tensorify cloud for Managed mode).
  • Lazy tool discovery: MCP tools are discovered on the first agent request, not at workflow startup. If the MCP server adds new tools, restart the workflow to pick them up.
  • Latency: Each MCP tool call is a network request to the external server. Factor this into your agent's timeout and maxIterations settings.
  • Single API key: MCP_API_KEY is shared across all MCP Server nodes on an agent. Use separate agents if different MCP servers require different credentials.
  • SSE not supported: Setting transportType to sse raises a runtime error. Use http unless SSE support is added in a future release.
  • Tool limit: An agent accepts up to 20 tool connections. MCP Server nodes count as one connection but expose many tools from a single server.

See Also

On this page