使用说明
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.valueto select from the current value. - Use
teeto 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.jsontoolflow.secrets.json
Environment overrides:
TOOLFLOW_CONFIGTOOLFLOW_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:
toolflow.config.jsonas the default tracked configtoolflow.secrets.example.jsonas the tracked secrets template
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:
nixos-bridgeinsrc/plugins/nixos-bridge.ts
Built-In Verbs
echo: return the first argument or current valueget: fetch URL content and parse JSON when possiblejq: select a dot-path from the current valuewrite: write the current value to a file and keep flowingread: read a UTF-8 filejson: parse the current string value as JSONtee: 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
