Flowlib
Plugins

MCP (Model Context Protocol)

Let AI assistants build, run, and debug flows with @flowlib/mcp.

The MCP plugin exposes Flowlib as a Model Context Protocol server. AI assistants like Claude Desktop, VS Code Copilot, and Cursor can connect and manage flows, execute runs, debug failures, and more — all through natural language.

Installation

pnpm add @flowlib/mcp
npm install @flowlib/mcp
yarn add @flowlib/mcp
bun add @flowlib/mcp

Setup

Register the plugin in your Flowlib config:

flowlib.config.ts
import { mcp } from '@flowlib/mcp';

export const flowlibConfig = defineConfig({
  // ...
  plugins: [mcp()],
});

Options

OptionTypeDefaultDescription
sessionTtlMsnumber1800000 (30 min)How long idle MCP sessions stay alive.
audit.enabledbooleantrueLog every tool invocation.
audit.persistbooleanfalsePersist audit logs to the database.
audit.logLevel'debug' | 'info' | 'warn''info'Minimum level for audit entries.
flowlib.config.ts
mcp({
  sessionTtlMs: 60 * 60 * 1000, // 1 hour sessions
  audit: { enabled: true, persist: true, logLevel: 'debug' },
});

Connecting an AI assistant

The MCP server runs over stdio via the CLI. Start your Flowlib app, then point your AI assistant at it.

Claude Desktop

Generate the config snippet and paste it into Claude Desktop's MCP settings:

npx flowlib-cli mcp --print-config

Output:

{
  "mcpServers": {
    "flowlib": {
      "command": "npx",
      "args": [
        "flowlib-cli",
        "mcp",
        "--url",
        "http://localhost:3000/flowlib",
        "--api-key",
        "YOUR_KEY"
      ]
    }
  }
}

VS Code (Copilot / Copilot Chat)

Add to your .vscode/mcp.json:

{
  "servers": {
    "flowlib": {
      "command": "npx",
      "args": [
        "flowlib-cli",
        "mcp",
        "--url",
        "http://localhost:3000/flowlib",
        "--api-key",
        "YOUR_KEY"
      ]
    }
  }
}

Cursor

Add to your Cursor MCP settings (~/.cursor/mcp.json):

{
  "mcpServers": {
    "flowlib": {
      "command": "npx",
      "args": [
        "flowlib-cli",
        "mcp",
        "--url",
        "http://localhost:3000/flowlib",
        "--api-key",
        "YOUR_KEY"
      ]
    }
  }
}

Manual

Run the server directly:

npx flowlib-cli mcp --url http://localhost:3000/flowlib --api-key YOUR_KEY

You can also use environment variables instead of flags:

export FLOWLIB_URL=http://localhost:3000/flowlib
export FLOWLIB_API_KEY=YOUR_KEY
npx flowlib-cli mcp

Available tools

Once connected, the AI assistant has access to the following tools:

Flow management

ToolDescription
flow_listList all flows with names, IDs, and status.
flow_getGet detailed metadata for a specific flow.
flow_get_definitionGet the full flow definition (nodes, edges, params).
flow_createCreate a new flow.
flow_updateUpdate a flow's definition or metadata.
flow_deleteDelete a flow.
flow_validateValidate a flow definition for errors.

Version management

ToolDescription
version_listList all versions of a flow.
version_getGet a specific version's definition.
version_publishPublish a new version of a flow.

Flow execution

ToolDescription
run_startStart a flow run with inputs.
run_to_nodeRun a flow up to a specific node (partial execution).
run_listList recent flow runs.
run_getGet details of a specific run.
run_cancelCancel a running flow.
run_pausePause a running flow.
run_resumeResume a paused flow.

Debugging

ToolDescription
debug_node_executionsGet per-node execution traces for a run.
debug_test_nodeTest a single node with custom input data.
debug_test_expressionEvaluate a template expression against test data.
debug_test_mapperTest an input data mapper configuration.

Credentials & triggers

ToolDescription
credential_listList available credentials.
credential_testTest a credential's connectivity.
trigger_listList triggers for a flow.
trigger_getGet trigger details.
trigger_createCreate a new trigger.
trigger_updateUpdate an existing trigger.
trigger_deleteDelete a trigger.

Node reference

ToolDescription
node_list_providersList all available node providers (core, gmail, slack, etc.).
node_list_availableList all available node types with their schemas.

Resources and prompts

The MCP server also exposes resources and prompts:

  • flowlib://flows/{flowId}/definition — Read a flow definition as a resource, useful for context injection.
  • debug-flow-run prompt — A guided prompt template that walks the AI through debugging a failed flow run step by step.

Architecture

The plugin supports two connection modes:

  1. Stdio (CLI)npx flowlib-cli mcp starts a standalone process that connects to Flowlib over HTTP. This is what MCP clients like Claude Desktop use.
  2. Direct (in-process) — When registered as a plugin, the MCP server can call Flowlib services directly without HTTP overhead. Used by the Streamable HTTP endpoint at POST /plugins/mcp/mcp.
┌──────────────┐  stdio   ┌──────────────┐  HTTP  ┌────────────┐
│ Claude / VS  │ ───────► │ flowlib-cli   │ ─────► │  Flowlib    │
│ Code / Cursor│          │ mcp server   │        │  API       │
└──────────────┘          └──────────────┘        └────────────┘

┌──────────────┐  HTTP    ┌────────────────────────────────────┐
│  MCP Client  │ ───────► │  Flowlib (w/ mcpPlugin, direct)    │
└──────────────┘          └────────────────────────────────────┘

On this page