code-cortex-mcp

A local MCP server that gives AI coding agents a knowledge graph of your codebase: functions, classes, call graphs, HTTP routes, and cross-service links. One graph query replaces dozens of grep-and-read cycles.

155
languages
3 min
Linux kernel index
2.4×
median indexing speedup vs upstream
13
agents configured

Install

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/tigercosmos/code-cortex-mcp/main/install.sh | bash

# Windows (PowerShell)
Invoke-WebRequest -Uri https://raw.githubusercontent.com/tigercosmos/code-cortex-mcp/main/install.ps1 -OutFile install.ps1
.\install.ps1

# Restart your agent, then say:
"Index this project"

The installer configures Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, Cursor, OpenClaw, Kiro, and Junie: MCP server entries, instruction files, and pre-tool hooks. One static binary for macOS, Linux, and Windows. No Docker, no Node, no Python, no API key. All data stays on your machine in ~/.cache/code-cortex-mcp/.

How it works

You: "what calls ProcessOrder?"
Agent: trace_path(function_name="ProcessOrder", mode="calls")
Engine: runs the graph traversal, returns structured results
Agent: explains the call chain in plain English

The engine parses every file with tree-sitter, resolves calls and types (LSP-style hybrid resolution for Go, C, C++, TypeScript/JavaScript, Java, Kotlin, Rust, Python, PHP, and C#), and stores the graph in SQLite. A persistent worker process then answers tool calls in well under a millisecond.

MCP tools

ToolPurpose
index_repository, index_status, list_projects, delete_projectIndex and manage projects
search_graphSearch by label, name pattern, file pattern, or degree
trace_pathCallers, callees, data flow, and cross-service chains
query_graphRead-only Cypher-subset queries
get_code_snippetSource of a symbol by qualified name
get_architectureLanguages, packages, routes, hotspots, clusters, cycles, ADRs
get_graph_schemaNode and edge counts, property shapes
search_codeGraph-augmented grep over indexed files
detect_changesBlast radius of a git diff
manage_adrArchitecture Decision Records

Performance

Full index from an empty cache, median of three runs. Apple M3 Max (14 cores, 36 GB) and a 32-core Linux machine (62 GB), release builds.

RepositoryLinesNodes / edgesM3 Max32-core LinuxPeak RAM
etcd (Go)0.3M15K / 95K1.4 s1.2 s0.7 GB
Redis (C)0.6M38K / 146K2.8 s2.8 s1.0 GB
Django (Python)1.1M55K / 372K4.8 s3.8 s1.9 GB
CPython (C, Python)3.3M137K / 1.0M14 s12 s4.3 GB
PyTorch (C++, Python)5.1M235K / 2.1M32 s26 s8.7 GB
Kubernetes (Go)7.3M288K / 3.3M56 s57 s4.9 GB
Elasticsearch (Java)8.8M692K / 5.2M94 s63 s7.9 GB
llvm-project (C++)46.8M2.2M / 7.8M487 s382 s12 GB
Linux kernel (C)43.8M4.7M / 11.6M368 s264 s13.4 GB
search_graph, trace_path (warm query)0.1–0.5 ms
PreToolUse hook (Grep or Read)~10 ms

Peak RAM is the peak resident set size on the M3 Max at 14 workers. It follows how much the extractors produce rather than repository size, and indexing is where it goes — answering queries afterwards reads the SQLite file and needs almost none of it. The indexer throttles its own workers against a budget derived from total RAM, so a smaller machine still finishes, more slowly.

Features

155 languages

Vendored tree-sitter grammars compiled into the binary. Type-resolved call graphs for 10 languages; structural parsing for the rest.

Static analysis

Import-aware, type-inferred call graph. Dead code, Leiden clusters, circular dependencies, complexity metrics, git-diff blast radius.

Deterministic indexing

Two runs over the same tree produce the same nodes, edges, IDs and properties, byte for byte, whatever order the workers finish in. Verified on eleven repositories. Diff two snapshots and only real code changes show up.

Crash isolation

A supervisor contains per-file crashes and hangs during indexing. A persistent worker answers tool calls with a per-tool deadline.

Preprocessor-aware C/C++

Recovers definitions split across #ifdef branches. Headers get their own File nodes with resolved #include edges.

Code search

BM25 full text (FTS5), structural search, and semantic similarity edges from algorithmic embeddings. No API key.

Cross-service links

HTTP route ↔ call site; gRPC, GraphQL, tRPC; Socket.IO and pub-sub channels; CROSS_* edges across repositories.

Team artifact

Commit .code-cortex/graph.db.zst and teammates import the graph instead of a full reindex. A merge=ours rule prevents conflicts.

Compared to codebase-memory-mcp

code-cortex-mcp forked from DeusData/codebase-memory-mcp and keeps its on-disk graph format. It indexes faster and answers most tool calls faster. codebase-memory-mcp has features that code-cortex-mcp does not; the feature table names them.

Measured 2026-08-25 on an Apple M3 Max (14 cores, 36 GB) and a 32-core Linux machine (62 GB): code-cortex-mcp at af4579de plus the llvm-project crash fix, codebase-memory-mcp at 010569fa, each built with its own scripts/build.sh, from an empty cache.

Indexing speed (13 repositories, median of 3 full runs)

Apple M3 Max (14 cores, 36 GB)32-core Linux (62 GB)
Repositories both engines complete11 of 1311 of 13
Speedup, median2.4×2.4×
Speedup, range1.1× (Kubernetes) – 5.7× (etcd)1.1× (Kubernetes) – 4.4× (etcd)
etcd (Go, 0.3M lines)1.42 s vs 8.11 s1.15 s vs 5.08 s
CPython (C, Python, 3.3M lines)14.4 s vs 47.6 s11.9 s vs 28.2 s
PyTorch (C++, Python, 5.1M lines)31.9 s vs 77.8 s25.8 s vs 70.3 s
Elasticsearch (Java, 8.8M lines)94.0 s vs 112.8 s63.1 s vs 116.2 s
llvm-project (C++, 46.8M lines)487 s vs crash382 s vs crash
Linux kernel (C, 43.8M lines)368 s vs stopped264 s vs out of memory

Node counts match closely except on Rails (100,649 against 64,354); edge counts differ on Kubernetes (3.3M against 2.0M) and Elasticsearch (5.2M against 5.7M). Both engines crashed on llvm-project with the same inherited bug, fixed in code-cortex-mcp; codebase-memory-mcp's kernel index exceeded 57 GB and was killed. Per-repository tables and raw data: docs/benchmarks/2026-08-25.

Tool-call latency (median of 20 warm calls, Django graph)

Toolcode-cortex-mcpcodebase-memory-mcp
search_graph5.1 ms18.2 ms
query_graph1.6 ms15.8 ms
list_projects0.2 ms13.7 ms
search_code239.8 ms271.3 ms
get_graph_schema406.3 ms480.9 ms
index_status60.6 ms20.0 ms
get_architecture *251.0 ms54.7 ms
Cold CLI call from a hook0.02 s4.4 s

* get_architecture returns 117 KB of JSON in code-cortex-mcp and 1.7 KB of compact tree output in codebase-memory-mcp, so the two times measure different amounts of output. The cold hook row is a memo hit; the first call after the database changes takes 0.74 s.

Features

Areacode-cortex-mcpcodebase-memory-mcp
Language and build systemC++23, CMakeC11, Make
Binary size (macOS arm64, no UI)218 MB283 MB
Semantic embeddingsalgorithmic random indexing31 MB pretrained vector blob
Tool-call isolationsupervised worker, per-tool deadlinein-process
Integrity memo for cold starts_config.dbnone
Languages155158
Hybrid LSP resolvers1011 (adds Perl)
MCP tools1415 (adds check_index_coverage)
Reference precision (CALL_REFERENCE / USAGE)noyes
Session coordination daemonnoyes
3D graph web UInoyes
Compact tree output formatno, JSONyes
Agent surfaces configured by install1343

Full test conditions and graph sizes: README →