Skip to content

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

bash
clanker mcp [flags]

Flags

FlagTypeDefaultDescription
--transportstringhttpMCP transport to use: http or stdio
--listenstring127.0.0.1:39393Listen 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.

bash
clanker mcp --transport http --listen 127.0.0.1:39393

This 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.

bash
clanker mcp --transport stdio

Available Tools

The CLI MCP server currently exposes these tools:

ToolDescription
clanker_versionReturn the installed Clanker CLI version
clanker_route_questionReturn the internal routing decision for a natural-language question
clanker_run_commandRun a local Clanker command and return its output and exit code

HTTP Examples

Start the local server:

bash
clanker mcp --transport http --listen 127.0.0.1:39393

Initialize a client session:

bash
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:

bash
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:

bash
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:

bash
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:

bash
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:

json
{
  "args": ["ask", "what lambda functions have the most errors?", "--aws"]
}

You can also pass optional command-level overrides in the MCP arguments:

FieldTypeDescription
argsstring[]Required. The Clanker subcommand and arguments to run
profilestringOptional AWS profile override
backendUrlstringOptional backend URL override for backend-aware commands
backendEnvstringOptional backend environment override
debugboolOptional 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:

  1. Use the standalone CLI MCP server to expose normal Clanker tools.
  2. 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