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