codebase-memory-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codebase-memory-mcpFind all TODO comments in the codebase"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codebase-memory-mcp
A Docker stdio-based MCP Server providing code graph intelligence and memory capabilities.
Inspired by DeusData/codebase-memory-mcp, optimized for token efficiency.
š Token Efficiency
Feature | Traditional | This Project |
Find callers of a function | ~50K tokens (grep + read files) | ~500 tokens (single |
Project architecture overview | ~100K tokens | ~1K tokens ( |
Dead code detection | Manual review | Automated ( |
Estimated 20-50x token reduction for structural queries.
Related MCP server: Mono Memory MCP
Features (19 Tools)
š Graph Intelligence (NEW - 13 tools)
Tool | Description |
| Index codebase into searchable graph (supports TypeScript, JavaScript, Python, Go, Rust, Java) |
| Incrementally update index based on file changes |
| List all indexed projects with statistics |
| Remove a project index |
| Check indexing status and statistics |
| Search functions, classes, methods by name pattern |
| Find callers/callees of a function (call tree) |
| Detailed info about a symbol with relationships |
| List all symbols in a file |
| Detect potentially unused functions |
| High-level project overview (modules, hotspots, entry points) |
| Read source code for a specific symbol |
| Execute custom SQL queries on the graph |
š¾ Memory (Original - 4 tools)
Tool | Description |
| Store or update memory entries (supports tags) |
| Search memories by keyword/tag |
| List all stored memories |
| Delete a specific memory |
š Codebase Search (Original - 2 tools)
Tool | Description |
| Search code using ripgrep (supports regex) |
| Read file content for LLM summarization |
Token-Optimization Roadmap
This roadmap focuses on generic mechanisms that reduce AI token usage by replacing repeated grep/read/reason loops with reusable structured evidence.
Low Cost, High Return ā COMPLETED
Item | Status | What was implemented |
Tool routing policy | ā |
|
Evidence-first responses | ā |
|
File summary cache | ā |
|
File summary tools | ā |
|
Delivered in v2.1.0:
file_summariesschema keyed byproject + path + hashAuto-generation during
index_project/sync_index4 new MCP tools for summary queries
Token savings: 10-100x for common exploration tasks
Mid Term
Item | What to implement | Expected benefit |
Ownership relationships | Add | Enables exact class/method and module/function queries with less fallback reading |
Expand graph edge types | Add | Improves architecture and impact analysis from ~5x to ~20x+ on common questions |
Incremental semantic summaries | Refresh only changed file and symbol summaries during | Reduces repeated recomputation and stale context reads in multi-turn sessions |
Change-impact tool | Map git diff to affected symbols, direct callers, nearby files, and likely test targets | Reduces review and regression-analysis token cost by ~5-20x |
Query templates | Provide first-class tools for recurring tasks like | Avoids ad hoc SQL or raw file reading for routine analysis |
Concrete deliverables
Extend
symbolsschema to persist ownership relationships directlyAdd edge builders in the parser/indexer for imports and definitions
Add a
detect_changesMCP tool backed by git diff + graph traversal
Long Term
Item | What to implement | Expected benefit |
Hybrid retrieval | Combine structural graph search with semantic/vector candidate retrieval | Improves ambiguous or concept-level search by ~2-6x |
Cross-file responsibility summaries | Build module-level summaries from grouped files and symbols | Lets AI answer design questions without opening many files |
Precomputed risk and refactor candidates | Detect cycles, oversized modules, unstable hotspots, dead-code clusters | Makes maintenance guidance nearly zero-search for common cases |
Test and route awareness | Model test ownership, API handlers, jobs, and config-driven execution paths | Greatly reduces token cost for impact and regression questions |
Cross-repo artifact reuse | Persist compressed graph/summaries for team reuse or CI-produced bootstrap artifacts | Eliminates repeated cold-start indexing for shared codebases |
Concrete deliverables
Add a vector index for file/symbol summaries and blend retrieval with graph constraints
Introduce module and route nodes in the graph model
Export reusable project graph artifacts to accelerate first-time sessions
Prioritized Execution Order
Add tool routing policy and evidence-first response shapingāAdd file summary cache keyed by file hashāAdd
owner_symbol_id/parent_symbol_idto support exact ownership queriesAdd
IMPORTS/DEFINESgraph edgesAdd
detect_changesfor git-aware impact analysisAdd hybrid semantic + structural retrieval
Success Metrics
Track roadmap progress using these measurable outcomes:
Metric | Current target | Long-term target |
Tokens per architecture question | 20-50x lower than grep/read flow | 50-100x lower |
Tool calls per exploration task | 2-5 calls | 1-3 calls |
Re-read rate for unchanged files | Reduced by file-hash summary cache | Near-zero in multi-turn sessions |
Diff impact analysis time | Manual or multi-step | Single tool call |
Quick Start
Build Docker Image
cd /path/to/codebase-memory-mcp
podman build -t codebase-memory-mcp .With Persistent Data (Recommended)
# Create data directory for persistent indexes
mkdir -p ~/.codebase-memory-data
podman run -i --rm \
-v "${PWD}:/app/workspace:ro" \
-v "$HOME/.codebase-memory-data:/app/data" \
codebase-memory-mcpVS Code Configuration
Create .vscode/mcp.json in your project root:
Windows Host + WSL Container (Recommended)
For VS Code running on Windows, with Podman/Docker inside WSL:
{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "wsl",
"args": [
"-d", "Ubuntu-22.04",
"podman", "run", "-i", "--rm",
"-v", "/mnt/c/Users/YourName/Projects/my-project:/app/workspace:ro",
"-v", "/home/youruser/.codebase-memory-data:/app/data",
"codebase-memory-mcp"
]
}
}
}Important for Windows + WSL:
Replace
Ubuntu-22.04with your WSL distro (runwsl -l -vto list)Replace
/mnt/c/Users/YourName/Projects/my-projectwith your Windows project path converted to WSL format:C:\Users\YourName\Projectsā/mnt/c/Users/YourName/ProjectsD:\code\myappā/mnt/d/code/myapp
Create persistent data directory in WSL:
wsl -d Ubuntu-22.04 mkdir -p ~/.codebase-memory-data
Windows Host + WSL (Dynamic Workspace Path)
For projects stored in Windows filesystem with dynamic path:
{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "wsl",
"args": [
"-d", "Ubuntu-22.04",
"bash", "-c",
"podman run -i --rm -v \"$(wslpath '${workspaceFolder}'):/app/workspace:ro\" -v \"$HOME/.codebase-memory-data:/app/data\" codebase-memory-mcp"
]
}
}
}Note:
${workspaceFolder}is a VS Code variable that expands to the Windows path. Thewslpathcommand converts it to WSL format.
Linux / macOS (Native)
With Persistent Storage (Recommended)
{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "podman",
"args": [
"run", "-i", "--rm",
"-v", "${workspaceFolder}:/app/workspace:ro",
"-v", "${env:HOME}/.codebase-memory-data:/app/data",
"codebase-memory-mcp"
]
}
}
}Without Persistence (Ephemeral)
{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "podman",
"args": [
"run", "-i", "--rm",
"-v", "${workspaceFolder}:/app/workspace:ro",
"codebase-memory-mcp"
]
}
}
}Usage Examples
1. Index Your Project (First Time)
You: "Index this project"
AI: [calls index_project]
ā ā
Indexed 150 files in 2.3s
š Total: 1,234 symbols, 567 edges
š Types: function=456, class=78, method=234, ...2. Find Who Calls a Function
You: "Who calls the processOrder function?"
AI: [calls trace_calls(function_name="processOrder", direction="inbound")]
ā Callers of processOrder (depth=3)
ā OrderController.handleOrder (method) - src/controllers/order.ts:45
ā Router.post (function) - src/routes/index.ts:12
ā BatchProcessor.run (method) - src/jobs/batch.ts:893. Get Architecture Overview
You: "Give me an overview of this project's architecture"
AI: [calls get_architecture]
ā # šļø Architecture Overview: default
## Statistics
- Files: 45
- Symbols: 1,234
- Relationships: 567
## Hotspots (most called)
1. validateInput - 23 callers
2. formatResponse - 18 callers
...4. Find Dead Code
You: "Find any potentially unused functions"
AI: [calls find_dead_code]
ā ā ļø Potentially Dead Code (12 functions with no callers)
- legacyHandler - src/handlers/old.ts:45
- deprecatedUtil - src/utils/deprecated.ts:12
...5. Custom Graph Query
You: "Show me all classes and their method counts"
AI: [calls query_graph]
ā SELECT
(SELECT name FROM symbols WHERE id = s.id AND type = 'class') as class_name,
COUNT(*) as method_count
FROM symbols s
WHERE type = 'method'
GROUP BY parentSupported Languages
Language | AST Parsing | Call Graph |
TypeScript | ā Full (tree-sitter) | ā |
JavaScript | ā Full (tree-sitter) | ā |
Python | ā Full (tree-sitter) | ā |
Go | ā” Regex fallback | ā” |
Rust | ā” Regex fallback | ā” |
Java | ā” Regex fallback | ā” |
Others | ā” Regex fallback | ā” |
Claude Desktop Configuration
Edit %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/.config/Claude/claude_desktop_config.json (macOS/Linux):
{
"mcpServers": {
"codebase-memory": {
"command": "podman",
"args": [
"run", "-i", "--rm",
"-v", "/path/to/your/project:/app/workspace:ro",
"-v", "/path/to/.codebase-memory-data:/app/data",
"codebase-memory-mcp"
]
}
}
}Environment Variables
Variable | Default | Description |
|
| SQLite database directory |
|
| Mounted codebase root directory |
|
| Full path to database file |
Directory Structure
Inside container:
/app
āāā dist/ # Compiled JS
āāā node_modules/
āāā data/ # SQLite DB (persist via volume mount!)
ā āāā memory.db # Contains: memories, symbols, edges, indexed_files
āāā workspace/ # Project code (mounted via -v)
āāā ...Verify Installation
Test MCP Server Startup
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
| podman run -i --rm codebase-memory-mcpConfirm Tools Count
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
| podman run -i --rm codebase-memory-mcp 2>/dev/null | tail -1 | jq '.result.tools | length'Output: 19
Comparison with DeusData/codebase-memory-mcp
Feature | DeusData | This Project |
Language | C (native binary) | TypeScript (Node.js) |
Token Reduction | 120x | 20-50x |
Languages | 158 | 3 full + regex fallback |
Deployment | Single binary | Docker container |
Customization | Limited | Easy to extend |
Memory | Releases after indexing | Persistent |
Choose This Project If:
You want easy customization and extension
You prefer Docker-based deployment
Your codebase is primarily TypeScript/Python/Go
You want to learn MCP development
Choose DeusData If:
You need maximum token efficiency
You have a large monorepo (millions of LOC)
You need 158 language support
You want zero-dependency deployment
License
MIT
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
| docker run -i --rm codebase-memory-mcp 2>/dev/null | tail -1 | jq '.result.tools[].name'Output:
"store_memory"
"retrieve_memory"
"list_memories"
"delete_memory"
"search_codebase"
"summarize_file"Verify AI Can Use Tools
Once configured in VS Code or Claude Desktop, test with these prompts:
Test 1: Store and retrieve memory
Please store a memory with key "test" and content "Hello MCP", then list all memories.Expected: AI calls store_memory then list_memories, showing the stored entry.
Test 2: Search codebase
Search for "function" in the codebase.Expected: AI calls search_codebase and returns matching lines.
Test 3: Summarize file
Summarize the package.json file.Expected: AI calls summarize_file and provides a summary of dependencies.
Troubleshooting
If tools don't appear: Check MCP panel in VS Code (View ā MCP Servers) or restart the editor
If container fails: Run
docker run -i --rm codebase-memory-mcpmanually to see errorsIf path mount fails: Verify the workspace path exists and is accessible
FAQ
Q: When does memory disappear?
A: Memory is cleared each time the container exits (conversation ends or VS Code restarts). This is by design, allowing AI to re-understand the project each session.
Q: How to auto-initialize memory?
A: Use .github/copilot-instructions.md to set instructions, or explicitly request memory initialization at conversation start. See "Auto-Initialize Memory on Each Session" section above.
Q: What if I need persistent memory?
A: Add volume mount back:
"args": [
"run", "-i", "--rm",
"-v", "codebase-memory-data:/app/data",
"-v", "${workspaceFolder}:/app/workspace:ro",
"codebase-memory-mcp"
]Then run podman volume create codebase-memory-data.
Q: Windows path conversion issues?
Docker Desktop automatically handles C:\ ā /c/ conversion. For WSL Docker, store projects in WSL filesystem (e.g., /home/user/projects) to avoid path issues.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA local MCP server providing persistent memory for AI coding assistants by storing and searching architectural decisions, patterns, and solutions. It also includes tools for git automation and mapping codebase expertise based on project history.Last updatedMIT
- Alicense-qualityDmaintenanceA self-hosted MCP server that provides AI assistants with a shared, persistent SQLite-backed memory for storing and retrieving project context, decisions, and discoveries. It enables cross-session continuity and team-wide knowledge sharing to keep AI coding tools aligned and informed.Last updated3MIT
- Alicense-qualityBmaintenanceA local MCP server that provides AI coding assistants with semantic search capabilities over codebases. It indexes code using local embeddings and exposes tools for efficient code retrieval, saving tokens and improving response quality.Last updated314MIT
- Flicense-qualityDmaintenanceA local MCP server that provides semantic memory storage and retrieval for coding and AI agents, enabling durable context across chat sessions.Last updated344
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Cloud-hosted MCP server for durable AI memory
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/diloper/codebase-memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server