MCP servers
ka is an MCP client. Every server you configure contributes its tools to ka’s Hands registry as <server>__<tool> (double underscore) at exec-tier clearance: the permission gate, rules, snapshots, and decomposition treat them exactly like any external execution. There is no separate trust path. The name is wire-safe by construction: providers reject tool names outside [a-zA-Z0-9_-], so the server__tool name collapses any other character to _.
Configuration
Section titled “Configuration”# stdio server (spawned process)[[mcp]]name = "filesystem"command = "npx"args = ["-y", "@modelcontextprotocol/server-filesystem", "/srv/data"]# env = { SOME_TOKEN = "…" }
# streamable HTTP server (legacy SSE is detected as a fallback)[[mcp]]name = "docs"url = "https://mcp.example.com/mcp"# headers = { Authorization = "Bearer …" }
# per-server policy (any server)[[mcp]]name = "github"url = "https://api.githubcopilot.com/mcp"enabled_tools = ["create_issue", "search_code"] # allowlistdisabled_tools = ["delete_repo"] # blocklistapproval = "writes" # "ask" (default) | "auto" | "writes"tool_timeout_secs = 30output_limit = 65536The policy keys (config reference):
| Key | Meaning |
|---|---|
enabled_tools / disabled_tools |
Filter the server’s catalog down to (or subtract) named tools |
approval |
"ask" is the normal gate default; "auto" skips permission asks but deny-class verdicts and hardstops still apply; "writes" asks only for tools that advertise readOnlyHint = false |
tool_timeout_secs |
Per-tool call timeout |
output_limit |
Cap on a tool result’s size |
OAuth for HTTP servers
Section titled “OAuth for HTTP servers”Set oauth = true on an HTTP server and ka handles the whole flow: dynamic client registration (RFC 7591) and CIMD, a local loopback callback, and a token cache with refresh kept in the data dir, so you authenticate once per server.
For servers with a pre-registered client, oauth_client_id supplies it directly and oauth_scopes narrows the scopes requested. If a server has no OAuth at all, two static alternatives remain: bearer_token_env names an environment variable holding a bearer token, and headers_helper is a command whose output becomes the request headers, for derived or short-lived credentials.
Elicitation, sampling, roots
Section titled “Elicitation, sampling, roots”Server-initiated traffic is not dropped:
- Elicitation requests are routed to ka’s ask UI, so a server asking a question reaches you, not a dead queue.
- Sampling requests are served by your default model.
rootsare honored.- Server-initiated notifications apply live:
tools/list_changedrefreshes ka’s tool catalogs without a restart.
ka mcp-serve
Section titled “ka mcp-serve”ka is also an MCP server: ka mcp-serve exposes its read hands (read, glob, grep, sessions_search, session_info) as a stdio MCP server for any MCP host. bash is deliberately excluded; the server is read-only by design.
Probing and using
Section titled “Probing and using”ka mcp # probe every configured server, list its toolsIn the TUI, /mcp shows server status and /prompt runs MCP prompts. Handshake, tools/list, and tools/call are the only RPCs used; server noise is ignored, and a failing server degrades to a per-server note, never a crash.
Tool lists are cached: after a server’s first successful handshake, its tools are remembered under $XDG_STATE_HOME/ka/mcp-tools.json, keyed by a hash of the server’s config. The next startup registers them from cache instantly, so a slow or dead server never blocks startup and the tool list stays byte-stable across runs (which keeps provider prompt caches stable too). A background verify re-checks the live server, swaps the list with a transcript note if it changed, then chains into the supervision watchdog, so two connects are never in flight. Reconnects and manual refreshes update the cache as well. Caches written by older versions (dotted server.tool names) are re-derived on load, so existing installs heal without deleting state.
[tools.mcp] discovery = "eager"|"lazy"(defaulteager, strict enum) controls when server tool catalogs are loaded.- Tools appear as
<server>__<tool>(double underscore); allowlist rules in[[rules]]use that spelling. - Because MCP tools are exec-tier, they ask under
askmode likebashwould; allowlist them with a[[rules]]entry or[permissions] allowif you trust one. A per-serverapprovalpolicy can narrow this (see above).