Skip to content

MCP — AI Agent Integration

MCP — AI Agent Integration

The Model Context Protocol (MCP) is an open standard that allows AI agents (like Claude, GPT-4, and others) to use external tools. flow8 exposes its flows as MCP tools, enabling AI agents to trigger automations, query data, and orchestrate complex workflows.

MCP Server

flow8 runs a separate MCP server on port 4445. Configure it:

MCP_JWT_SECRET=your-mcp-jwt-secret

The MCP server is started automatically at boot via McpProvider.

Authentication

The AI agent authenticates via a JWT with the mcp scope:

Terminal window
# Create an MCP-scoped API key
POST /api/auth/api-keys
{"name": "Claude MCP Access", "scopes": ["mcp"]}

The returned token is passed to the MCP client configuration.

Create an MCP Channel

Expose flows as named MCP tools:

Terminal window
POST /api/channels
{
"name": "AI Agent Tools",
"kind": "mcp",
"enabled": true
}

Add routes that map tool names to flows:

Terminal window
POST /api/channels/65mcp-chan/routes
{
"name": "Process Invoice",
"toolName": "process_invoice",
"targetFlowIds": ["65flow1"],
"responseMode": "sync"
}

Connect Claude to flow8

In your Claude MCP configuration (claude_desktop_config.json):

{
"mcpServers": {
"flow8": {
"url": "http://localhost:4445",
"headers": {
"Authorization": "Bearer eyJ..."
}
}
}
}

Claude can now call process_invoice as a tool directly from a conversation.

Use Cases

  • AI-triggered automations: An AI agent reads an email and triggers a flow to process the attachment
  • Data retrieval: An agent queries business data via flows that connect to databases or APIs
  • Multi-step orchestration: An agent plans a workflow and calls multiple flow8 tools in sequence
  • Human-in-the-loop: Agent triggers a flow with an approval gate, waits for human sign-off, then continues