Skip to main content
Runflow supports the Model Context Protocol (MCP) in two ways:
  1. MCP Server Connector — Connect to external MCP servers (Linear, GitHub, DeepWiki, etc.) and use their tools in your agents, just like any other connector
  2. MCP Gateway — Expose your Runflow connectors (REST APIs, databases, MCP servers) as a single MCP endpoint for Claude Desktop, Cursor, or any MCP client

MCP Server Connector

Connect to any external MCP server and use its tools in your agents. The MCP server’s tools are auto-discovered and become regular connector resources — no manual mapping needed.

Setting Up

Portal:
  1. Connectors > New Connector > MCP Server
  2. Enter the server URL (e.g., https://mcp.linear.app/sse)
  3. Select transport: SSE or Streamable HTTP
  4. Configure authentication if required (Bearer Token, Basic Auth, or OAuth2)
  5. After creation, click Sync Tools — Runflow connects to the MCP server, calls tools/list, and creates a resource for each tool
What happens during Sync:
  • Runflow opens a connection to the MCP server
  • Calls tools/list to discover all available tools
  • Creates a ConnectorResource for each tool (name, description, input schema)
  • Updates existing resources if the schema changed
  • Removes tools that no longer exist on the server
  • You can re-sync anytime to pick up changes

Using in Agents

MCP tools work exactly like REST or Database connector tools in agents. The agent calls them via the LLM’s tool-use capability:
import { Agent, openai, createConnectorTool } from '@runflow-ai/sdk';

const agent = new Agent({
  name: 'Project Manager',
  instructions: `You help manage Linear issues and projects.
    When the user asks about issues, use the Linear tools to search and list.
    When they want to create an issue, gather title and description first.`,
  model: openai('gpt-4o'),
  tools: {
    listIssues: createConnectorTool({
      connector: 'linear-mcp',
      resource: 'list-issues',
    }),
    createIssue: createConnectorTool({
      connector: 'linear-mcp',
      resource: 'create-issue',
    }),
    getIssue: createConnectorTool({
      connector: 'linear-mcp',
      resource: 'get-issue',
    }),
  },
});

// The agent decides which tool to call based on the user's message
const result = await agent.process({
  message: 'Show me the open bugs assigned to me',
});
// Agent calls list-issues with { assignee: "me", status: "In Progress", label: "Bug" }

Direct Invocation (Without Agent)

Call MCP tools directly in your code — useful in workflows, scripts, or custom logic:
import { connector } from '@runflow-ai/sdk';

// Linear: list issues
const issues = await connector('linear-mcp', 'list-issues', {
  assignee: 'me',
  limit: 10,
  status: 'In Progress',
});
console.log(issues.data.issues);

// Linear: create an issue
const newIssue = await connector('linear-mcp', 'create-issue', {
  title: 'Fix login bug',
  description: 'Users are getting 500 errors on login',
  teamId: 'TEAM-123',
  priority: 2,
});
console.log(newIssue.data.id); // "PROJ-456"

// DeepWiki: search documentation
const docs = await connector('deepwiki-mcp', 'ask-question', {
  repoName: 'anthropics/claude-code',
  question: 'How do MCP servers work?',
});

Using in Workflows

Combine MCP tools with other steps in a workflow:
import { flow, connector } from '@runflow-ai/sdk';

const bugTriageFlow = flow('bug-triage')
  .step('fetch-bugs', async () => {
    const result = await connector('linear-mcp', 'list-issues', {
      label: 'Bug',
      status: 'Triage',
      limit: 20,
    });
    return { bugs: result.data.issues };
  })
  .step('classify', {
    agent: classifierAgent,
    prompt: ({ results }) =>
      `Classify these bugs by severity:\n${JSON.stringify(results['fetch-bugs'].bugs.map(b => ({ id: b.id, title: b.title, description: b.description })))}`,
  })
  .step('update-priorities', async ({ results }) => {
    const classifications = results.classify;
    for (const bug of classifications.bugs) {
      await connector('linear-mcp', 'update-issue', {
        issueId: bug.id,
        priority: bug.severity === 'critical' ? 1 : bug.severity === 'high' ? 2 : 3,
      });
    }
    return { updated: classifications.bugs.length };
  })
  .build();

Example: Project Management Agent with Linear

A complete agent that manages a Linear workspace via MCP:
main.ts
import { identify } from '@runflow-ai/sdk/observability';
import { agent } from './agent';

export async function main(input: any) {
  identify(input.userId || input.metadata?.userId || 'anonymous');
  return agent.process(input);
}
agent.ts
import { Agent, openai, createConnectorTool } from '@runflow-ai/sdk';

const linear = {
  listIssues: createConnectorTool({ connector: 'linear-mcp', resource: 'list-issues' }),
  getIssue: createConnectorTool({ connector: 'linear-mcp', resource: 'get-issue' }),
  createIssue: createConnectorTool({ connector: 'linear-mcp', resource: 'create-issue' }),
  updateIssue: createConnectorTool({ connector: 'linear-mcp', resource: 'update-issue' }),
  searchIssues: createConnectorTool({ connector: 'linear-mcp', resource: 'search-issues' }),
  listTeams: createConnectorTool({ connector: 'linear-mcp', resource: 'list-teams' }),
};

export const agent = new Agent({
  name: 'Linear Assistant',
  instructions: `You are a project management assistant connected to Linear.

## Capabilities
- List, search, and filter issues
- Create new issues with proper team, priority, and labels
- Update issue status, assignee, and priority
- List teams and their members

## Behavior
- When listing issues, show a concise summary: ID, title, status, assignee
- When creating issues, always ask for the team if not specified
- Use "me" as assignee to filter the current user's issues
- For priority: 1 = Urgent, 2 = High, 3 = Medium, 4 = Low`,

  model: openai('gpt-4o'),
  tools: linear,
  memory: { maxTurns: 20 },
  observability: 'full',
});

Supported MCP Servers

Any server implementing the MCP protocol works. Some popular ones:
ServerURLTransportAuthDescription
Linearhttps://mcp.linear.app/sseSSEBearer Token (API Key)Issue tracking, project management
DeepWikihttps://mcp.deepwiki.com/mcpStreamable HTTPNoneSearch and read GitHub repo documentation
SentryVariesStreamable HTTPBearer TokenError tracking and monitoring
CloudflareVariesStreamable HTTPBearer TokenWorkers, KV, D1, R2 management
NotionVariesStreamable HTTPBearer TokenPages, databases, search
Check mcp.run or the MCP servers directory for a full list of available MCP servers.

Authentication

MCP Server connectors support three authentication types. The credential is stored encrypted and injected automatically when connecting:
TypeHow it worksExample
Bearer TokenSent as Authorization: Bearer <token>Linear API Key, GitHub PAT
Basic AuthUsername + password as Base64Internal services
OAuth2Client credentials or authorization code with automatic token refreshSlack, HubSpot

MCP Gateway

The MCP Gateway turns your Runflow connectors into an MCP endpoint. Configure in the portal what to expose, get a URL, and any MCP client can connect.

Why Use It

  • Unify tools — Combine REST APIs, databases, and MCP servers in one endpoint
  • No code needed — Configure everything in the portal
  • Secure — API Key authentication, resource-level permissions, credentials stay server-side
  • Observable — Every call logged with input/output, duration, and status

Creating a Gateway

  1. MCP Gateway > New Gateway — set name, select API Key
  2. Add Tools — pick resources from any of your connectors
  3. Copy the URL — use in Claude Desktop, Cursor, or any MCP client

Example: Multi-Connector Gateway

A gateway that exposes tools from three different connector types:
ToolSourceType
list_issuesLinear MCP ServerMCP_SERVER
create_contactHubSpot REST APIREST_API
execute_queryPostgreSQL DatabaseDATABASE
read_wiki_structureDeepWiki MCP ServerMCP_SERVER
All accessible from a single URL:
https://api.runflow.ai/api/v1/gateways/my-gateway/mcp?apiKey=sk-xxx

Connecting Claude Desktop

Add to your claude_desktop_config.json:
{
  "mcpServers": {
    "runflow": {
      "url": "https://api.runflow.ai/api/v1/gateways/my-gateway/mcp?apiKey=sk-your-key"
    }
  }
}
Restart Claude Desktop. The tools appear in the tools menu and Claude can call them.

Connecting Cursor

In Cursor settings, add an MCP server with the gateway URL.

Connecting via Claude Code

claude mcp add runflow --transport http \
  "https://api.runflow.ai/api/v1/gateways/my-gateway/mcp?apiKey=sk-your-key"

Tool Management

ActionDescription
Add ToolsSelect resources from any connector to expose
Enable/DisableToggle individual tools without removing them
AliasRename a tool for the MCP client (e.g., list-issues to linear_issues)
RemoveRemove a tool from the gateway

Observability

The Logs tab in the gateway detail page shows every tool call:
  • Status badge (success/error), tool name, duration
  • Expandable input/output for debugging
  • Filter by status and date range
  • Auto-refresh every 15 seconds
  • Pagination for high-volume gateways

Security

FeatureDescription
API Key authEach gateway has its own API Key
Resource-levelOnly explicitly added tools are exposed
Tenant isolationGateways scoped to tenant, no cross-tenant access
Server-side credentialsMCP clients never see your API keys, database passwords, or OAuth tokens
StatelessNo session state stored, any pod can handle requests

Testing with curl

If you prefer to test the MCP Gateway directly via HTTP before connecting an MCP client:

List available tools

curl -X POST "https://api.runflow.ai/api/v1/gateways/my-gateway/mcp?apiKey=sk-your-key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

Call a tool

curl -X POST "https://api.runflow.ai/api/v1/gateways/my-gateway/mcp?apiKey=sk-your-key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "list_issues",
      "arguments": {
        "assignee": "me",
        "limit": 5
      }
    },
    "id": 2
  }'
The Accept: application/json, text/event-stream header is required by the MCP Streamable HTTP transport. The response comes as a Server-Sent Event with the JSON-RPC result in the data field.

Next Steps

Connectors

Create REST, Database, and other connectors

Tools

Build custom tools for agents

Agents

Use MCP tools in agents

Observability

Track gateway calls and metrics