Code Memory logo

Code Memory

Searches locally indexed code, documentation, and Git history through MCP tools without sending code elsewhere.

Install Code Memory

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "code-memory": {
      "command": "uvx",
      "args": [
        "code-memory"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx code-memory

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The code-memory MCP server indexes local source code and documentation for semantic retrieval, using tree-sitter, BM25, and sentence-transformers embeddings. Its MCP tools find code definitions and references, explain documentation and architecture, and search Git history for regression context and developer intent. Reach for it when an agent needs focused context from a large repository while keeping processing offline and avoiding an API key.

Use cases

  • Index a repository before asking an agent to inspect it
  • Find function definitions and dependency references with semantic queries
  • Explain architecture from READMEs, Markdown, and docstrings
  • Trace regressions and developer intent through Git history

Key features

  • Local semantic code and documentation search
  • Hybrid BM25 and vector retrieval
  • Tree-sitter structural extraction
  • Git history search
  • Offline operation without an API key
  • Stdio and SSE transports

Tools4

What Code Memory lets your agent do. Expand a tool for its parameters.

Self-reported~209 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

19/19 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 1d ago via OSV.dev · code-memory (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars50Stargazers on the source repository.
Last commit6mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed4Callable tools this server registers over MCP.
Directory activity7 viewsConfig copies, upvotes, and views on AllMCPs.

How Code Memory works

What code-memory MCP server does

The code-memory MCP server turns a local repository into a searchable source of code, documentation, and Git history. It is designed for MCP hosts that need targeted repository context instead of sending whole files into a model prompt. Processing happens locally, with no API key required and zero telemetry stated by the project.

Supported languages receive either structural or whole-file indexing. Python, JavaScript and TypeScript, Java, Go, Rust, C and C++, Ruby, and Kotlin use AST-based extraction. C#, Swift, Scala, Lua, shell, configuration files, web files, SQL, and Markdown use whole-file indexing. Files excluded by .gitignore are skipped.

How it works

Run index_codebase against a directory before searching. The indexer parses supported source files, extracts structural information where available, creates dense embeddings with a sentence-transformers model, and stores retrieval data locally. Code search combines BM25 matching with vector similarity, while documentation search uses semantic and fuzzy retrieval. Git history search combines repository history with BM25 and vector retrieval.

The four tools separate common repository questions. search_code is intended for definitions, references, structural relationships, and semantic matches. search_docs searches Markdown, README files, and docstrings for architecture, workflows, and procedures. search_history helps investigate regressions and the intent behind changes. Re-run indexing when the searchable files or embedding model change.

Setup and configuration

Install from PyPI with pip install code-memory or run it directly with uvx code-memory. The documented prerequisites are Python 3.13 or newer and, for the recommended setup, the uv package manager. Source installation and standalone binaries are also available; the binaries target Linux x86_64, macOS Intel, macOS ARM64, and Windows x86_64.

The default transport is stdio. A shared SSE process can be started with --transport sse, with configurable --host and --port; its documented default endpoint is http://127.0.0.1:8765/sse. The endpoint has no authentication, so the project advises keeping it on the loopback address unless authentication is added separately.

CODE_MEMORY_LOG_LEVEL controls logging verbosity. EMBEDDING_MODEL selects the Hugging Face embedding model and defaults to jinaai/jina-code-embeddings-0.5b. The first run downloads an approximately 600 MB model to the local Hugging Face cache. Changing models invalidates existing indexes and requires re-indexing.

Tools and capabilities

  • index_codebase: create or refresh the local index for source files and documentation.
  • search_code: locate definitions, references, semantic matches, and dependency-related structure.
  • search_docs: search documentation and docstrings for conceptual and architectural context.
  • search_history: inspect Git history while debugging regressions or tracing intent.

Limitations and notes

Search depends on an up-to-date index, so newly changed files may not appear until index_codebase runs again. Structural extraction is not available for every listed language; fallback languages are indexed as complete files. Local model downloads and embedding generation also require enough disk space and local compute, and the shared SSE mode should not be exposed publicly without protection.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Code Memory

code-memory is an MCP server that indexes local source code, documentation, and Git history for offline retrieval. It connects MCP hosts to local repositories over stdio or SSE and provides index_codebase, search_code, search_docs, and search_history tools without requiring an API key.

Install it with `pip install code-memory` or run it with `uvx code-memory`. The documented prerequisites are Python 3.13 or newer and preferably `uv`; standalone binaries are also available for supported Linux, macOS, and Windows targets.

Configure each host to launch `uvx code-memory` over stdio, or point it to the local SSE endpoint when using a shared server.

Yes, code-memory runs locally with sentence-transformers and does not require an API key. The first run downloads the embedding model to the local Hugging Face cache; later runs use that cached model.

Run `index_codebase` to create or refresh the local search data before using `search_code` or `search_docs`. Re-index after repository changes or after changing `EMBEDDING_MODEL`, because the existing index is then invalidated.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewCode Memory AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/code-memory?style=directory)](https://allmcps.com/mcp/code-memory)
HTML Embed
<a href="https://allmcps.com/mcp/code-memory"><img src="https://allmcps.com/api/badge/code-memory?style=directory" alt="Code Memory on AllMCPs" /></a>