codebase-memory-mcpmcp-servercode-intelligencec-languageknowledge-graph

codebase-memory-mcp: C-powered Code Intelligence MCP Server

August 5, 2026
3 min read

codebase-memory-mcp: High-Performance Code Intelligence for MCP Agents

The codebase-memory-mcp server, written in C, provides high-performance code intelligence by indexing codebases into a persistent knowledge graph. It processes average repositories in milliseconds, supports 158 languages, and delivers sub-millisecond queries, achieving 99% fewer tokens for AI interactions. This server compiles into a single static binary with zero dependencies, making it a lean and efficient choice for integrating deep code understanding into your MCP-powered workflows.

Integrating codebase-memory-mcp with Your MCP Client

Connecting codebase-memory-mcp to your MCP agent is straightforward, exposing 14 distinct tools for code analysis and interaction. For clients like Claude Desktop, you can configure it globally or per-project.

To manually configure, add the following JSON snippet to ~/.claude/.mcp.json (for global access) or your project's .mcp.json:

{
  "mcpServers": {
    "codebase-memory-mcp": {
      "command": "/path/to/codebase-memory-mcp",
      "args": []
    }
  }
}

After adding this configuration, restart your agent. You can verify the integration by running /mcp in your client, which should list codebase-memory-mcp and its available tools.

Codebase Analysis and Querying Capabilities

codebase-memory-mcp offers a suite of tools for deep code analysis and efficient querying, all accessible via its MCP integration.

Graph & Analysis Tools

The server constructs a detailed knowledge graph of your codebase, enabling sophisticated analysis:

  • get_architecture: Provides a comprehensive architecture overview, including languages, packages, entry points, routes, hotspots, boundaries, layers, and clusters.
  • manage_adr: Facilitates the persistence of architectural decisions across sessions.
  • Louvain community detection: Identifies functional modules by clustering call edges within the codebase.
  • detect_changes: Maps uncommitted Git changes to affected symbols, complete with risk classification.
  • Call graph: Resolves function calls across files and packages, supporting import-aware and type-inferred resolution.
  • Dead code detection: Pinpoints functions with no callers, excluding designated entry points.
  • Cypher-like queries: Allows structured queries against the graph, such as MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'main' RETURN g.name to find functions called by 'main'.

Search Capabilities

Beyond graph analysis, codebase-memory-mcp provides multiple search modalities:

  • semantic_query: Performs vector search across the entire knowledge graph. This is powered by bundled Nomic nomic-embed-code embeddings (40K tokens, 768d int8), compiled directly into the binary, requiring no external API keys, Ollama, or Docker. It uses an 11-signal combined scoring mechanism, incorporating TF-IDF, RRI, API/Type/Decorator signatures, AST profiles, data flow, Halstead-lite, MinHash, module proximity, and graph diffusion.
  • BM25 full-text search: Leverages SQLite FTS5 with a cbm_camel_split tokenizer, which is aware of camelCase and snake_case conventions.
  • search_graph: Enables structural search using regex name patterns, label filters, min/max degree, and file scoping.
  • search_code: Offers graph-augmented grep over indexed files.

Server Configuration

You can manage codebase-memory-mcp's behavior directly via its command-line interface. For example, to configure auto-indexing:

codebase-memory-mcp config list                          # show all settings
codebase-memory-mcp config set auto_index true           # auto-index on session start
codebase-memory-mcp config set auto_index_limit 50000    # max files for auto-index
codebase-memory-mcp config reset auto_index              # reset to default

These settings allow you to control how the server indexes your codebases, optimizing for your specific needs. The ability to auto-index on session start, with a configurable file limit, ensures that your MCP agent always has an up-to-date understanding of the codebase without manual intervention.

References