kimi-cli-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kimi-cli-mcp start a kimi session to fix the failing tests in src/"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
kimi-cli-mcp
MCP server that delegates coding tasks to your locally installed
Kimi Code CLI (kimi).
It wraps the real kimi binary instead of bundling its own copy of the agent, so every call
inherits your kimi auth, models and ~/.kimi-code config. Nothing about your model stack is
duplicated here, and the server does not drift when you upgrade kimi.
Sibling of pi-cli-mcp, qwen-cli-mcp and grok-cli-mcp — same architecture, same principles, kimi behind the wheel.
Use it when your primary agent should hand work to native Kimi as it already does to pi / qwen / grok.
Verified against kimi 0.41.0 (~/.kimi-code/bin/kimi) and native source
kimi-code@aad4a7df2.
Install
Requires Node ≥ 22 and a working kimi on PATH.
This package is not activated automatically. Add it only when you want a
separate MCP named kimi.
Claude Code (example — do not run unless you intend to activate)
Clone and build from source (not yet published to npm):
git clone https://github.com/minmax/kimi-cli-mcp.git
cd kimi-cli-mcp
npm ci
npm run build
claude mcp add-json kimi -s user "{
\"type\": \"stdio\",
\"command\": \"node\",
\"args\": [\"$(pwd)/dist/index.js\"],
\"timeout\": 3600000
}"Or with an explicit binary:
{
"mcpServers": {
"kimi": {
"command": "node",
"args": ["/absolute/path/to/kimi-cli-mcp/dist/index.js"],
"env": { "KIMI_MCP_BIN": "/absolute/path/to/kimi" }
}
}
}Keep the server name short (kimi): it becomes part of the tool names your model sees.
⚠️ Default ACP approval mode is
yolo. Delegation is only useful when the delegate can act. Print mode (transport: "print") already executes tools without confirmation; combining-pwith-yis a CLI error and this adapter never does that.
Related MCP server: pi-cli-mcp
Tools
Tool | Purpose |
| Start a session. Returns |
| Continue a finished or interrupted session — including one killed by a timeout. |
| List models this install has configured ( |
| Deliver into a turn executing right now ( |
| List turns executing right now that |
| List known sessions started through this server, newest first. |
| Read visible user/assistant/tool history from native |
kimi
Argument | Notes |
| Required. Must be self-contained — kimi cannot see your conversation. |
| Absolute path; defaults to this server's cwd. |
|
|
|
|
| ACP-only: |
| Comma-separated extra absolute dirs ( |
|
|
| Wall clock for this run. Off unless you set it. |
Not supported (honest error, not a fake flag): effort, allowed_tools, system_prompt_append.
Kimi has no --effort; pick a model alias such as stepfun-high/step-3.7-flash. Prompt mode
already runs tools; -y with -p is rejected by the CLI.
kimi({
prompt: "Read and execute the prompt: /abs/path/prompt.md",
cwd: "/abs/path/to/repo",
model: "kimi-code/k3"
})
// later:
kimi_reply({
session: "<id from the prefix>",
prompt: "Now check the error paths of those call sites."
})What comes back
Only kimi's final result plus aggregate stats — never the transcript, thinking, tool arguments or raw stdout:
[session: session_0927adc5-a840-4b68-93ca-5ca344c9fafb]
Refactored retry() in src/http.rs; all 12 tests pass.
---
kimi: kimi-code/k3 · 1 turn · 5 tool calls: Read×2, Bash×2, Edit · 12s
kimi wrote: src/http.rsOn acp the text is assembled from agent_message_chunk updates (thought chunks dropped).
On print it is the last role: assistant content from --output-format stream-json
(thinking is not on that stream). Session identity comes from ACP session/new or print
session.resume_hint.
Sessions
kimi returns a session id; kimi_reply resumes it with session/load (acp) or -S (print).
The conversation lives in kimi's own store (~/.kimi-code/sessions/...), so follow-ups keep
working across restarts of this server — the session → directory map is persisted in
~/.local/state/kimi-mcp/sessions.json.
Concurrent replies to one session are serialized per server process.
Transports
|
| |
command |
|
|
process | stays up, speaks ACP JSON-RPC | one process per turn, exits when done |
mid-run delivery |
| impossible |
follow-up |
|
|
deadline / cancel | kimi's | SIGTERM, then SIGKILL |
This server never sends anything into kimi on its own. kimi_send fires only when the caller calls it.
History
kimi_history reads $KIMI_CODE_HOME/sessions/<workspace>/<id>/agents/main/wire.jsonl
without taking the session lock and without talking to a live process. Visible items are
user / assistant / tool / gap. Thought, encrypted blobs and reasoning are omitted. State is
active if this process is running the turn, otherwise unknown — a missing registry row
is not treated as completed. The cursor is always returned, including at EOF, so a later
append can be read; a partial trailing JSONL line is truncated_tail. Paths outside the
session store are rejected.
Environment
Variable | Default | Meaning |
|
| Path to the kimi binary. |
|
| Default ACP mode for every call. |
| unset | Default model for every call. |
|
| Default transport: |
| unset | Server-wide default wall clock; unset means no deadline. |
|
| Ceiling on what |
|
| Concurrent kimi processes. |
| unset | Cap on the answer. Unset means no truncation. |
|
| stderr tail included in the response. |
| unset |
|
|
| Read-buffer guard against a runaway stream. |
|
| Longest single message line from kimi before it is dropped. |
|
| Longest single JSON-RPC frame from the client. |
|
| Remembered sessions before the oldest is dropped. |
|
| SIGTERM → SIGKILL grace period. |
|
| How long |
|
| Initialize-handshake timeout (acp only). |
|
| Whole-run budget for the |
|
| Session → cwd map. |
| unset | Command prefix, e.g. a sandbox wrapper around kimi. |
|
| Native kimi data root (forwarded to the child). |
Development
TypeScript (native tsc), Biome, Vitest. Tests drive the real server binary over stdio against a
fixture that speaks kimi's protocol; live tests against the installed kimi are opt-in.
npm run hooks # once per clone: git hooks from .githooks/
npm run build # tsc -> dist/
npm test # unit + type tests, no API access, no tokens
npm run test:live # live tests against the real kimi binary (spends tokens)
npm run check # format + types + tests
npm run fix # biome --writeVerification: the deterministic suite passes; two opt-in live prompt tests are skipped. The recorded live check covers model discovery only, not a real prompt/reply run.
License
MIT
Available Tools
7 toolskimiADestructive
Start a NEW task in the local Kimi Code agent — a separate CLI coding agent with its own file/shell tools and its own context window. Blocks until kimi settles, then returns only its final result plus stats, prefixed [session: ]; continue that session later with kimi_reply.
Good for: a second opinion from a different model, work kept out of this context, or parallel investigation.
Caution: with approval_mode 'yolo' (the server default, ACP) kimi edits files and runs shell commands as your user inside cwd without asking. Print mode also executes tools without confirmation (and forbids combining -p with -y).
Inputs: prompt (required), cwd, model, add_dirs, +4 more.
kimi_historyARead-onlyIdempotent
Read a bounded snapshot of a kimi session's visible conversation from kimi's native agents/main/wire.jsonl. Does not send anything into the run, does not take the session lock, and does not wait for kimi to finish. Returns JSON: session, state (active if this process is running it, otherwise unknown — sessions stay resumable so 'completed' is not claimed), items (user / assistant / tool / gap), an opaque cursor to resume even at the current EOF, has_more, truncated_tail. Thought/reasoning/encrypted content are omitted. User text comes only from context.append_message with role=user — if that stream has none, the page says so rather than inventing prompts from session metadata. Caps: limit (default 50, max 200), max_chars per item (default 4000, max 16000), and 100000 chars on the whole JSON page.
Inputs: session (required), limit, cursor, max_chars, +1 more.
kimi_modelsARead-onlyIdempotent
List the models this kimi installation has configured right now — read live from kimi provider list --json. Use it to pick a model value for kimi / kimi_reply. Starts no task. This is the configured catalog, not a paid probe of every endpoint.
Inputs: search.
kimi_replyADestructive
Send a new turn to an existing kimi session that is not executing right now — including one that timed out or was cancelled: the session survives in kimi's own store, so resume it here instead of restarting with kimi. kimi still has its prior turns (but never this conversation), so the follow-up can be short. Survives restarts of this server. For a turn still running under 'acp', use kimi_send instead.
Inputs: prompt (required), session (required), cwd, model, +5 more.
kimi_runningARead-onlyIdempotent
List kimi turns executing at this moment — the ones kimi_send can reach — with session id, working directory, elapsed time, and messages already sent in. Only acp-transport runs appear; 'print' runs are unreachable mid-run. For past sessions use kimi_sessions.
Inputs: no named parameters.
kimi_sendADestructive
Deliver a message into a kimi turn that is executing right now. The default transport 'acp' keeps the turn reachable; 'print' runs cannot be reached, and a session that already finished takes kimi_reply, not kimi_send. Returns immediately; kimi's reaction appears in the answer of the kimi/kimi_reply call still waiting on that turn. kimi_running lists reachable sessions.
Note: the adapter reports the first result envelope; a follow_up queued behind the current turn is delivered but its answer is not awaited by the original call.
Inputs: session (required), command, message.
kimi_sessionsARead-onlyIdempotent
List all kimi sessions started through this server, newest first, with their working directory — running or finished, including runs that timed out. Use it to recover an id for kimi_reply. For turns still executing (kimi_send targets), use kimi_running.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct phase of the Kimi session lifecycle: start (kimi), resume (kimi_reply), message a running turn (kimi_send), list running (kimi_running), list all (kimi_sessions), read history (kimi_history), and list models (kimi_models). The overlapping pairs (reply/send, running/sessions) are explicitly differentiated by execution state.
All tools share the kimi_ prefix with lowercase snake_case names. The only deviation is the root verb `kimi` itself for starting a new session, which is a natural base command; the pattern is otherwise uniform (kimi_ + verb/noun).
Seven tools cover the full lifecycle of orchestrating a Kimi CLI agent: start, resume, send, list running/all, history, and models. This is well-scoped for the server's stated purpose without redundancy.
Core session lifecycle is well covered: start, reply, send while running, list running/all, read history, and list models. Missing an explicit cancel/stop operation for running turns, which is a minor gap but likely handled outside the tool surface.
Maintenance
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Develop, manage, and debug Railway projects, services, and deployments from within agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceBridges MCP clients to Moonshot AI's Kimi Code CLI, enabling file analysis, brainstorming, batch tasks, code reviews, and session management within editors like Claude Desktop and Cursor.14145 npm1MIT
- AlicenseAqualityCmaintenanceDelegates coding tasks to your locally installed pi CLI, inheriting providers, models, and extensions, with persistent sessions and cancellable calls.617 npmMIT
- AlicenseAqualityCmaintenanceEnables Codex to delegate coding tasks to an OpenCode CLI locally, returning structured results such as exit codes, session summaries, tool calls, and git diffs.2MIT
- AlicenseAqualityBmaintenanceEnables delegation of coding tasks to a locally installed MiniMax Code CLI, leveraging user's existing login, models, and configuration.728 npmMIT