MCP servers
An MCP server gives the agent more tools: an issue tracker, a database, internal docs. zelk connects to the servers you list, starts local ones itself, and offers their tools beside its own.
The server file
Section titled “The server file”zelk reads servers from ~/.config/zelk/mcp.json, or the file
-mcp-config FILE names:
{"mcpServers": { "local": {"command": "/usr/local/bin/tools", "args": ["serve"], "env": {"TOKEN": "$TOOLS_TOKEN"}}, "docs": {"url": "https://docs.example.com/mcp", "headers": {"Authorization": "$DOCS_AUTH"}}, "wiki": {"url": "https://wiki.example.com/mcp", "oauth": {"clientId": "zelk-cli", "scopes": ["read"]}}}}zelk reads the file whoever else can read it, on every platform, since it may be one a team shares in a repository. A header or an environment value in it can be a credential, so keep such a file where only you can read it. A configuration zelk saves is private to you already.
Each server has exactly one of:
command, for a server zelk starts and talks to over standard input and output. Use an absolute path, or on Windows a bare name such asnpxwith"args": ["-y", "some-server"]. Windows resolves names using the server’s PATH and PATHEXT and skips executables in the workspace.argsandenvare optional. The server runs in the agent’s sandbox when there is one.url, for a server over streamable HTTP, with optionalheaders.
A value in env or headers, or an OAuth clientSecret, written as
$NAME is read from the variable NAME when zelk starts, so secrets stay
out of the file. The whole value is the reference: "$DOCS_AUTH", not
"Bearer $DOCS_AUTH". An unset or empty variable is an error. Unknown
fields are errors too.
On Windows, .cmd and .bat shims run through the system command
interpreter. Batch arguments support spaces, tabs, commas, semicolons,
equals signs and empty strings. zelk refuses quotes, %, !, ^, &,
|, <, >, ( and ) because cmd can interpret them as syntax. It
also refuses invalid UTF-8, ASCII control characters other than tabs, DEL,
and a final backslash in an argument that needs quoting.
zelk doesn’t read a project’s .mcp.json; the servers are yours.
Manage servers
Section titled “Manage servers”In the terminal UI, MCP servers… in the palette adds, removes and connects servers, and signs in and out of those that use OAuth. From a shell:
zelk mcp list # each server, and whether it is signed inzelk mcp login wiki # sign in to a server that uses OAuthzelk mcp logout wiki # forget its tokenszelk mcp login prints a link to open in a browser. A server named by
its URL works too. Until a server that requires OAuth is signed in, zelk
starts without it and says so. Without an oauth entry, zelk registers
itself with the server’s authorization server, where that is allowed.
Sign-ins are kept in ~/.config/zelk/mcp-oauth.json, readable only by
you, or the system keychain with -credential-store keychain.
Permissions
Section titled “Permissions”MCP tools are named mcp__SERVER__TOOL. zelk never treats them as
read-only, whatever the server says, so in default mode each call asks
until a rule allows it:
zelk -allow 'mcp__wiki__search' -deny 'mcp__wiki__delete_*'mcp__wiki__* names every tool of one server.
Many tools: search instead of schemas
Section titled “Many tools: search instead of schemas”Servers can bring dozens of tools, and every tool’s schema costs context
on every request. So zelk can defer MCP tools: it lists them by name
only, and the agent finds the ones it needs with ToolSearch.
- On a model that loads tools natively (Anthropic’s Messages and OpenAI’s Responses APIs, on models that support it), every MCP tool is deferred. A tool the search finds is called by its own name, and the cached prompt is untouched.
- Elsewhere, MCP tools are deferred once their schemas would take more than
10% of the context window, and the agent calls a found tool through
CallTool.
You can change this:
| Flag | Setting | Effect |
|---|---|---|
-deferred-tool-tokens N |
deferred_tool_tokens |
defer once schemas pass N tokens, on every model |
-no-deferred-tools |
"deferred_tools": false |
always send every schema |
-tool-loading auto|on|off |
native loading: auto uses it only at the vendor’s own URL; on vouches for a gateway or proxy that passes the fields through |
To keep some tools of a server loaded whatever is deferred, name them in
its entry: "alwaysLoad": ["create_issue"], or ["*"] for all of them.
Where to go deeper
Section titled “Where to go deeper”- The tools contract: how deferred tools are sent to each provider
- The CLI reference and settings