mcpField
K
Kimi MCP Server

Kimi MCP Server

Local
github.comAI & Agents1Updated 22w ago

About Kimi MCP Server

Kimi MCP Server connects MCP clients to Moonshot AI's Kimi Code CLI, letting editors use Kimi as a sub-agent. It provides tools for code review, file analysis, session management, and structured brainstorming.

Key features

  1. 01Kimi CLI access through MCP
  2. 02File analysis and code review
  3. 03Session resume and management
  4. 04Sequential or parallel task batches
  5. 05Structured brainstorming modes
  6. 06Working-directory configuration

Use cases

  1. 01Review a branch diff from an editor
  2. 02Ask Kimi to analyze project files
  3. 03Resume a workspace conversation
  4. 04Run several coding tasks as a batch

MCP support

The stdio MCP server exposes tools that invoke Kimi Code CLI. It can also pass an MCP configuration file to Kimi so it can access other MCP servers.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"x51xxx-kimi": {
"command": "npx",
"args": [
"-y",
"@trishchuk/kimi-mcp-server"
],
"env": {
"KIMI_MCP_CWD": "<KIMI_MCP_CWD>",
"KIMI_SESSION_TTL_MS": "<KIMI_SESSION_TTL_MS>",
"KIMI_MAX_SESSIONS": "<KIMI_MAX_SESSIONS>",
"MOONSHOT_API_KEY": "<MOONSHOT_API_KEY>"
}
}
}
}
Run commandnpx -y @trishchuk/kimi-mcp-server
Environment variables to set
KIMI_MCP_CWDOverride working directory for all tool calls
KIMI_SESSION_TTL_MSSession time-to-live in milliseconds (default: 86400000 = 24h)
KIMI_MAX_SESSIONSMaximum concurrent sessions (default: 50)
MOONSHOT_API_KEYSecretForwarded to Kimi CLI for unattended auth. Leave unset to use OAuth (run `kimi /login` once).

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@trishchuk/kimi-mcp-server0.2.0

Tools

14

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
cdstringNoWorking directory
afkbooleanNo--afk: auto-approve in away-from-keyboard mode (print mode implies this).
planbooleanNoStart in plan mode (--plan). For richer planning, prefer the plan-kimi tool.
yolobooleanNo⚠️ --yolo: auto-approve everything (dangerous, full file access).
agentenumNoBuiltin agent spec to use (--agent). "default" or "okabe".default | okabe
modelstringNoOptional model override. Known: kimi-for-coding, kimi-k2-6, kimi-k2-6-turbo, kimi-k2-thinking-turbo, kimi-k2-5, kimi-latest. If omitted, uses your Kimi CLI default (~/.kimi/config.toml).
quietbooleanNoUse --quiet (= --print --output-format text --final-message-only).
configanyNoConfiguration overrides — string (JSON/TOML) or object passed via --config.
dryRunbooleanNoReturn the resolved CLI argv as JSON without spawning Kimi.
promptstringYesTask or question. Use @ to include files (e.g., '@largefile.ts explain').
addDirsarrayNoAdditional writable directories (--add-dir, repeatable).
timeoutnumberNoMaximum execution time in milliseconds (optional)
thinkingbooleanNoToggle thinking mode (overrides default_thinking from config).
agentFilestringNoCustom agent spec file (--agent-file).
finalOnlybooleanNoAdd --final-message-only — skip intermediate tool-call output. Default: true.
sessionIdstringNoInternal session ID for conversation continuity (workspace-isolated).
configFilestringNoPath to a config file (TOML or JSON).
skillsDirsarrayNoCustom skills directories (--skills-dir, repeatable). Overrides default discovery.
workingDirstringNoWorking directory for execution (alias of cd)
outputFormatenumNoKimi --output-format. "text" (default for clean responses) or "stream-json" (JSONL with assistant + tool messages).text | stream-json
resetSessionbooleanNoClear session context before execution. Starts fresh conversation.
responseModeenumNoResponse verbosity: "clean" returns only the final answer (default), "full" includes tool calls and stderr execution log.clean | full
mcpConfigFilestringNoPath to an MCP config file with `mcpServers` (passed via --mcp-config-file).
continueLatestbooleanNoUse --continue to resume the most recent Kimi session in cwd.
includeMetadatabooleanNoInclude tool-call metadata in response (only meaningful with stream-json).
maxStepsPerTurnintegerNoCap steps in one turn (--max-steps-per-turn).
maxRalphIterationsintegerNoExtra autonomous iterations after the first turn (--max-ralph-iterations, -1 = unlimited).

