kimi-code-mcp
English | 中文說明
Delegate codebase analysis from Claude to Kimi Code (default: K3 / k3, 256K) — cut Claude-side token cost ~90%.
Power your agent
การติดตั้งจากผู้เผยแพร่ ไม่ใช่เอนด์พอยต์ของ PlugMCP
URL แบบรีโมตหรือคำสั่งบนเครื่องของคุณ? การติดตั้งสองแบบต่างกันอย่างไร
รันบน PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
เปิดจากผู้เผยแพร่
English | 中文說明
Delegate codebase analysis from Claude to Kimi Code (default: K3 / k3, 256K) — cut Claude-side token cost ~90%.
MCP server for Claude Code × Kimi K2.5 (256K context) — delegate bulk codebase analysis to Kimi, save 90% on token costs. Session caching, parallel agents, TypeScript.
*Illustrative estimates — savings are on Claude tokens only and depend on the task; Kimi's subscription cost is separate. See Token Economics.
# 1. Install Kimi CLI and log in
curl -L code.kimi.com/install.sh | bash
kimi login
# 2. Install via npm
npm install -g kimi-mcp-server
Add to .mcp.json (project-level or ~/.claude/mcp.json for global):
{
"mcpServers": {
"kimi-code": {
"command": "npx",
"args": ["-y", "kimi-mcp-server"]
}
}
}
Run /mcp in Claude Code to verify — you should see kimi-code with 8 tools.
The MCP defaults to k3 and explicitly passes -m kimi-code/k3 for CLI calls.
Override it with the tool's model argument or KIMICODE_MODEL / KIMI_MODEL
(argument takes priority). Run kimi provider list to check installed aliases;
the CLI's own default may differ from the MCP default.
[!TIP] You don't need the CLI for the common case.
kimi_queryandkimi_verifycall the Kimi Code API directly — no Python CLI install orkimi loginrequired. Just provide an API key via$KIMICODE_API_KEYor~/.kimi/config.toml(see Kimi Code API Setup). Only the codebase-reading tools (kimi_analyze,kimi_resume) need the CLI. See Two backends: API vs CLI for the full split.
kimi_analyze tool when a task needs bulk codebase reading.kimi-for-coding, 256K context) — Kimi reads the entire codebase in one pass.┌──────────────┐ stdio/MCP ┌──────────────┐ subprocess ┌──────────────┐
│ Claude Code │ ◄──────────► │ kimi-code-mcp│ ────────────► │ Kimi CLI │
│ (conductor) │ │ (MCP server) │ │ (256K ctx) │
└──────────────┘ └──────────────┘ └──────────────┘
The server reaches Kimi two different ways, and each tool uses the one that fits its job. Knowing which is which tells you what you need to set up.
[!IMPORTANT] Most users only need the API key. If you just want a second opinion / verification (
kimi_query,kimi_verify), set the API key and you're done — skip the CLI entirely. Install +kimi loginonly when you want Kimi to read your codebase viakimi_analyze/kimi_resume.
Run kimi_status any time to see which backends are live — it reports the API-configured state and the CLI install/auth state separately.
If you are an AI agent (Claude Code, a subagent, etc.) deciding when to call these tools:
kimi_verify. Paste the actual diff/code/claim plus the surrounding context (goal, constraints, signatures). Kimi sees only the context string — no repo, no session history. Vague context → useless review.kimi_query. No codebase needed. Returns a different model's opinion.kimi_analyze with work_dir. Prefer this over reading 50 files yourself; it's ~10× cheaper in Claude tokens. Requires the CLI to be installed and logged in.kimi_resume with the returned session_id (retains up to 256K tokens of prior context).kimi_status first. "Not authenticated" on the CLI does not affect kimi_query/kimi_verify (those use the API).detail_level: summary for orientation; raise to normal/detailed only when you need code snippets. Bigger output = more Claude tokens, defeating the purpose.MCP server that connects Kimi Code (model kimi-for-coding, 256K context, auto-upgraded) with Claude Code — letting Claude orchestrate while Kimi handles the heavy reading.
[!TIP] Stop paying Claude to read files. Kimi Code delivers frontier-class code intelligence at a fraction of the cost (see chart above). Delegate bulk codebase scanning to Kimi (256K context, near-zero cost) and let Claude focus on what it does best — reasoning, decisions, and precise code edits. One
kimi_analyzecall can replace 50+ file reads.
Kimi Code is an AI code agent by Moonshot AI. The model ID kimi-for-coding (1T MoE, 256K context) automatically receives backend upgrades — no version pinning required. It works across Terminal, IDE, and CLI — writing, debugging, refactoring, and analyzing code autonomously.
Key specs:
curl -L code.kimi.com/install.sh | bash[!WARNING] Kimi Code membership required. All tools ultimately hit Kimi Code, which needs an active Kimi Code plan. The API tools (
kimi_query,kimi_verify) authenticate with an API key; the codebase tools (kimi_analyze,kimi_resume) additionally need the CLI installed +kimi login. See kimi.com/code for pricing tiers and quotas.
If you prefer to build locally instead of using the npm package:
git clone https://github.com/howardpen9/kimi-code-mcp.git
cd kimi-code-mcp && npm install && npm run build
{
"mcpServers": {
"kimi-code": {
"command": "node",
"args": ["/absolute/path/to/kimi-code-mcp/dist/index.js"]
}
}
}
[!NOTE] Kimi Code API and Moonshot API are separate providers — their API keys are not interchangeable.
Configure CLI OAuth and direct API access separately:
For codebase analysis with the CLI, run:
kimi login
Complete authorization in the browser. Kimi Code 2.x manages its OAuth provider
and configuration under ~/.kimi-code; legacy installations use ~/.kimi.
Use kimi provider list to confirm that kimi-code/k3 is available.
[!NOTE]
zsh: command not found: kimiafter install? The installer puts the binary at~/.local/bin/kimi, which may not be on yourPATH. Add it (then restart your shell or open a new tab):echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrcThe MCP server calls the binary by absolute path, so this only affects running
kimiyourself in a terminal (e.g. forkimi login).
API key discovery checks KIMICODE_API_KEY, KIMI_CODE_API_KEY, then KIMI_API_KEY.
Config files are checked in this order: $KIMI_SHARE_DIR/config.toml (if set),
~/.kimi/config.toml, then ~/.kimi-code/config.toml. KIMI_BASE_URL overrides
the API endpoint. OAuth login alone does not configure a key for the direct API tools.
sk-, shown only once)The examples below use the legacy CLI config format. The MCP also reads
api_key / base_url from provider sections in ~/.kimi-code/config.toml.
For direct API access, setting KIMICODE_API_KEY is sufficient; model tables
and CLI defaults do not control the MCP's model selection.
nano ~/.kimi/config.toml
Add:
[providers.kimi-code]
type = "kimi"
base_url = "https://api.kimi.com/coding/v1"
api_key = "sk-your-api-key"
[models.kimi-for-coding]
provider = "kimi-code"
model = "kimi-for-coding"
max_context_size = 262144
capabilities = ["thinking"]
[defaults]
model = "kimi-for-coding"
# Add to ~/.zshrc (macOS) or ~/.bashrc (Linux)
export KIMICODE_API_KEY="sk-your-api-key"
Then reference it in config.toml:
[providers.kimi-code]
type = "kimi"
base_url = "https://api.kimi.com/coding/v1"
api_key = "${KIMICODE_API_KEY}"
You can configure both Kimi Code and Moonshot side by side:
[providers.kimi-code]
type = "kimi"
base_url = "https://api.kimi.com/coding/v1"
api_key = "${KIMICODE_API_KEY}"
[providers.moonshot-cn]
type = "kimi"
base_url = "https://api.moonshot.cn/v1"
api_key = "${MOONSHOT_API_KEY}"
[models.kimi-for-coding]
provider = "kimi-code"
model = "kimi-for-coding"
max_context_size = 262144
capabilities = ["thinking"]
[models.kimi-k2]
provider = "moonshot-cn"
model = "kimi-k2-0905-preview"
max_context_size = 256000
capabilities = ["thinking"]
[defaults]
model = "kimi-for-coding"
Switch models at any time with /model or /model kimi-k2 in the CLI.
Just tell Claude what you need. It will delegate to Kimi automatically:
Claude Code is powerful but expensive. Every file it reads costs tokens. Meanwhile, many tasks — pre-reviewing large codebases, scanning for patterns, generating audit reports — are high-certainty work that doesn't need Claude's full reasoning power.
[!IMPORTANT] The cost equation: Claude reads 50 files to understand your architecture = expensive. Kimi reads 50 files via
kimi_analyze= near-zero cost. Claude then acts on Kimi's structured report = minimal tokens. Total savings: 60-80% fewer Claude tokens on analysis-heavy tasks.
┌─────────────────────────────┐
│ You (the developer) │
└──────────┬──────────────────┘
│ prompt
▼
┌─────────────────────────────┐
│ Claude Code (conductor) │
│ - orchestrates workflow │
│ - makes decisions │
│ - writes & edits code │
└──────┬──────────────┬───────┘
precise │ │ delegate
edits │ │ bulk reading
(tokens) │ │ (FREE)
▼ ▼
┌──────────┐ ┌──────────────┐
│ your │ │ Kimi Code │
│ codebase │ │ - 256K ctx │
└──────────┘ │ - reads all │
│ - reports │
└──────────────┘
kimi_analyze via MCP → Kimi reads the entire codebase (256K context, near-zero cost)Result: Claude only spends tokens on decision-making and code writing, not on reading files.
kimi-for-coding is a 1T MoE model designed for deep code comprehension. This enables AI pair review:
Beyond ad-hoc analysis, you can use Kimi as a dedicated reviewer in your workflow:
┌──────────────┐ diff ┌──────────────┐ structured ┌──────────────┐
│ Your PR │ ────────► │ Kimi Code │ findings │ Claude Code │
│ (changes) │ │ (reviewer) │ ────────────►│ (decision) │
└──────────────┘ └──────────────┘ └──────────────┘
Each review session can be resumed (kimi_resume) — Kimi retains up to 256K tokens of context from previous sessions, building understanding over time.
kimi_analyze and kimi_resume support these parameters to control output size:
kimi_query also supports max_output_tokens and include_thinking.
[!NOTE] The savings come from compression ratio, not from free reading. Kimi's subscription cost still applies, but the key benefit is reducing expensive Claude Code token consumption.
Without kimi-code-mcp With kimi-code-mcp (normal)
───────────────────── ───────────────────────────
Raw source: 50 files × ~4K = 200K Kimi reads (subscription cost)
Claude reads: 200K tokens 5-15K token report
Claude token cost: $$$ $
Compression ratio by detail_level:
When savings happen:
When to skip and let Claude read directly:
detailed output approaches raw reading costUnder the hood:
kimi_analyze)kimi CLI with the prompt and codebase pathThe MCP server inspects kimi --help and calls the installed CLI in non-interactive mode.
For Kimi Code 2.x:
cd <path>
kimi -m kimi-code/k3 -p "<prompt>" --output-format stream-json
Legacy CLI options --print, --final-message-only, and --no-thinking are sent
only when advertised by that binary's help. Kimi Code 2.x does not support these
flags or --work-dir; thinking=false is therefore only applied on supporting
legacy CLIs. Do not combine --plan with -p.
If Kimi reports Stored token ... was rejected; re-login required, run kimi login.
Local model catalog checks do not verify OAuth validity or remaining quota.
After re-login, custom aliases such as subscription-peer/kimi may disappear.
Check kimi provider list and update any explicit model, KIMICODE_MODEL, or
KIMI_MODEL override to an available alias. The MCP already defaults to the
official kimi-code/k3 alias; it does not require the helper's custom alias.
Validated with Kimi Code 2.1.1: a minimal K3 prompt returned KIMI_OK
after re-login. Regression tests cover modern and legacy
CLI flags, resumed session IDs, authentication errors, and cache warmup.
[!NOTE] There is no
kimi analyzesubcommand. The MCP tool is namedkimi_analyze, but the underlying CLI uses the flags above. Use this syntax to call Kimi directly for debugging or scripting.
For development (auto-recompile on changes):
{
"mcpServers": {
"kimi-code": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/kimi-code-mcp/src/index.ts"]
}
}
}
Published as kimi-mcp-server on npm.
npx kimi-mcp-server # run directly
npm install -g kimi-mcp-server # install globally
src/
├── index.ts # MCP server setup, tool definitions, API-vs-CLI routing
├── kimi-api.ts # Direct Kimi Code API client (kimi_query / kimi_verify)
├── kimi-runner.ts # Spawns kimi CLI, parses output, handles timeouts
├── cache-manager.ts # Session cache (warmup, reuse, invalidation)
└── session-reader.ts # Reads Kimi session metadata from ~/.kimi/
See CONTRIBUTING.md for guidelines.
See CHANGELOG.md for version history.
MIT
MCP server for Claude Code × Kimi K2.5 (256K context) — delegate bulk codebase analysis to Kimi, save 90% on token costs. Session caching, parallel agents, TypeScript.
เครื่องมือ
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
FAQ
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
Kimi Code ทำงานแบบโลคัลผ่าน stdio
ตรวจสอบล่าสุดเมื่อ 2026-11-05 MCP server for Claude Code × Kimi K2.5 (256K context) — delegate bulk codebase analysis to Kimi, save 90% on token costs. Session caching, parallel agents, TypeScript.