Skip to content

MCP Integration

Connect Backflow with Claude and other AI assistants using the Model Context Protocol.

Overview

Backflow provides two MCP components:

  1. MCP Server - Exposes Backflow tools to AI assistants (Claude, etc.)
  2. MCP Client - Connects to external MCP servers in workflows

Backflow MCP Server

Allow AI assistants to create integrations and routes for your tenants.

Setup with Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "backflow": {
      "command": "node",
      "args": ["/path/to/backflow/dist/mcp.js"],
      "env": {
        "BACKFLOW_CONFIG_PATH": "/path/to/config.json",
        "BACKFLOW_INTEGRATIONS_PATH": "/path/to/integrations"
      }
    }
  }
}

Setup with Claude Code

bash
claude mcp add backflow node /path/to/backflow/dist/mcp.js

Remote Setup (API Mode)

Tenants can connect Claude to their Backflow instance remotely without installing the full server. This enables access to the complete set of Backflow tools — including workflows, apps, and entities — through an API key.

The @backflow.mcp/client package runs a lightweight MCP bridge that connects to your Backflow instance over the API. No local server install required.

Claude Code:

bash
# Default endpoint (api.backflow.dev)
claude mcp add backflow -- npx -y @backflow.mcp/client --api-key YOUR_API_KEY

# Custom endpoint (self-hosted or dedicated instance)
claude mcp add backflow -- npx -y @backflow.mcp/client --api-key YOUR_API_KEY --endpoint https://your-instance.backflow.dev

Claude Desktop (claude_desktop_config.json):

json
{
  "mcpServers": {
    "backflow": {
      "command": "npx",
      "args": ["-y", "@backflow.mcp/client", "--api-key", "YOUR_API_KEY"]
    }
  }
}

Or using environment variables:

