codebase-memory-mcp tutorial: add codebase memory to Claude Code and Codex

A practical guide to DeusData/codebase-memory-mcp: one-line installation, Windows installation, UI, auto indexing, update/uninstall, and codebase memory scenarios for 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/

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.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy