# Codebase Brain

> Codebase Brain is a free MCP server for developer tools. Cited, searchable memory of a codebase, with git history and doc-drift checks. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, Self-hosted, macOS, Linux, Windows
- **Repository:** https://github.com/nomannazir/codebase-brain-mcp
- **MCP Registry name:** io.github.Nomannazir/codebase-brain-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools), [knowledge and memory](https://ai-powered.com/categories/knowledge-and-memory)
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add codebase-brain-mcp --env GITHUB_TOKEN='<GITHUB_TOKEN>' -- uvx codebase-brain-mcp
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "codebase-brain-mcp": {
      "command": "uvx",
      "args": [
        "codebase-brain-mcp"
      ],
      "env": {
        "GITHUB_TOKEN": "<GITHUB_TOKEN>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```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.

### Cursor (~/.cursor/mcp.json)

```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.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add codebase-brain-mcp --env GITHUB_TOKEN='<GITHUB_TOKEN>' -- uvx codebase-brain-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.codebase-brain-mcp]
command = "uvx"
args = ["codebase-brain-mcp"]
env = { GITHUB_TOKEN = "<GITHUB_TOKEN>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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 (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```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 (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "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.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```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 (~/.kiro/settings/mcp.json)

```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.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "codebase-brain-mcp": {
      "command": "uvx",
      "args": [
        "codebase-brain-mcp"
      ],
      "env": {
        "GITHUB_TOKEN": "<GITHUB_TOKEN>"
      }
    }
  }
}
```

## Tools

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.
- `search` (name suggests: reads): Hybrid search filterable by path and chunk kind.
- `explain_history` (name suggests: reads): List commits that changed a function or line range, with diffs and PRs.
- `search_history` (name suggests: reads): Find commits by their messages.
- `impact_of_change`: List direct and indirect users of a symbol and related tests.
- `find_doc_drift` (name suggests: reads): Find docs that no longer match the code, by severity.
- `read_lines` (name suggests: reads): Open exact lines behind a citation.
- `list_repos` (name suggests: reads): Show indexed repositories and commits.

## 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.

## Alternatives

- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [knock](https://ai-powered.com/mcp/knock): knock is an open-source MCP server for developer tools.
- [rag-rat](https://ai-powered.com/mcp/rag-rat): rag-rat is an open-source MCP server for knowledge and memory.
- [Open Context Engine](https://ai-powered.com/mcp/open-context-engine): Open Context Engine is an open-source MCP server for developer tools.
- [Octobrain](https://ai-powered.com/mcp/octobrain): Octobrain is an open-source MCP server for knowledge and memory.
- [CodeCortex Context Engine](https://ai-powered.com/mcp/codecortex-context-engine): CodeCortex Context Engine is an open-source MCP server for developer tools.
- [Code-Graph-RAG](https://ai-powered.com/mcp/code-graph-rag): Code-Graph-RAG is an open-source MCP server for knowledge and memory.
- [Graphicle](https://ai-powered.com/mcp/graphicle): Graphicle is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/codebase-brain
