mcp
Expose Clanker through the Model Context Protocol.
The mcp command starts a local MCP server for the Clanker CLI. MCP clients can use it to inspect Clanker routing decisions, return the installed CLI version, and run real Clanker commands through a local transport.
Usage
clanker mcp [flags]Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--transport | string | http | MCP transport to use: http or stdio |
--listen | string | 127.0.0.1:39393 | Listen address for the HTTP MCP transport |
Transports
HTTP Transport
Use HTTP when you want a persistent local endpoint that multiple tools or scripts can call.
clanker mcp --transport http --listen 127.0.0.1:39393This exposes the MCP endpoint at http://127.0.0.1:39393/mcp.
Stdio Transport
Use stdio when your MCP client launches the Clanker process directly.
clanker mcp --transport stdioAvailable Tools
The CLI MCP server currently exposes these tools:
| Tool | Description |
|---|---|
clanker_version | Return the installed Clanker CLI version |
clanker_route_question | Return the internal routing decision for a natural-language question |
clanker_run_command | Run a local Clanker command and return its output and exit code |
HTTP Examples
Start the local server:
clanker mcp --transport http --listen 127.0.0.1:39393Initialize a client session:
curl -sS -X POST http://127.0.0.1:39393/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"local-cli","version":"1.0"}}}'List available tools:
curl -sS -X POST http://127.0.0.1:39393/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'Return the installed Clanker version:
curl -sS -X POST http://127.0.0.1:39393/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"clanker_version","arguments":{}}}'Inspect how Clanker would route a question:
curl -sS -X POST http://127.0.0.1:39393/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"clanker_route_question","arguments":{"question":"use clanker cloud mcp to show my saved settings"}}}'Run a real Clanker command through MCP:
curl -sS -X POST http://127.0.0.1:39393/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"clanker_run_command","arguments":{"args":["ask","--route-only","use clanker cloud mcp to show my saved settings"]}}}'Running Commands Through MCP
clanker_run_command accepts the same subcommands you would normally pass to the local CLI, except mcp itself. This makes it useful for editor integrations and chat clients that want one MCP entry point for normal Clanker operations.
For example, you can run a normal ask query:
{
"args": ["ask", "what lambda functions have the most errors?", "--aws"]
}You can also pass optional command-level overrides in the MCP arguments:
| Field | Type | Description |
|---|---|---|
args | string[] | Required. The Clanker subcommand and arguments to run |
profile | string | Optional AWS profile override |
backendUrl | string | Optional backend URL override for backend-aware commands |
backendEnv | string | Optional backend environment override |
debug | bool | Optional debug mode override |
Clanker Cloud Routing
The CLI router also understands explicit Clanker Cloud phrasing. If you ask questions like use clanker cloud, ask clanker cloud, or clanker cloud mcp, Clanker can route those requests toward the running desktop app backend when it is available.
That means you can use CLI MCP for two related workflows:
- Use the standalone CLI MCP server to expose normal Clanker tools.
- Ask Clanker to route app-specific prompts to the local Clanker Cloud backend.
For examples of app-specific routing through clanker ask, see ask.
See Also
- ask -- Ask questions and inspect routing decisions
- talk -- Multi-turn conversations with Clanker agents
- Quick Start -- Common CLI workflows, including MCP startup