codememory
Enables AI agents to locally search, query, and understand codebases with token-efficient context, dependency graphs, history, architecture diagrams, and metrics through MCP.
README
<img src="./assets/codememory-wodmark.png" alt="codememory-wordmark">
š§ CodeMemory
The Persistent Intelligence Layer for Codebases
Local-first, privacy-obsessed CLI tool and Model Context Protocol (MCP) server for AI agents.
š Official Website & Docs: https://codemem.vercel.app/
ā” Key Highlights
- š 100% Local & Private: Zero telemetry, zero external network calls. All intelligence stored locally in SQLite WAL mode.
- š Interactive Web Architecture Explorer: Local visual flowchart & memory dashboard with timeline scrubbing and real-time live updates.
- ā” Token Efficiency: Minimizes AI prompt token consumption by providing targeted context slices and caller graphs instead of raw file dumps.
- š Multi-Language AST Analysis: Extracts functions, classes, interfaces, structs, and imports across TypeScript/JavaScript, Python, Rust, Go, SQL, and more.
- š Real-time Live Watcher: Detects code changes instantly with 100ms debouncing and
.gitignoreintegration. - š¤ Native MCP Server: Ready to connect with Antigravity, Claude Desktop, Cursor, Copilot, and custom AI agents.
- š Architecture Visualizer: Generates live Mermaid diagrams, Markdown documentation, and JSON maps.
š Quick Start
1. Installation
# Clone the repository
git clone https://github.com/EldrexDelosReyesBula/CodeMemory.git
cd CodeMemory
# Install dependencies
npm install
# Build TypeScript
npm run build
2. Basic Commands
# Initialize CodeMemory in your repository
npm run dev -- init
# Scan the current codebase and index all symbols
npm run dev -- scan
# Search for any function, class, or symbol
npm run dev -- query authenticateUser
# Extract token-budgeted AI context
npm run dev -- context AuthService --budget 2000
# Start the live background file watcher
npm run dev -- watch
# Export Mermaid architecture diagram
npm run dev -- export --format mermaid
# Check repository health and statistics
npm run dev -- status
š¤ Connecting to AI Agents via MCP
CodeMemory provides a full Model Context Protocol (MCP) stdio server.
Available MCP Tools
| Tool | Description |
|---|---|
codememory_search |
Search code symbols, signatures, and functions |
codememory_get_context |
Token-budgeted context with dependencies & callers |
codememory_get_dependencies |
Upstream imports and downstream dependents |
codememory_get_history |
Recent file modifications and Git commit logs |
codememory_get_architecture |
Generate real-time Mermaid architecture diagrams |
codememory_get_metrics |
Overall codebase stats and language breakdowns |
Antigravity & Claude Desktop Configuration
Add the following to your MCP configuration (mcp_config.json or claude_desktop_config.json):
{
"mcpServers": {
"codememory": {
"command": "node",
"args": ["c:/Users/Eldrex/Downloads/classhost/Needs/CodeMemory/dist/cli.js", "mcp"],
"env": {}
}
}
}
šļø Architecture
CodeMemory/
āāā src/
ā āāā types/ # Domain data types & contracts
ā āāā db/ # SQLite engine with WAL mode & indexes
ā āāā parser/ # Multi-language AST symbol & dependency extractor
ā āāā watcher/ # Real-time debounced file watcher with .gitignore
ā āāā git/ # Git commit and diff history monitor
ā āāā generator/ # Mermaid diagram & Markdown/JSON exporters
ā āāā context/ # Token-budgeted context assembly & symbol ranker
ā āāā mcp/ # Model Context Protocol stdio server
ā āāā cli.ts # CLI commands router
āāā tests/ # Complete Vitest test suite
š License
MIT License - Copyright (c) 2026 Eldrex Delos Reyes Bula.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.