MCP流水线执行服务器

Toolflow MCP 是一个面向组合流水线和 Nushell 风格数据传递的 MCP 服务器,能在单次工具调用中完成多步工作流,并在失败时返回结构化追踪信息。

  • by RogerNavelsaker
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 RogerNavelsaker/toolflow-mcp

使用说明

toolflow-mcp

toolflow-mcp is a Bun MCP server for compositional pipelines and Nushell-style data passing.

The model-facing surface is intentionally minimal:

  • Binary: toolflow
  • Optional shell alias: tf
  • Primary MCP tool: toolflow
  • Introspection tool: toolflow_registry

The design takes inspiration from F# pipe-forward composition, higher-order functional combinators, and Nushell-style structured data flow, while keeping the MCP surface generic enough to evolve through local plugins instead of upstreaming every verb.

Goals

  • Keep multi-step work inside one MCP tool call.
  • Preserve a functional "current value" through the pipeline.
  • Stop on failure and return a structured post-mortem trace.
  • Load new verbs from local modules via config and secrets files.
  • Bridge other MCP servers behind one client-visible MCP entry.
  • Keep upstream bridge stderr out of the user-facing client path unless a bridge fails.

DSL

Pipeline shape:

verb [args] |> verb [args] |> verb [args]

Rules:

  • The output of each successful step becomes the input of the next step.
  • Use $path.to.value to select from the current value.
  • Use tee to run a side effect without replacing the current value.
  • Strings use single quotes.
  • JSON literals are allowed for object and array arguments.

Examples:

get 'https://example.com/data.json' |> jq '.items.0' |> write 'tmp/item.json'
read 'package.json' |> json |> jq '.name'
get 'https://example.com/data.json' |> tee write 'tmp/raw.json' |> jq '.items'

Config And Secrets

The server looks for two files in the current working directory unless overridden by environment variables:

  • toolflow.config.json
  • toolflow.secrets.json

Environment overrides:

  • TOOLFLOW_CONFIG
  • TOOLFLOW_SECRETS

Example config:

{
  "plugins": [
    {
      "name": "example-http",
      "module": "./src/plugins/example-http.ts",
      "enabled": true,
      "config": {
        "baseUrl": "https://example.com/api"
      }
    }
  ]
}

Example secrets:

{
  "example-http": {
    "token": "replace-me"
  }
}

This split keeps connection details in the tracked config file and credentials in a separate local file.

The repo includes:

Plugin Contract

A plugin module must export either default or definePlugin and return:

type PluginDefinition = {
  name: string;
  description?: string;
  verbs?: ToolflowVerb[];
  tools?: ToolflowTool[];
};

Plugin verbs are wired into toolflow, which keeps the MCP surface to a single execution entrypoint while still allowing local plugin growth behind the flow DSL.

MCP Bridge Plugins

toolflow-mcp can also bridge other stdio MCP servers.

Current mapping model:

  • Namespaced flow verbs for composition
  • No direct top-level MCP re-export for bridged tools

The generic bridge helper launches configured upstream MCP servers over stdio, materializes namespaced flow verbs inside toolflow, and captures upstream stderr so startup banners do not leak into client sessions.

Current bridge:

Built-In Verbs

  • echo: return the first argument or current value
  • get: fetch URL content and parse JSON when possible
  • jq: select a dot-path from the current value
  • write: write the current value to a file and keep flowing
  • read: read a UTF-8 file
  • json: parse the current string value as JSON
  • tee: run a side effect and preserve the current value

Bridge Verb Example

nixos.nix '{"action":"search","source":"nixos","type":"packages","query":"ripgrep","limit":3}'

Install

bun install
bun run dev

Minimal MCP config:

{
  "mcpServers": {
    "toolflow": {
      "command": "toolflow"
    }
  }
}

Scope

  • Bun-first MCP runtime
  • Compositional pipeline execution with trace output
  • Nushell-style structured data passing between steps
  • Configurable plugin loading
  • One top-level MCP tool, with everything else expressed as flow verbs

CLI

The binary also exposes local shell/operator subcommands:

toolflow registry
toolflow status
toolflow doctor
toolflow help

tf is available as a short shell alias when the optional short output is installed.

Next

  • Register plugin-defined direct MCP tools in addition to verbs
  • Add richer selectors and transforms
  • Add OneTool and Context Mode bridge plugins outside the core package