MCP: Connecting Servers to Kimi Code
Kimi Code CLI is an MCP client. MCP tools appear alongside built-in tools with no behavioral difference, named mcp__<server>__<tool> (e.g. mcp__github__create_issue).
The short version
- In the TUI, run
/mcp-configand add the server interactively (it also handles MCP OAuth login via/mcp-config login <server-name>). - Or edit
mcp.jsondirectly (below). - Run
/mcpto confirm the server connected.
mcp.json
Config locations: user-level ~/.kimi-code/mcp.json (or $KIMI_CODE_HOME/mcp.json) and project-level .kimi-code/mcp.json. On same-name entries, project wins. MCP servers are not configured in config.toml.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
},
"linear": {
"url": "https://mcp.linear.app/mcp"
},
"legacy-events": {
"transport": "sse",
"url": "https://mcp.example.com/sse"
}
}
}
Transports: stdio (child process, via command/args), HTTP (via url), and sse (legacy; explicit transport: "sse").
Optional per-server fields: env, cwd (stdio), headers, bearerTokenEnvVar (HTTP/SSE), enabled, startupTimeoutMs (default 30000), toolTimeoutMs (default 60000), enabledTools, disabledTools. Timeout precedence: per-server > env var (KIMI_MCP_STARTUP_TIMEOUT_MS / KIMI_MCP_TOOL_TIMEOUT_MS) > config.toml [mcp] > built-in default.
A concrete example: GitHub over stdio
# 1. Add to ~/.kimi-code/mcp.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "ghp_…" }
}
}
}
# 2. In the TUI, verify:
/mcp
# 3. Use it — the agent now has tools like mcp__github__create_issue:
"Create a GitHub issue for the flaky test in src/api.test.ts"
Things to know
- Trust: project-level MCP servers in an untrusted folder appear in the workspace trust prompt (default answer: “Trust this folder”). Review the launch command/URL before confirming — trusting enables the project’s MCP servers.
- Mid-session changes: deleting a server doesn’t kill open sessions (listed as
removed; calls fail); servers added mid-session only join new sessions. - Permissions: rules support
*/**wildcards (mcp__github__*); MCP tool args are not part of matching. Unmatched calls trigger approval. In Ask When Needed mode MCP calls are auto-approved — the docs warn to use that mode only with trusted servers. See Permissions and Approvals. - Plugins can declare
mcpServersin their manifest (enabled by default; toggle with/plugins mcp enable|disable <id> <server>then/reload).
Last verified: 2026-09-07
Official sources:
- https://www.kimi.com/code/docs/en/kimi-code-cli/customization/mcp.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/data-locations.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html
AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.