-
-
Notifications
You must be signed in to change notification settings - Fork 11
MCP Integration
CKB exposes AI-native code navigation capabilities via the Model Context Protocol (MCP), enabling AI assistants like Claude Code to discover, understand, and navigate codebases.
v5.2 Theme: Discovery, orientation, and flow comprehension Non-goal: Code mutation, refactoring, enforcement, or policy
# Add CKB to your project (creates .mcp.json)
claude mcp add --transport stdio ckb --scope project -- /path/to/ckb mcp
# Or add globally for all projects
claude mcp add --transport stdio ckb --scope user -- /path/to/ckb mcp
# Verify configuration
claude mcp listAdd to .mcp.json in project root:
{
"mcpServers": {
"ckb": {
"type": "stdio",
"command": "/path/to/ckb",
"args": ["mcp"],
"env": {}
}
}
}Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"ckb": {
"command": "/path/to/ckb",
"args": ["mcp"],
"cwd": "/path/to/your/repo"
}
}
}Tools are classified by performance budget.
searchSymbols · explainFile · listEntrypoints · explainPath · getSymbol · explainSymbol
- Max 1 hop traversal
- Max 50 results
- No callgraph expansion or deep git history
traceUsage · getArchitecture · getHotspots · summarizeDiff · recentlyRelevant · listKeyConcepts · analyzeImpact · getCallGraph · findReferences · justifySymbol
- Up to depth 5 traversal
- Up to 1000 git commits
- Must include
limitationsfield
| Condition | Max confidence |
|---|---|
| Full static analysis (SCIP/LSP) | 1.0 |
| Partial static analysis | 0.89 |
| Heuristics only | 0.79 |
| Key backend missing | 0.69 |
| Multiple backends missing | 0.39 |
| Tool | Default |
|---|---|
getHotspots |
30 days |
summarizeDiff |
30 days |
recentlyRelevant |
7 days |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
searchSymbols |
Cheap | Search with filtering | v5.1 ✓ |
getSymbol |
Cheap | Get symbol details | v5.1 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
traceUsage |
Heavy | How is this reached? | v5.2 ✓ |
listEntrypoints |
Cheap | System entrypoints | v5.2 ✓ |
getCallGraph |
Heavy | Caller/callee graph | v5.1 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
explainFile |
Cheap | File orientation | v5.2 ✓ |
explainPath |
Cheap | Path role explanation | v5.2 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
summarizeDiff |
Heavy | What changed? | v5.2 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
getArchitecture |
Heavy | Architecture overview | v5.2 ✓ |
getHotspots |
Heavy | Volatile areas | v5.2 ✓ |
listKeyConcepts |
Heavy | Domain concepts | v5.2 ✓ |
recentlyRelevant |
Heavy | What matters now? | v5.2 ✓ |
getModuleOverview |
Heavy | Module statistics | v5.1 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
explainSymbol |
Cheap | AI-friendly explanation | v5.1 ✓ |
justifySymbol |
Heavy | Keep/remove verdict | v5.1 ✓ |
findReferences |
Heavy | Find all usages | v5.1 ✓ |
analyzeImpact |
Heavy | Change risk | v5.1 ✓ |
| Tool | Budget | Purpose | Status |
|---|---|---|---|
getStatus |
Cheap | System health | v5.1 ✓ |
doctor |
Cheap | Diagnostics | v5.1 ✓ |
Show how something is reached (causal paths, not neighbors).
Budget: Heavy
{ "symbolId": "...", "maxPaths": 10, "pathTypes": ["api", "cli"] }Path types: api | cli | job | event | test | unknown
Differs from getCallGraph: Returns ranked paths from entrypoints, not local neighborhood.
List system entrypoints.
Budget: Cheap
{ "types": ["api", "cli"], "limit": 30 }Entrypoint types: api | cli | job | event
Detection basis: naming | framework-config | static-call
File-level orientation.
Budget: Cheap
{ "filePath": "internal/query/engine.go" }Output: File role, top symbols (max 15), imports/exports, local hotspots.
Why does this path exist?
Budget: Cheap
{ "filePath": "internal/legacy/handler.go", "contextHint": "from traceUsage" }Role classifications: core | glue | legacy | test-only | config | unknown
What changed, what might break?
Budget: Heavy
{ "prId": "123" }
// or
{ "commitRange": { "base": "main", "head": "feature" } }
// or
{ "commit": "abc123" }
// or
{ "timeWindow": { "start": "2025-12-01", "end": "2025-12-17" } }Output: Files touched, risk signals, suggested tests.
Not allowed: Code suggestions, refactor plans.
Conservative architectural overview.
Budget: Heavy
{ "depth": 2, "includeExternalDeps": false }Hard caps: 15–20 modules, 50 edges max.
Highlight volatile areas.
Budget: Heavy
{ "timeWindow": { "days": 30 }, "scope": "internal/query", "limit": 20 }Ranking signals: churn, coupling, recency
Main domain concepts in the codebase.
Budget: Heavy
{ "limit": 12 }Output per concept:
-
label: "Auth", "Billing", etc. -
evidence: Top 3–5 modules/symbols -
basis:naming|cluster|entrypoints
What should I care about now?
Budget: Heavy
{ "timeWindow": { "days": 7 }, "moduleFilter": "internal/api" }Ranking signals: churn, fanIn, hasOpenChanges
{ "query": "Handler", "kinds": ["function"], "scope": "internal/api", "limit": 50 }{ "symbolId": "...", "repoStateMode": "head" }{ "symbolId": "...", "scope": "internal/mcp", "includeTests": true, "limit": 100 }{ "symbolId": "..." }Output: Name, kind, signature, usage stats, git history, related symbols.
{ "symbolId": "..." }Verdicts: keep | investigate | remove
{ "symbolId": "...", "direction": "both", "depth": 2 }{ "path": "internal/query" }{ "symbolId": "...", "depth": 3 }{}{}| Preset | Focus |
|---|---|
onboarding |
Broad, concept-first |
bug-investigation |
Trace-focused, recent changes |
refactor-safety |
Coupling and hotspots |
review |
Diff-centric, risk signals |
getStatus() → listKeyConcepts() → getArchitecture() → listEntrypoints() → searchSymbols()
searchSymbols() → traceUsage() → getCallGraph() → recentlyRelevant()
searchSymbols() → explainSymbol() → findReferences() → analyzeImpact() → getHotspots()
summarizeDiff() → getHotspots() → traceUsage()
searchSymbols() → justifySymbol() → explainFile()
| Code | Fix |
|---|---|
SYMBOL_NOT_FOUND |
Use searchSymbols() first |
BACKEND_UNAVAILABLE |
Check getStatus() |
INDEX_STALE |
Run scip-go |
QUERY_TIMEOUT |
Add scope/limit |
BUDGET_EXCEEDED |
Use cheaper tool |
- ❌ Code mutation/refactoring
- ❌ Test generation
- ❌ Fix suggestions
- ❌ Policy enforcement
- ❌ Lint judgments
Navigation and comprehension only.
searchSymbols, getSymbol, findReferences, explainSymbol, justifySymbol, getCallGraph, getModuleOverview, analyzeImpact, getStatus, doctor
All v5.2 tools are now implemented:
Phase 1: explainFile, traceUsage, listEntrypoints
Phase 2: summarizeDiff
Phase 3: getHotspots, getArchitecture
Phase 4: explainPath, listKeyConcepts, recentlyRelevant
Total: 19 MCP tools available
which ckb
echo '{"jsonrpc":"2.0","id":1,"method":"initialize"}' | ckb mcpls -la .ckb/
ckb initscip-go --repository-root=.
ckb doctor