# Codebase Context MCP server

> Lets AI coding agents inspect repository structure, search code, and recall project conventions via MCP and CLI.

- Repository: https://github.com/PatrickSys/codebase-context
- Page: https://hostedmcp.org/servers/patricksys/codebase-context
- Transport: stdio
- Stars: 68

## Install

### Claude Code

```sh
claude mcp add codebase-context -- npx -y codebase-context
```

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

```json
{
  "mcpServers": {
    "codebase-context": {
      "command": "npx",
      "args": [
        "-y",
        "codebase-context"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "codebase-context": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "codebase-context"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"codebase-context","type":"stdio","command":"npx","args":["-y","codebase-context"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "codebase-context": {
      "command": "npx",
      "args": [
        "-y",
        "codebase-context"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add codebase-context -- npx -y codebase-context
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.codebase-context]
command = "npx"
args = ["-y", "codebase-context"]
```

### Gemini CLI

```sh
gemini mcp add -s user codebase-context npx -- -y codebase-context
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "codebase-context": {
      "command": "npx",
      "args": [
        "-y",
        "codebase-context"
      ]
    }
  }
}
```

## FAQ

### What can an AI agent inspect with Codebase Context?

The agent can view a repository map, run ranked code search, look up symbol references and file relationships, observe team patterns, and store or retrieve project memory.

### Does Codebase Context require Docker, a GPU, or an API key?

No. The default keyword index builds locally without Docker, a GPU, or an API key. Optional embeddings also run locally unless you explicitly configure a remote provider.

### Which AI clients can Codebase Context set up automatically?

The init wizard recognizes Claude Code, Codex, Cursor and OpenCode and writes project registrations for them.

### How many results does a default code search return?

The default compact search response contains at most six ranked results.

### Should generated index data be committed to version control?

No. You should keep generated index data out of version control and can optionally commit only the project memory file.