json
{
  "mcpServers": {
    "backflow": {
      "command": "npx",
      "args": ["-y", "@backflow.mcp/client"],
      "env": {
        "BACKFLOW_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

CLI flags:

FlagDescription
--api-keyAPI key for authentication (or use BACKFLOW_API_KEY env var)
--endpointBackflow API endpoint (default: https://api.backflow.dev)
--scopeLimit tool access to a specific tenant scope
--allow-integrationsEnable integration management tools
--allow-routesEnable route management tools

Method B: SSE URL (for HTTP-native MCP clients)

If your MCP client supports HTTP-based transports, connect directly via Server-Sent Events — no local install needed.

SSE endpoint:

GET https://api.backflow.dev/mcp/sse?token=YOUR_API_KEY

Message endpoint:

POST https://api.backflow.dev/mcp/messages?sessionId=SESSION_ID
Authorization: Bearer YOUR_TOKEN

The SSE connection returns a sessionId on connect. Use that session ID when posting messages to the message endpoint.

Local vs Remote Comparison

Local ModeRemote (npx)Remote (SSE)
Requires local installYesNo (npx)No
AuthFilesystem accessAPI keyAPI key / JWT
IntegrationsRead/write filesVia APIVia API
WorkflowsNot availableFull CRUDFull CRUD
AppsNot availableFull CRUDFull CRUD
EntitiesNot availableFull CRUDFull CRUD

MCP Configuration

Create mcp-config.json:

json
{
  "enabled": true,
  "allowIntegrationCreation": true,
  "allowRouteCreation": true,
  "integrationsPath": "./integrations",
  "configPath": "./config.json",
  "autoReload": false
}

Available Tools

The MCP server exposes these tools to AI assistants. The tools available depend on your connection mode (see Local vs Remote Comparison above).

Integration Tools

ToolDescription
create_integrationCreate a custom API integration with endpoints and auth config
list_integrationsList all custom integrations for the tenant
get_integrationGet full details of a specific integration by name
update_integrationUpdate an existing integration's config, endpoints, or auth
delete_integrationDelete a custom integration by name

Route Tools

ToolDescription
create_routeCreate an API route that chains integration actions
list_routesList all configured routes
get_routeGet details of a specific route by path and method
update_routeUpdate an existing route's config or integration actions
delete_routeDelete a route by path and method

Workflow Tools (remote only)

ToolDescription
list_workflowsList all workflows for the tenant
get_workflowGet a workflow definition by ID
create_workflowCreate a new workflow with steps and triggers
update_workflowUpdate an existing workflow's steps, triggers, or config
delete_workflowDelete a workflow by ID

App Tools (remote only)

ToolDescription
list_appsList all apps for the tenant
get_appGet an app definition by ID
create_appCreate a new app with pages, components, and data bindings
update_appUpdate an existing app's pages or config
delete_appDelete an app by ID

Entity Tools (remote only)

ToolDescription
list_collectionsList all entity collections for the tenant
list_entitiesList entities within a collection with optional filters
get_entityGet a single entity by collection and ID
create_entityCreate a new entity in a collection
update_entityUpdate an existing entity's fields
delete_entityDelete an entity by collection and ID

Tool Examples

create_integration:

Tool: create_integration
Arguments:
  - name: "airtable"
  - displayName: "Airtable"
  - description: "Airtable API integration"
  - baseUrl: "https://api.airtable.com/v0"
  - auth: { type: "bearer" }
  - endpoints: [...]

Example prompt to Claude:

"Create an Airtable integration with endpoints for listing records, creating records, and updating records"

create_route:

Tool: create_route
Arguments:
  - path: "/airtable/records"
  - method: "get"
  - description: "List Airtable records"
  - requireAuth: true
  - integrations: { actions: [...] }

Example: Setting Up a Tenant API with Claude

Ask Claude:

"I need to set up an API for a property management company. They need:

  1. A Buildium integration for property data
  2. A Stripe integration for payments
  3. Routes for listing properties, processing payments, and generating reports"

Claude will use the MCP tools to:

  1. Create the Buildium integration with appropriate endpoints
  2. Create the Stripe integration for payment processing
  3. Create routes that chain these integrations together

Security Considerations

SettingDescriptionRecommendation
allowIntegrationCreationAllow AI to create integrationstrue for dev, false for prod
allowRouteCreationAllow AI to create routestrue for dev, false for prod
autoReloadAuto-reload on changesfalse for production

MCP Client (Workflows)

Connect to external MCP servers from workflows.

Configuration

In config.json:

json
{
  "mcpServers": [
    {
      "name": "filesystem",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/files"
      ]
    },
    {
      "name": "github",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "{{env.GITHUB_TOKEN}}"
      }
    },
    {
      "name": "sqlite",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sqlite",
        "/path/to/db.sqlite"
      ]
    }
  ]
}

Using MCP Tools in Workflows

json
{
  "id": "file-analysis",
  "workflows": [
    {
      "name": "analyze",
      "steps": [
        {
          "id": "read-file",
          "action": "read_file",
          "params": {
            "path": "{{input.filePath}}"
          }
        },
        {
          "id": "analyze",
          "action": "llm",
          "params": {
            "prompt": "Analyze this file content:\n{{steps.read-file.result}}"
          }
        }
      ]
    }
  ],
  "tools": [
    {
      "name": "read_file",
      "type": "mcp_tool",
      "params": {
        "mcpServer": "filesystem",
        "toolName": "read_file"
      }
    },
    { "name": "llm", "type": "llm_call" }
  ]
}

Available MCP Servers

Popular MCP servers from the community:

ServerPackageDescription
Filesystem@modelcontextprotocol/server-filesystemRead/write local files
GitHub@modelcontextprotocol/server-githubGitHub API operations
SQLite@modelcontextprotocol/server-sqliteSQLite database queries
PostgreSQL@modelcontextprotocol/server-postgresPostgreSQL operations
Slack@modelcontextprotocol/server-slackSlack messaging
Google Drive@modelcontextprotocol/server-gdriveGoogle Drive files
Brave Search@modelcontextprotocol/server-brave-searchWeb search

Dynamic MCP Tool Discovery

json
{
  "id": "discover",
  "action": "mcp.listTools",
  "params": {
    "server": "filesystem"
  }
}

Execute Any MCP Tool

json
{
  "id": "execute",
  "action": "mcp.execute",
  "params": {
    "server": "github",
    "tool": "create_issue",
    "arguments": {
      "repo": "owner/repo",
      "title": "{{input.title}}",
      "body": "{{input.body}}"
    }
  }
}

MCP API Endpoints

List MCP Servers

bash
GET /agent/mcp/servers
Authorization: Bearer <token>

Response:

json
{
  "servers": [
    { "name": "filesystem", "connected": true, "tools": 5 },
    { "name": "github", "connected": true, "tools": 12 }
  ]
}

List Tools from Server

bash
GET /agent/mcp/servers/filesystem/tools
Authorization: Bearer <token>

Execute MCP Tool

bash
POST /agent/mcp/execute
Authorization: Bearer <token>
Content-Type: application/json

{
  "server": "filesystem",
  "tool": "read_file",
  "arguments": {
    "path": "/app/data/config.json"
  }
}

Example: Full Tenant Setup with Claude

1. Start Backflow MCP Server

bash
npm run mcp
# Or: node dist/mcp.js

2. Configure Claude Desktop

json
{
  "mcpServers": {
    "backflow": {
      "command": "node",
      "args": ["/app/backflow/dist/mcp.js", "/app/config/mcp-config.json"]
    }
  }
}

3. Ask Claude to Set Up API

Prompt:

"I'm setting up a SaaS for fitness studios. Create integrations and routes for:

  • Mindbody API for class schedules and bookings
  • Stripe for membership payments
  • Twilio for class reminders
  • A dashboard endpoint that combines studio stats"

Claude will:

  1. Create Mindbody integration with schedule/booking endpoints
  2. Create Stripe integration for subscriptions
  3. Create Twilio integration for SMS
  4. Create routes that:
    • GET /classes - List upcoming classes
    • POST /bookings - Book a class
    • POST /memberships - Create membership
    • GET /dashboard - Aggregate stats

4. Review Generated Files

bash
ls integrations/
# mindbody.json
# stripe.json
# twilio.json

cat config.json | jq '.routes'
# Shows new routes added by Claude

5. Start Backflow

bash
npm start

Your tenant's API is now ready.

Troubleshooting

MCP Server Not Starting

bash
# Check if MCP module is built
npm run build

# Run directly with debug
DEBUG=mcp* node dist/mcp.js

Claude Not Finding Tools

  1. Restart Claude Desktop after config changes
  2. Check config path is correct
  3. Verify the MCP server starts without errors

Permission Errors

bash
# Ensure integrations directory is writable
chmod 755 ./integrations

# Ensure config.json is writable for route creation
chmod 644 ./config.json

Backflow - Configuration-driven API framework