| name | codedb-mcp-fast-code-intelligence |
| description | Fast local-first code intelligence MCP server with tree-sitter indexing, semantic search, dependency analysis, and millisecond-latency tools for repository understanding |
| triggers | ["search my codebase quickly","find symbol definitions and callers","analyze code dependencies and modules","get fast code context without dumping files","index my repository for intelligent search","explore code architecture with semantic search","find related code files and references","build a code module atlas"] |
codedb-mcp Fast Code Intelligence
Skill by ara.so — MCP Skills collection.
Overview
codedb-mcp (also called codebase-mcp) is a Rust-based MCP server that turns any local repository into a persistent code intelligence service. It maintains a tree-sitter indexed database under .codedb-mcp/ with symbols, references, dependencies, graph metadata, lexical indexes, and vector embeddings for fast semantic search.
Key capabilities:
- Millisecond-latency warm queries — 20,000x faster than
rg on indexed searches
- Answer-oriented context tools —
codedb_context and codedb_explore return ranked relevant code without dumping entire files
- Dependency-aware module discovery — Automatic grouping of related files based on dependency graphs
- LSP-like features — Symbol definitions, callers, outlines, and reference navigation
- Code Module Atlas — Visual 3D browser showing file relationships and module boundaries
- DeepWiki — Auto-generated repository documentation with cited sources
- Local-first — All data stored in project
.codedb-mcp/ directory, no cloud dependencies
Performance benchmarks (u3dclient Unity C# project):
- Index 18,852 files in 13.8s cold, 0.741s warm cache-hit
- Symbol lookup: 0.088-0.351ms
- Text search: 0.103-0.442ms warm (vs 77-5,007ms for
rg)
- Callers lookup: 8-17ms avg
- Token savings: 43% reduction vs shell-based code lookup (254k tokens saved across 3 feature analysis sessions)
Installation
Prerequisites
- Rust toolchain (for building from source)
- Node.js (for skills and atlas viewer)
- Git repository to index
Build from Source
git clone https://github.com/killop/codedb-mcp.git
cd codedb-mcp
cargo build --release
The binary will be at target/release/codedb-mcp (or codedb-mcp.exe on Windows).
Project Setup
- Create configuration file in your target repository:
cd /path/to/your/project
mkdir -p .codedb-mcp
- Create
.codedb-mcp/codedb-mcp.toml:
[project]
name = "myproject"
root = "."
[scan]
include = ["src/**/*.rs", "lib/**/*.rs"]
exclude = ["target/**", "node_modules/**", ".git/**"]
[languages]
rust = { enabled = true }
typescript = { enabled = true }
python = { enabled = true }
[vector]
model = "minishlab/potion-code-16M"
Unity C# example config:
[project]
name = "u3dclient"
root = "."
[scan]
include = ["Assets/**/*.cs", "Packages/**/*.cs"]
exclude = [
"Library/**",
"Temp/**",
"obj/**",
"Build/**",
"Logs/**"
]
[languages]
csharp = { enabled = true }
- Build initial index:
/path/to/codedb-mcp --project-root . index
MCP Server Configuration
Add to your MCP settings file (e.g., Claude Desktop config):
{
"mcpServers": {
"codedb-myproject": {
"command": "/path/to/codedb-mcp",
"args": ["--project-root", "/path/to/your/project", "serve"],
"env": {
"RUST_LOG": "info"
}
}
}
}
Windows PowerShell example:
{
"mcpServers": {
"codedb-u3dclient": {
"command": "D:\\tools\\codedb-mcp\\target\\release\\codedb-mcp.exe",
"args": ["--project-root", "D:\\projects\\u3dclient", "serve"]
}
}
}
Core MCP Tools
Index Management
codedb_index
Build or rebuild the code database.
await use_mcp_tool("codedb-myproject", "codedb_index", {
force_rebuild: true
});
await use_mcp_tool("codedb-myproject", "codedb_index", {});
When to use:
- After cloning a repository
- When adding new files
- After significant code changes
- When index appears stale
codedb_status
Check index health and statistics.
const status = await use_mcp_tool("codedb-myproject", "codedb_status", {});
codedb_version
Get server version info.
const version = await use_mcp_tool("codedb-myproject", "codedb_version", {});
Symbol Navigation
codedb_symbol
Find symbol definitions across the codebase.
const defs = await use_mcp_tool("codedb-myproject", "codedb_symbol", {
symbol: "PoolManager"
});
const defs = await use_mcp_tool("codedb-myproject", "codedb_symbol", {
symbol: "UserService|AuthController"
});
Use cases:
- Jump to definition
- Find class/interface declarations
- Locate function implementations
codedb_outline
Get symbol outline for a single file.
const outline = await use_mcp_tool("codedb-myproject", "codedb_outline", {
path: "src/services/user_service.rs"
});
Performance: 0.088-0.351ms per file (after first load)
codedb_callers
Find all call sites for a symbol definition.
const callers = await use_mcp_tool("codedb-myproject", "codedb_callers", {
path: "src/pool.rs",
line: 42,
symbol: "PoolManager"
});
Performance: 8-17ms avg
Use cases:
- Find all usages before refactoring
- Understand impact of API changes
- Trace call chains
Search Tools
codedb_text_search
Fast full-text and regex search using trigram indexing.
const results = await use_mcp_tool("codedb-myproject", "codedb_text_search", {
query: "NetworkListenerManager",
case_sensitive: false
});
const results = await use_mcp_tool("codedb-myproject", "codedb_text_search", {
query: "class\\s+(\\w+)Manager",
is_regex: true
});
const results = await use_mcp_tool("codedb-myproject", "codedb_text_search", {
query: "PoolManager",
scope: ["src/**/*.rs"]
});
Performance: 0.103-0.442ms warm (vs 77-5,007ms for rg on same queries)
Parameters:
query: search string or regex pattern
is_regex: treat query as regex (default: false)
case_sensitive: case-sensitive matching (default: false)
scope: file path patterns to limit search
limit: max results (default: 100)
codedb_search
Unified semantic + symbol + text search.
const results = await use_mcp_tool("codedb-myproject", "codedb_search", {
query: "PoolManager",
mode: "symbol"
});
const results = await use_mcp_tool("codedb-myproject", "codedb_search", {
query: "alliance rally join logic",
mode: "semantic",
limit: 20
});
const results = await use_mcp_tool("codedb-myproject", "codedb_search", {
query: "user authentication",
mode: "fusion"
});
Modes:
symbol: exact symbol matching
text: trigram full-text search
semantic: vector similarity search
fusion: weighted combination of all methods
Performance:
- Symbol-aware: 22ms
- Semantic: 36ms (after vector model load)
codedb_word
Exact identifier inverted index lookup.
const results = await use_mcp_tool("codedb-myproject", "codedb_word", {
word: "initialize",
limit: 50
});
Performance: ~100ms including lazy word sidecar access
Answer-Oriented Context Tools
codedb_context
Get ranked relevant code context WITHOUT dumping full files. Returns summaries, symbols, and snippets optimized for answering questions.
const context = await use_mcp_tool("codedb-myproject", "codedb_context", {
query: "how does the pool management system work?",
max_tokens: 2000
});
const context = await use_mcp_tool("codedb-myproject", "codedb_context", {
query: "alliance rally and join logic",
focus_paths: ["src/alliance/**"],
max_tokens: 3000
});
Performance: 6.5-30ms depending on query complexity
Output: ~1.5-2.0k tokens of ranked context (vs potentially 100k+ from naive file dumps)
When to use:
- Answering "how does X work?" questions
- Feature area exploration
- Architecture understanding
- Before making changes to unfamiliar code
Parameters:
query: natural language question or keyword
max_tokens: output budget (default: 2000)
focus_paths: limit to specific directories
include_deps: include dependency information
codedb_explore
Budgeted source-context excerpts with token limit.
const excerpts = await use_mcp_tool("codedb-myproject", "codedb_explore", {
query: "PoolManager initialization",
max_chars: 10000
});
Performance: 7-29ms
Difference from codedb_context:
codedb_context: returns summaries + symbols + minimal snippets
codedb_explore: returns larger source excerpts with explicit char budget
Dependency Analysis
codedb_deps
Analyze file dependencies (imports, includes, references).
const deps = await use_mcp_tool("codedb-myproject", "codedb_deps", {
path: "src/services/user.rs",
direction: "depends_on"
});
const rdeps = await use_mcp_tool("codedb-myproject", "codedb_deps", {
path: "src/models/user.rs",
direction: "imported_by"
});
const transitive = await use_mcp_tool("codedb-myproject", "codedb_deps", {
path: "src/core/engine.rs",
direction: "depends_on",
transitive: true,
max_depth: 3
});
Performance:
- Direct: 0.096ms
- Reverse (first sidecar): 170ms, then sub-ms
- Transitive: depends on depth
Directions:
depends_on: outgoing dependencies
imported_by: incoming dependents
File Operations
codedb_read
Read indexed file or line range.
const content = await use_mcp_tool("codedb-myproject", "codedb_read", {
path: "src/main.rs"
});
const snippet = await use_mcp_tool("codedb-myproject", "codedb_read", {
path: "src/services/auth.rs",
start_line: 42,
end_line: 67
});
Performance: 0.562ms avg
When to use:
- After using
codedb_context to identify relevant files
- Reading specific functions identified by
codedb_symbol
- NOT as first step for exploration (use
codedb_context instead)
codedb_tree
Get indexed file tree with metadata.
const tree = await use_mcp_tool("codedb-myproject", "codedb_tree", {
path_pattern: "src/**/*.rs"
});
Performance: 8.782ms
codedb_hot
Get recently modified indexed files.
const recent = await use_mcp_tool("codedb-myproject", "codedb_hot", {
limit: 20
});
Performance: 2.116ms
Advanced Features
codedb_bundle
Execute multiple queries in a single MCP call (reduces round-trips).
const bundle = await use_mcp_tool("codedb-myproject", "codedb_bundle", {
calls: [
{tool: "codedb_symbol", args: {symbol: "UserService"}},
{tool: "codedb_deps", args: {path: "src/user.rs", direction: "depends_on"}},
{tool: "codedb_outline", args: {path: "src/user.rs"}}
]
});
When to use:
- Gathering related information in one shot
- Reducing MCP overhead
- Building complex queries
Module Discovery & Atlas
Generate dependency-aware module groupings:
const modules = await use_mcp_tool("codedb-myproject", "codedb_modules", {
min_size: 3,
max_size: 50
});
Build visual atlas (requires Node.js):
cd codedb-mcp/skills/code-module-atlas
node scripts/build-module-atlas.mjs myproject
cd assets/viewer
npm install
npm run dev -- --port 5174
Opens interactive 3D viewer showing:
- Star nodes for each source file
- Module boundaries and labels
- Dependency edges
- File details on selection
Configuration Patterns
Language-Specific Indexing
[languages]
rust = { enabled = true }
typescript = { enabled = true, extensions = [".ts", ".tsx"] }
python = { enabled = true, extensions = [".py"] }
csharp = { enabled = true, extensions = [".cs"] }
cpp = { enabled = true, extensions = [".cpp", ".hpp", ".cc", ".h"] }
Performance Tuning
[performance]
threads = 8
max_memory_mb = 2048
cache_version = 23
Vector Search Configuration
[vector]
model = "minishlab/potion-code-16M"
cache_dir = "/path/to/model/cache"
lazy_load = true
Vector embeddings are built lazily on first semantic search, not during initial indexing.
Monorepo Configuration
For large monorepos, create separate configs per sub-project:
project-root/
.codedb-mcp/codedb-mcp.toml
backend/.codedb-mcp/codedb-mcp.toml
frontend/.codedb-mcp/codedb-mcp.toml
Each can run as separate MCP server instances.
Common Workflows
Workflow 1: Understanding a New Feature Area
const context = await use_mcp_tool("codedb-project", "codedb_context", {
query: "how does user authentication work?",
max_tokens: 2500
});
const entry = await use_mcp_tool("codedb-project", "codedb_symbol", {
symbol: "AuthController|authenticate"
});
const deps = await use_mcp_tool("codedb-project", "codedb_deps", {
path: entry[0].path,
direction: "depends_on"
});
const code = await use_mcp_tool("codedb-project", "codedb_read", {
path: entry[0].path
});
Workflow 2: Impact Analysis for Refactoring
const defs = await use_mcp_tool("codedb-project", "codedb_symbol", {
symbol: "legacy_payment_process"
});
const callers = await use_mcp_tool("codedb-project", "codedb_callers", {
path: defs[0].path,
line: defs[0].line,
symbol: "legacy_payment_process"
});
const dependents = await use_mcp_tool("codedb-project", "codedb_deps", {
path: defs[0].path,
direction: "imported_by"
});
const outlines = await use_mcp_tool("codedb-project", "codedb_bundle", {
calls: callers.map(c => ({
tool: "codedb_outline",
args: {path: c.caller_path}
}))
});
Workflow 3: Exploring Code Architecture
const modules = await use_mcp_tool("codedb-project", "codedb_search", {
query: "payment processing workflow",
mode: "semantic",
limit: 30
});
const context = await use_mcp_tool("codedb-project", "codedb_context", {
query: "payment processing workflow",
focus_paths: ["src/payments/**"],
max_tokens: 4000
});
const deps_analysis = await use_mcp_tool("codedb-project", "codedb_modules", {
min_size: 5
});
Workflow 4: Incremental Index Updates
git pull
/path/to/codedb-mcp --project-root . index
/path/to/codedb-mcp --project-root . index --force-rebuild
Incremental performance (1,000 files changed):
- Add: 1.508s
- Modify: 1.544s
- Delete: 0.504s
Token Optimization
Codex Token Observer
Monitor and optimize MCP tool token usage:
cd codedb-mcp/skills/codedb-mcp
node scripts/codex-observe.mjs --project myproject --since 24h --top 12
Reports:
- Model token counts per session
- Tool output token estimates
- High-output call patterns
- Missed
codedb_bundle opportunities
- Non-codedb source lookups that could use codedb tools
Example findings (Unity C# project):
- 43% token reduction vs shell-based lookup
- 38% faster execution
- 254k tokens saved across 3 feature analysis sessions
Best Practices for Token Efficiency
DO:
- Start with
codedb_context for exploration (1.5-2k tokens)
- Use
codedb_explore with explicit max_chars budgets
- Bundle related queries with
codedb_bundle
- Use
codedb_symbol + codedb_callers instead of grepping
- Scope searches with
focus_paths or file patterns
DON'T:
- Call
codedb_read on many files without first using codedb_context
- Use unbounded
codedb_text_search on large codebases
- Repeatedly call
codedb_outline in loops (use codedb_bundle instead)
- Dump full file contents when you only need specific symbols
Token Benchmark Comparison
| Approach | World Map Logic | Hero Attributes | Alliance Rally | Total |
|---|
| codedb-mcp enabled | 92,639 tokens | 114,436 tokens | 128,865 tokens | 335,940 tokens |
| Shell-based lookup | 231,810 tokens | 173,576 tokens | 185,448 tokens | 590,834 tokens |
| Savings | 60.0% | 34.1% | 30.5% | 43.1% |
Troubleshooting
Index Not Building
Symptoms: codedb_index fails or hangs
Solutions:
- Check file permissions on
.codedb-mcp/ directory
- Verify include/exclude patterns in config:
/path/to/codedb-mcp --project-root . status
- Check for corrupted cache:
rm -rf .codedb-mcp/*.bin
/path/to/codedb-mcp --project-root . index --force-rebuild
- Enable debug logging:
RUST_LOG=debug /path/to/codedb-mcp --project-root . index
Slow Search Performance
Symptoms: codedb_text_search or codedb_search taking seconds
Causes:
- First query triggers lazy sidecar load (expected: 15-30ms)
- Regex search on very large files
- Vector model not cached
Solutions:
-
Warm up lazy sidecars:
await use_mcp_tool("codedb-project", "codedb_word", {word: "test"});
await use_mcp_tool("codedb-project", "codedb_search", {
query: "warmup",
mode: "semantic"
});
-
Scope searches to reduce candidate files:
await use_mcp_tool("codedb-project", "codedb_text_search", {
query: "pattern",
scope: ["src/core/**"]
});
-
Use max_tokens or limit parameters to cap output
Vector Search Not Working
Symptoms: Semantic search returns no results or errors
Solutions:
-
Ensure Model2Vec model is downloaded:
ls ~/.cache/huggingface/hub/models--minishlab--potion-code-16M/
-
Configure explicit cache location if needed:
[vector]
model = "minishlab/potion-code-16M"
cache_dir = "/alternative/cache/path"
-
Trigger embedding build manually:
const results = await use_mcp_tool("codedb-project", "codedb_search", {
query: "any query",
mode: "semantic"
});
Stale Results
Symptoms: Search/symbol results don't reflect recent changes
Solutions:
-
Check index freshness:
const status = await use_mcp_tool("codedb-project", "codedb_status", {});
-
Run incremental update:
/path/to/codedb-mcp --project-root . index
-
If incremental fails, force rebuild:
/path/to/codedb-mcp --project-root . index --force-rebuild
High Memory Usage
Symptoms: codedb-mcp process using excessive RAM
Solutions:
-
Adjust thread count in config:
[performance]
threads = 4
-
Limit scope of indexed files:
[scan]
exclude = ["vendor/**", "third_party/**", "*.generated.*"]
-
Disable vector search if not needed:
[vector]
enabled = false
MCP Server Won't Start
Symptoms: Agent can't connect to codedb MCP server
Solutions:
-
Test server manually:
/path/to/codedb-mcp --project-root /path/to/project serve
-
Check MCP config syntax:
{
"mcpServers": {
"codedb-project": {
"command": "/absolute/path/to/codedb-mcp",
"args": ["--project-root", "/absolute/path/to/project", "serve"]
}
}
}
-
Verify project has index:
ls /path/to/project/.codedb-mcp/
-
Check server logs in agent output
DeepWiki Documentation Generation
Generate repository documentation automatically:
cd codedb-mcp/skills/deepwiki
node scripts/generate-deepwiki.mjs myproject
DeepWiki uses:
- MCP evidence from
codedb_modules, codedb_deps, codedb_context
- Agent reasoning to write business-focused explanations
- Cited source files with line numbers
- Dependency-aware structure
Configure generation:
const wiki = await generate_deepwiki({
project: "myproject",
focus_areas: ["payment processing", "user management"],
max_modules: 20,
include_risks: true
});
Integration Examples
With Claude Code
{
"mcpServers": {
"codedb-backend": {
"command": "/usr/local/bin/codedb-mcp",
"args": ["--project-root", "/home/user/projects/backend", "serve"]
}
}
}
Then in Claude:
- "Search for authentication logic in the backend"
- "Show me what depends on UserService"
- "Find all callers of validate_token"
With Cursor
Add to Cursor MCP settings, then use in composer:
@codedb-project how does the payment processing workflow handle refunds?
The skill will use codedb_context to gather relevant code without dumping files.
With Codex
codex config add-mcp codedb-project /path/to/codedb-mcp --project-root /path/to/project
codex chat "analyze the alliance rally join flow in u3dclient"
Codex will automatically use codedb_context, codedb_search, codedb_deps tools to answer efficiently.
Performance Optimization
Index Optimization
[performance]
threads = 16
max_memory_mb = 4096
[scan]
exclude = [
"node_modules/**",
"vendor/**",
"*.generated.*",
"*.pb.*",
"dist/**",
"build/**"
]
max_file_size_kb = 1024
Query Optimization
const results = await use_mcp_tool("codedb-project", "codedb_context", {
query: "payment logic",
focus_paths: ["src/payments/**", "src/billing/**"],
max_tokens: 2000
});
const data = await use_mcp_tool("codedb-project", "codedb_bundle", {
calls: [
{tool: "codedb_symbol", args: {symbol: "PaymentProcessor"}},
{tool: "codedb_context", args: {query: "payment flow", max_tokens: 1500}},
{tool: "codedb_deps", args: {path: "src/payments/processor.rs"}}
]
});
Cache Management
du -sh /path/to/project/.codedb-mcp/
/path/to/codedb-mcp --project-root . cleanup
rm -rf /path/to/project/.codedb-mcp/*.bin
/path/to/codedb-mcp --project-root . index --force-rebuild
Advanced Rust API (for tool development)
If building custom tools that integrate with codedb:
use codedb_mcp::{CodeDb, IndexConfig, SearchMode};