Codebase Brain
Cited, searchable memory of a codebase, with git history and doc-drift checks
Codebase Brain is a free MCP server for developer tools. It runs locally on your machine and is started by your AI client.
- Pricing
- Free
- Platforms
- CLI, Self-hosted, macOS
- Runs
- Locally
- Version
- 0.2.1
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add codebase-brain-mcp --env GITHUB_TOKEN='<GITHUB_TOKEN>' -- uvx codebase-brain-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"codebase-brain-mcp": {
"command": "uvx",
"args": [
"codebase-brain-mcp"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"codebase-brain-mcp": {
"command": "uvx",
"args": [
"codebase-brain-mcp"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"codebase-brain-mcp": {
"command": "uvx",
"args": [
"codebase-brain-mcp"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"codebase-brain-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"codebase-brain-mcp"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add codebase-brain-mcp --env GITHUB_TOKEN='<GITHUB_TOKEN>' -- uvx codebase-brain-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.codebase-brain-mcp]
command = "uvx"
args = ["codebase-brain-mcp"]
env = { GITHUB_TOKEN = "<GITHUB_TOKEN>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"codebase-brain-mcp": {
"command": "uvx",
"args": [
"codebase-brain-mcp"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Or run: gemini mcp add -s user -e GITHUB_TOKEN='<GITHUB_TOKEN>' codebase-brain-mcp uvx -- codebase-brain-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "codebase-brain-mcp": { "command": "uvx", "args": [ "codebase-brain-mcp" ], "env": { "GITHUB_TOKEN": "<GITHUB_TOKEN>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
GITHUB_TOKENOptional. Raises GitHub's rate limit when reading pull request titles and descriptions.CODEBASE_BRAIN_HOMEWhere indexes and clones are stored (default ~/.codebase-brain).
About Codebase Brain
Codebase Brain indexes a local folder or a public git URL and lets an assistant answer questions with exact path and line citations. Python is split by function and class, JavaScript and TypeScript by function, class, interface and type, and Markdown by heading, so each chunk carries its symbol name and line range.
Search blends SQLite FTS5 keyword ranking, with identifier splitting for camelCase and snake_case, and local embeddings via fastembed, merged by rank fusion. Everything runs on your machine with no API keys and re-indexing only embeds changed files.
What sets it apart is history and impact: one tool follows a function back through git and links the pull requests behind each change, another lists direct and indirect callers and the tests that cover them, and a third compares Markdown and reStructuredText docs against the code for names that no longer exist. An optional GITHUB_TOKEN raises the GitHub rate limit for pull request lookups.
Tools this server provides (9)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 6 of 9 tools read data; 3 names don't say.
From the server's own tool labels and tool names; not verified by us.
- index_repo
- Index a local path or https git URL.
- ask_codebase
- Return relevant code, docs and commits as cited sources.
- searchName suggests: reads
- Hybrid search filterable by path and chunk kind.
- explain_historyName suggests: reads
- List commits that changed a function or line range, with diffs and PRs.
- search_historyName suggests: reads
- Find commits by their messages.
- impact_of_change
- List direct and indirect users of a symbol and related tests.
- find_doc_driftName suggests: reads
- Find docs that no longer match the code, by severity.
- read_linesName suggests: reads
- Open exact lines behind a citation.
- list_reposName suggests: reads
- Show indexed repositories and commits.
What it does
- Cited answers
- Results point to exact file and line ranges the assistant can open.
- Hybrid local search
- Keyword and embedding search combined, with no API keys.
- History explanation
- Shows commits, authors and pull requests behind a function's lines.
- Impact analysis
- Lists callers, transitive users and tests before a change.
- Doc drift detection
- Flags docs that mention missing files, functions, settings or failing examples.
- Incremental indexing
- Re-embeds only files whose content changed.
Good for
- Ask why a function looks the way it does
- See what breaks if a function changes
- Find outdated sections in project docs
- Search a new repo by plain-language description
- Open the lines behind a citation
Pricing
Free
Free; runs locally with no API keys.
Codebase Brain FAQ
Does my code leave my machine?
The README says it runs locally with no API keys and your code never leaves your computer.
How do I install Codebase Brain?
Install uv and run uvx codebase-brain-mcp, or use the claude mcp add command in the README.
Which languages get code-aware chunking?
Python, JavaScript, TypeScript, JSX and TSX; other languages use overlapping line windows.
What is GITHUB_TOKEN for?
Optional; it raises the rate limit when reading pull request titles and descriptions.
Is Codebase Brain free?
Yes. Codebase Brain is free to use.
How do I add Codebase Brain to Claude Code?
Run this command in your terminal: claude mcp add codebase-brain-mcp --env GITHUB_TOKEN='<GITHUB_TOKEN>' -- uvx codebase-brain-mcp
What are the best alternatives to Codebase Brain?
The closest alternatives to Codebase Brain are Codebase Memory, knock, rag-rat, Open Context Engine and Octobrain.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.
