Codebase Memory MCP Setup: Persistent Code Search for Claude Code and Codex

Install Codebase Memory MCP on Windows, macOS, or Linux, enable automatic indexing, open its UI, and connect persistent code search to AI coding agents.

DeusData/codebase-memory-mcp is a code intelligence MCP server. It indexes a codebase into a persistent knowledge graph, helping agents such as Claude Code, Codex, Gemini CLI, Aider, and OpenCode query project structure faster.

Project repository:

https://github.com/DeusData/codebase-memory-mcp

Documentation site:

https://deusdata.github.io/codebase-memory-mcp/

Quick Answer

Codebase Memory MCP builds a persistent knowledge graph for a repository and exposes it to MCP-compatible coding agents. Install the binary, index one test repository, start the UI on port 9749, and verify that your agent can locate an entry point or trace a call chain before relying on it for code changes.

One-line Installation

macOS / Linux:

1
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash

If you also want to install the graphical interface:

1
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui

Windows:

1
2
3
4
5
6
7
8
# 1. Download the installer
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1

# 2. (Optional but recommended) Inspect the script
notepad install.ps1

# 3. Run it
.\install.ps1

Manual Installation

After extracting on macOS / Linux:

1
2
tar xzf codebase-memory-mcp-*.tar.gz
./install.sh

Windows:

1
2
Expand-Archive codebase-memory-mcp-windows-amd64.zip -DestinationPath .
.\install.ps1

Open the UI

1
codebase-memory-mcp --ui=true --port=9749

Auto Indexing and Updates

Enable auto indexing:

1
codebase-memory-mcp config set auto_index true

Update:

1
codebase-memory-mcp update

Uninstall:

1
codebase-memory-mcp uninstall

How to Use It

It fits large codebases where agents repeatedly read the same files. For example:

  1. A legacy project has a complex structure and AI often picks the wrong entry point.
  2. A multi-language repository needs fast dependency lookup.
  3. You want to reduce the number of files an agent pushes into context.
  4. You want to share one code memory through MCP across multiple coding tools.

After installation, ask the agent to start with a small task: explain the project structure, find the call chain of an API, or locate a configuration entry. Once you confirm it can query correctly, use it for real code changes.

Troubleshooting and Verification

If the agent cannot see the server, first run codebase-memory-mcp --ui=true --port=9749 directly and confirm that the local UI opens. Then check the MCP client configuration, restart the client so it reloads the server definition, and index a small repository before testing a monorepo. If answers look stale, confirm that auto_index is enabled or trigger a fresh index after large branch changes.

For alternative approaches, compare CodeGraph for local code knowledge graphs and Graphify for repository mapping and call-flow export. These tools overlap, but their installation model, output artifacts, and agent integrations differ.