
Code Memory
Runs a local semantic code search engine that exposes three distinct MCP tools: search_code for finding definitions and structure via BM25 and dense vectors, search_docs for architecture queries, and search_history for Git-based debugging. Uses sentence-transformers for embeddings so everything stays offline with no API keys. Supports full AST parsing for Python, JavaScript, TypeScript, Java, Go, Rust, C/C++, Ruby, and Kotlin, with fallback indexing for other languages. Respects .gitignore automatically. The main win is precise retrieval instead of dumping entire files into context, which the author claims cuts token usage by half. Can run as stdio per project or as a shared SSE server to avoid loading the 600MB model multiple times across workspaces.
- GitHub stars
- 41
- tools
- 4
- transport
- STDIO
- env vars
- 2
- last updated
- May 20, 2026
Tools
4 toolsPublic tool metadata for what this MCP can expose to an agent.
index_codebaseIndexes or re-indexes source files and documentation in the given directory.
Indexes or re-indexes source files and documentation in the given directory.
No parameter schema in public metadata yet.
search_codePerform semantic search and find structural code definitions, locate where functions/classes are defined, or map out dependency references (call graphs).
Perform semantic search and find structural code definitions, locate where functions/classes are defined, or map out dependency references (call graphs).
No parameter schema in public metadata yet.
search_docsUnderstand the codebase conceptually — how things work, architectural patterns, SOPs. Searches markdown documentation, READMEs, and docstrings extracted from code.
Understand the codebase conceptually — how things work, architectural patterns, SOPs. Searches markdown documentation, READMEs, and docstrings extracted from code.
No parameter schema in public metadata yet.
search_historyDebug regressions and understand developer intent through Git history.
Debug regressions and understand developer intent through Git history.
No parameter schema in public metadata yet.
Sponsors
Configuration
CODE_MEMORY_LOG_LEVELLogging verbosity (DEBUG, INFO, WARNING, ERROR)
EMBEDDING_MODELHuggingFace model ID for embeddings
Readme
code-memory
code-memory logoA deterministic, high-precision code intelligence layer exposed as a Model Context Protocol (MCP) server.
- Zero telemetry — your code never leaves your machine
- No API key required — runs entirely locally with sentence-transformers
- 1 min setup — just
uvx code-memoryand you're ready - Token saving by 50% — precise code retrieval instead of dumping entire files
Please help star code-memory if you like this project!
Why code-memory?
Finding the right context from a large codebase is expensive, inaccurate, and limited by context windows. Dumping files into prompts wastes tokens, and LLMs lose track of the actual task as context fills up.
Details
- Repository
- github.com/kapillamba4/code-memory
- Categories
- AI & LLM Tools, Developer Tools, Search & Web Crawling
- Package
code-memory- Transport
- STDIO
- Registry
- MCP registry, active