Details

From the project README

Kimi MCP Server

License: MIT

MCP server (stdio) that bridges Claude / Cursor / any MCP client to Moonshot AI's Kimi Code CLI.

Architecture mirrors @trishchuk/codex-mcp-tool — same patterns, adapted to Kimi's flag surface (--print, --quiet, -r, --continue, --add-dir, --mcp-config-file, --config).

Why

Kimi K2.6 (April 2026) is a 1T-parameter MoE open-weight model with native agent-swarm orchestration, 262k context, and SWE-Bench Pro on par with GPT-5.5. Kimi Code CLI is the reference agent harness. This server lets MCP-aware editors call Kimi as a sub-agent without leaving their primary interface.

Install

npm install -g @trishchuk/kimi-mcp-server

You also need Kimi Code CLI:

curl -LsSf https://code.kimi.com/install.sh | bash
# OR
uv tool install --python 3.13 kimi-cli

Then run kimi once and use /login to authenticate via the Kimi Code platform — or set MOONSHOT_API_KEY.

Configure (Claude Desktop / Cursor / Claude Code)

Minimal — working directory is auto-detected from PWD / INIT_CWD / process.cwd(), just like codex-mcp-tool:

{
  "mcpServers": {
    "kimi": {
      "command": "kimi-mcp"
    }
  }
}

Pin a specific project root only if your client launches the server from somewhere unrelated:

{
  "mcpServers": {
    "kimi": {
      "command": "kimi-mcp",
      "env": { "KIMI_MCP_CWD": "/absolute/path/to/your/project" }
    }
  }
}

You can also override per call via the workingDir argument on ask-kimi, or let the server infer it from @path/to/file references in the prompt — same priority chain as codex-mcp-tool: workingDir arg → KIMI_MCP_CWD → PWD → INIT_CWD → @path inference → process.cwd().

Tools

ToolWhat it does
ask-kimiMain entry — file analysis (@path), session resume, MCP passthrough
brainstormStructured ideation (divergent / convergent / SCAMPER / design-thinking / lateral / auto)
batch-kimiSequential or parallel atomic tasks with priority, stop-on-error, structured report
review-changesCode review of working tree / branch diff / specific commit (collects git diff and prompts Kimi)
list-sessionsList, delete, or clear active conversation sessions
healthDiagnose Kimi CLI installation, auth, and session state
ping / Help / versionSmoke tests + help passthrough
ask-kimi highlights
  • prompt — supports @path/to/file to drop file context (Kimi reads via working dir).
  • model — overrides default_model at runtime via --config. Known: kimi-for-coding, kimi-k2-6, kimi-k2-thinking-turbo, kimi-k2-5, kimi-latest.
  • thinking — toggles thinking mode (writes default_thinking into runtime config).
  • outputFormat — text (default) or stream-json (JSONL of assistant + tool messages, parsed transparently).
  • responseMode — clean (default; final assistant text only) or full (tool calls + stderr log + final).
  • sessionId — workspace-isolated session ID (md5 of repo:head:path). The server tracks the native Kimi session ID returned by the CLI and replays it via kimi -r <id>.
  • continueLatest — sets --continue (resume the most recent session in the cwd).
  • mcpConfigFile — passes --mcp-config-file so Kimi can talk to other MCP servers from inside this process.
  • addDirs — repeats --add-dir for multi-root projects.
  • yolo / afk — approval shortcuts (print mode auto-approves anyway, but useful for documentation/logging).

CLI compatibility

FeatureKimi CLI
Print / non-interactive--print (required for MCP); --quiet = --print --output-format text --final-message-only
JSON streaming--output-format=stream-json, --input-format=stream-json
Sessions--continue, --session <id>, -r <id>
Configuration--config-file <path>, --config '<json/toml>'
Workspacespawn cwd + --add-dir <path> (no --cd flag)
MCP passthrough--mcp-config-file or kimi mcp add
Exit codes0 ok, 1 fatal, 75 retryable transient

Environment

VarDefaultPurpose
KIMI_MCP_CWD—Override working directory for every tool call
KIMI_SESSION_TTL_MS86400000 (24h)Session expiration
KIMI_MAX_SESSIONS50Max concurrent sessions
MOONSHOT_API_KEY—Forwarded to Kimi CLI for unattended auth

Development

npm install
npm run build       # tsc → dist/
npm run lint        # tsc --noEmit
node dist/index.js  # smoke run on stdio

License

MIT — Taras Trishchuk

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.