Kimi Code MCP
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.
Ask AI about Kimi Code MCP
Powered by Claude Β· Grounded in docs
I know everything about Kimi Code MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
kimi-code-mcp
English | δΈζθͺͺζ
MCP server that connects Kimi Code (K2.5, 256K context) with Claude Code β letting Claude orchestrate while Kimi handles the heavy reading.
Kimi K2.5 sits on the efficiency frontier β near-Claude intelligence at 10x lower cost. kimi.com/code
[!TIP] Stop paying Claude to read files. Kimi K2.5 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.
What is Kimi Code?
Kimi Code is an AI code agent by Moonshot AI, powered by the Kimi K2.5 model (1T MoE, 256K context). It works across Terminal, IDE, and CLI β writing, debugging, refactoring, and analyzing code autonomously.
Key specs:
- 256K token context β reads entire codebases in one pass
- Parallel agent spawning β handles concurrent tasks
- Shell, file, and web access β full developer toolchain
- Install:
curl -L code.kimi.com/install.sh | bash
[!WARNING] Kimi Code membership required. This MCP server calls the Kimi CLI under the hood, which requires an active Kimi Code plan. Make sure you have a valid subscription and have run
kimi loginbefore use.
Plan Price Notes Moderato $0 (7-day free trial) Then $19/mo. Good for trying it out Allegretto $39/mo Recommended β higher weekly quota + concurrency Allegro $99/mo For daily, heavy-duty development Vivace $199/mo Max quota for large codebases Annual billing saves up to $480. All plans include Kimi membership benefits.
Quick Start
# 1. Install Kimi CLI
uv tool install kimi-cli && 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"]
}
}
}
Or build from source:
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"]
}
}
}
Run /mcp in Claude Code to verify β you should see kimi-code with 4 tools.
What You Can Do
Just tell Claude what you need. It will delegate to Kimi automatically:
| Prompt | What happens |
|---|---|
| "Analyze this codebase's architecture" | Kimi reads all files (256K ctx), Claude acts on the report |
| "Scan for security vulnerabilities, then review Kimi's findings" | Kimi audits, Claude cross-examines β AI pair review |
| "Map all dependencies of the auth module, then plan the refactoring" | Kimi builds the dependency graph, Claude plans the changes |
| "Review the recent changes for regressions and edge cases" | Kimi reviews full context (not just the diff), Claude synthesizes |
| "Resume the last Kimi session and ask about the API design" | Kimi retains 256K tokens of context across sessions |
Why This Exists
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.
How It Saves Tokens
βββββββββββββββββββββββββββββββ
β 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 β β (K2.5) β
ββββββββββββ β - 256K ctx β
β - reads all β
β - reports β
ββββββββββββββββ
- Claude receives your task β decides it needs codebase understanding
- Claude calls
kimi_analyzevia MCP β Kimi reads the entire codebase (256K context, near-zero cost) - Kimi returns a structured analysis
- Claude acts on the analysis with precise, targeted edits
Result: Claude only spends tokens on decision-making and code writing, not on reading files.
Mutual Code Review with K2.5
Kimi Code is powered by K2.5 β a 1T MoE model designed for deep code comprehension. This enables AI pair review:
- Kimi pre-reviews β 256K context means it sees the entire codebase at once: security issues, anti-patterns, dead code, architectural problems
- Claude cross-examines β reviews Kimi's findings, challenges questionable items, adds its own insights
- Two perspectives β different models catch different things. What one misses, the other finds
Use Kimi as a Code Reviewer
Beyond ad-hoc analysis, you can use Kimi as a dedicated reviewer in your workflow:
PR Review Workflow
ββββββββββββββββ diff ββββββββββββββββ structured ββββββββββββββββ
β Your PR β βββββββββΊ β Kimi Code β findings β Claude Code β
β (changes) β β (reviewer) β βββββββββββββΊβ (decision) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
Continuous Audit Pattern
| When | What | Why |
|---|---|---|
| Before merging | Kimi scans diff + affected modules | Catch regressions early |
| Weekly | Full codebase sweep | Accumulated tech debt |
| Pre-release | Security-focused audit | Ship with confidence |
Each review session can be resumed (kimi_resume) β Kimi retains up to 256K tokens of context from previous sessions, building understanding over time.
What Kimi Reviews Well
| Review Type | Why Kimi Excels |
|---|---|
| Security audit | 256K context sees full attack surface, not just isolated files |
| Dead code detection | Can trace imports/exports across entire codebase |
| API consistency | Compares patterns across all endpoints simultaneously |
| Dependency analysis | Maps full dependency graph in one pass |
| Architecture review | Sees the forest and the trees at the same time |
Tools
| Tool | Description | Timeout |
|---|---|---|
kimi_analyze | Deep codebase analysis (architecture, audit, refactoring) | 10 min |
kimi_query | Quick programming questions, no codebase context | 2 min |
kimi_list_sessions | List existing Kimi sessions with metadata | instant |
kimi_resume | Resume a previous session (up to 256K token context) | 10 min |
Output Control Parameters
kimi_analyze and kimi_resume support these parameters to control output size:
| Parameter | Values | Default | Effect |
|---|---|---|---|
detail_level | summary / normal / detailed | normal | Controls prompt-side verbosity instructions |
max_output_tokens | number | 15000 | Hard ceiling β output truncated at clean boundary if exceeded |
include_thinking | boolean | false | Include Kimi's internal reasoning chain (10-30K extra tokens) |
kimi_query also supports max_output_tokens and include_thinking.
Token Economics
[!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:
| Level | Compression | Output Size | Equivalent Source | Best For |
|---|---|---|---|---|
summary | 40-100x | ~2-5K tokens | ~8-20K chars / ~200-500 lines of code | Quick orientation, file inventory |
normal | 15-40x | ~5-15K tokens | ~20-60K chars / ~500-1500 lines of code | Architecture review, dependency mapping |
detailed | 5-15x | ~15-40K tokens | ~60-160K chars / ~1500-4000 lines of code | Security audit with code snippets |
When savings happen:
- Large codebases (50+ files) β architecture understanding, cross-file scanning
- Security audits, dead code detection, API consistency checks
- Pre-review before targeted edits (scan first β edit specific files)
When to skip and let Claude read directly:
- Small codebases (<10 files) β direct reading is faster
- Single-file modifications β Claude's built-in file reading is sufficient
- When you need every line of code β
detailedoutput approaches raw reading cost
How It Works
ββββββββββββββββ stdio/MCP ββββββββββββββββ subprocess ββββββββββββββββ
β Claude Code β ββββββββββββΊ β kimi-code-mcpβ βββββββββββββΊ β Kimi CLI β
β (conductor) β β (MCP server) β β (K2.5, 256K) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
- Claude Code calls an MCP tool (e.g.,
kimi_analyze) - This server spawns the
kimiCLI with the prompt and codebase path - Kimi autonomously reads files, analyzes the code (up to 256K tokens)
- The result is parsed from Kimi's JSON output and returned to Claude Code
- Claude acts on the structured results β edits, plans, or further analysis
Advanced Setup
For development (auto-recompile on changes):
{
"mcpServers": {
"kimi-code": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/kimi-code-mcp/src/index.ts"]
}
}
}
npm
Published as kimi-mcp-server on npm.
npx kimi-mcp-server # run directly
npm install -g kimi-mcp-server # install globally
Project Structure
src/
βββ index.ts # MCP server setup, tool definitions
βββ kimi-runner.ts # Spawns kimi CLI, parses output, handles timeouts
βββ session-reader.ts # Reads Kimi session metadata from ~/.kimi/
Contributing
See CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for version history.
License
MIT
