Cerebro MCP
Allows exporting a code knowledge graph as an Obsidian vault, and auditing documentation notes to flag stale references to changed code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cerebro MCP map the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cerebro π§
Persistent code-knowledge memory across AI chat sessions.
Every new chat re-analyzes your project's folders from scratch to understand it, burning tokens re-discovering what a previous chat already learned. Cerebro caches the understanding β not just the files β in a small SQLite "brain" that lives outside the chat. New sessions query it instead of re-reading folders.
Instead of reading 50 files (~100k tokens) to understand a project, the model makes
one cerebro_map() call (~2-3k tokens) plus a few targeted lookups.
How it works
Three layers of "traces", cheapest first:
Structural map (free, no LLM) β
tree-sitterextracts symbols + imports and builds a dependency graph. Imports resolve both relative paths and tsconfig / jsconfig path aliases (@/...), so Next.js / NestJS monorepos get real edges. PageRank ranks the most important modules. Each file is hashed so changes are detectable. Languages: Python, JavaScript / TypeScript (incl. JSX/TSX) and Dart / Flutter.Cached summaries (the big saver) β as a chat understands a file, it calls
cerebro_record(path, summary)to store a 1-3 sentence English summary (English tokenizes ~15-30% cheaper than Spanish). Future sessions reuse it.Freshness β each summary is tied to the file's hash. If the file changed, the trace is flagged stale so only that file gets re-read.
Why not Dijkstra? Code knowledge is a relevance problem, not a shortest-path one. The useful algorithms are graph traversal (BFS/DFS, for impact) and centrality (PageRank, for ranking) β not weighted routing.
Related MCP server: Memory MCP
MCP tools
Tool | Purpose |
| Cheap project overview, modules ranked by centrality. Call first. |
| Summary + symbols + dependencies of a file, without reading it. |
| Hybrid semantic + keyword search; semantic hits resolve to the exact symbol ( |
| Leave a trace: store your understanding of a file. |
| Record a decision / domain rule / gotcha (the why). |
| Recall decisions recorded by past sessions. |
| Files changed since last index + stale summaries. |
| Catch branch switch / git pull / external edits and reindex them. |
| Refresh the structural index (only changed files). |
| Transitive blast radius: everything that (in)directly imports a file. |
| Circular-import groups (architecture smell). |
| Code files nothing imports β dead-code candidates (file-level). |
| Unused-export candidates: functions/classes/methods referenced nowhere in their own project, inside files that are imported (symbol-level dead code). |
| Call sites of a symbol (who calls it, with enclosing fn + line). |
| Internal functions a file calls (outgoing call edges). |
Install
One command (published on PyPI) β add the MCP server to Claude Code:
claude mcp add cerebro -- uvx cerebro-code-memoryOr install the full Claude Code plugin (MCP server + session hooks + cerebro-first subagents):
/plugin marketplace add marcodavidd020/cerebro-code-memory
/plugin install cerebro@cerebroRequires Python β₯ 3.10. Point Cerebro at a repo with CEREBRO_ROOT=/path/to/repo; it
also auto-detects the nearest ancestor .cerebro/ brain (handy in monorepos).
Quick start
One command onboards any repo β it indexes and prints the exact registration line:
uv tool install --from . cerebro # installs the `cerebro` command globally (dev)
cd /path/to/your/repo
cerebro setup --summarize --embed # index (+ warm summaries / semantic index), then prints next stepscerebro setup is idempotent. Then run the claude mcp add β¦ line it prints, reload
your editor, and the cerebro_* tools are available in chat.
Unified CLI
cerebro # no args -> MCP server (stdio); this is what the registration runs
cerebro setup # index this repo + print MCP registration
cerebro index [--force] # build/refresh the index
cerebro search <query> # hybrid semantic + keyword search
cerebro map # project overview
cerebro graph # interactive dependency-graph HTML
cerebro obsidian # export an Obsidian vault
cerebro summarize / embed
cerebro impact / cycles / orphans / callers / calls / recall
cerebro doc-audit <vault> # living docs: flag knowledge notes whose referenced code changedLiving documentation (doc-audit)
cerebro doc-audit <markdown-vault> cross-checks a curated knowledge vault against
the code index: it parses each note's code references (path:line, backticked
symbols) and the note's ultima_verificacion/fecha, then flags notes whose
referenced files changed after they were verified, moved/were deleted, or
mention a symbol that no longer exists. --aliases maps wiki app names to repo
dirs (backend_app=fenix-store-backend,β¦); --fix patches stale notes' frontmatter
to estado: revisar. This is the bridge between an auto-fresh code index and a
human-curated wiki β documentation that can't silently rot.
cerebro doc-refresh <note> closes the loop: it re-audits one stale note against
the live code and prints a briefing β current symbols, summary and dependents for
each reference, plus the new location of any moved file β exactly the context an
agent needs to propose the update (self-healing docs, human-reviewed).
Without a global install, prefix any command with uv run (e.g. uv run cerebro setup).
Point Cerebro at a specific repo with CEREBRO_ROOT=/path/to/repo. It honors
.gitignore plus an optional .cerebroignore (same syntax) for excluding
heavy non-source dirs (backup/, **/uploads/, β¦) without touching your VCS
config. node_modules/, .next/, dist/, build/ are ignored by default.
Works on monorepos: index the whole thing at once (a single brain at the root,
with cross-package alias resolution) or per sub-app (CEREBRO_ROOT per package).
Register with Claude Code
claude mcp add cerebro -- uv --directory /path/to/cerebro run cerebroSet CEREBRO_ROOT to the project you want the brain to cover. See plugin/ for the
optional Claude Code plugin that auto-injects the map at session start and flags
edited files as stale.
Scope (MVP)
In: structural map, cached summaries, freshness, keyword search, tsconfig/jsconfig
alias resolution, .cerebroignore, batch summary warming (cerebro-summarize, via
headless claude -p β no API key), a decision log (cerebro_note /
cerebro_recall, surfaced at session start), and git-aware freshness
(cerebro_sync catches branch switch / pull / external edits across nested repos),
and optional local semantic search (cerebro-embed + --extra semantic: model2vec
embeddings β one vector per symbol β no torch, no API key, nothing leaves the
machine β cerebro_search becomes hybrid semantic + keyword and lands on the exact
symbol (path:line), not just the file), and visualizations (cerebro-graph β
self-contained interactive HTML dependency graph; cerebro-export-obsidian β an
Obsidian vault where imports are [[links]]), and architecture insights
(cerebro_impact transitive blast radius, cerebro_cycles circular imports,
cerebro_orphans dead-code candidates), and a symbol-level call graph
(cerebro_callers / cerebro_calls, tree-sitter name-resolved).
Deferred to v2: a live file watcher, and LSP-backed call graph for type-precise
resolution (the current call graph resolves by name).
License
MIT Β© 2026 Marco Toledo β see LICENSE.
Available Tools
16 toolscerebro_callersA
Find every call site of a function / method / class by NAME across the repo (symbol-level call graph; name-resolved, so it may include same-named symbols). Use to see who actually uses a symbol before you change it.
Inputs: name (required). Returns: result
cerebro_callsA
List the internal functions/methods a file calls β its outgoing call edges (name-resolved). External library calls are omitted.
Inputs: path (required). Returns: result
cerebro_cyclesA
Find circular import groups (files that mutually depend on each other) β an architecture smell worth breaking. Returns each cycle's members.
Inputs: no named parameters. Returns: result
cerebro_dead_symbolsA
List unused-export candidates: functions/classes/methods whose name is referenced nowhere in the indexed code, inside files that ARE imported (the symbol-level dead code that cerebro_orphans, which works per-file, can't see). Heuristic β confirm before deleting: dynamic access (obj['x'], string-based DI) and reflection can make a used symbol look dead.
Inputs: prefix. Returns: result
cerebro_endpointsA
Backend HTTP endpoints (NestJS routes) the project exposes β the frontβback
boundary that import edges miss. Search by path / method / handler (e.g.
'POST carts', 'promotions', 'findActive') to answer 'where is this endpoint
handled?' without grepping decorators.
Inputs: query. Returns: result
cerebro_getA
Everything Cerebro knows about a file WITHOUT reading it: cached summary (with staleness flag), defined symbols, and dependency edges.
Inputs: path (required). Returns: result
cerebro_impactA
Transitive blast radius: every file that directly OR indirectly imports
path. Use before changing a widely-used file to see what could break.
Inputs: path (required). Returns: result
cerebro_mapA
Cheap whole-project overview: file/language counts and the most important modules ranked by dependency centrality (PageRank). Call this FIRST in a new session instead of exploring folders.
Inputs: top. Returns: result
cerebro_noteA
Record a decision, domain rule, or gotcha β the why that reading code can
never recover (e.g. 'QR_MANUAL = merchant confirms payment by hand', 'Seller was
refactored to Organization'). Future sessions retrieve it with cerebro_recall.
Keep content to 1-3 sentences; topic is an optional short tag.
Inputs: content (required), topic. Returns: result
cerebro_orphansB
List code files that nothing imports β dead-code candidates. Framework entrypoints (modules, controllers, pages, configs, tests) are listed separately since they're loaded by convention, not by import.
Inputs: prefix. Returns: result
cerebro_recallA
Recall decisions/rules/gotchas recorded by past sessions BEFORE re-deriving them. Pass a query to search by meaning of topic/content, or leave empty for the most recent notes.
Inputs: limit, query. Returns: result
cerebro_recordB
Leave a trace: store your English understanding of a file so future sessions reuse it instead of re-analyzing. Write 1-3 dense sentences in English describing what the file does and its role.
Inputs: path (required), summary (required), model. Returns: result
cerebro_reindexA
Refresh the static index (symbols, dependency edges, hashes). Only
changed/new/deleted files are reprocessed. Pass paths to limit scope.
Inputs: paths. Returns: result
cerebro_searchA
Find relevant files. When the semantic index is built it ranks by meaning (intent), so phrase queries naturally ("where do we validate stock at checkout?"); it also includes keyword/symbol matches. Returns paths to cerebro_get().
Inputs: query (required), limit. Returns: result
cerebro_staleA
What the index no longer trusts: files changed/added/deleted on disk since the last reindex, plus summaries whose source file has changed.
Inputs: no named parameters. Returns: result
cerebro_syncA
Catch changes made outside Claude Code (branch switch, git pull, edits in the raw editor) and reindex only the affected files. Works across nested repos.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 16 tools
Each tool targets a clearly distinct aspect of code analysis: call sites, call edges, circular imports, dead symbols, endpoints, file info, impact analysis, project overview, note-taking, orphan files, recall, file recording, reindexing, search, stale index, and sync. Even similar tools like dead_symbols vs orphans and note vs record vs recall are differentiated by scope and purpose.
All tools follow a consistent 'cerebro_' prefix with snake_case naming (e.g., cerebro_callers, cerebro_dead_symbols). The second part is either a noun (callers, cycles) or a verb (get, search), maintaining a predictable pattern throughout.
With 16 tools, the server covers a comprehensive set of code intelligence operations without being overly numerous. Each tool serves a specific purpose in the workflow of understanding and navigating a large codebase, fitting well within the typical 3-15 range for focused servers.
The tool set covers core code analysis needs: dead code detection, call graphs, dependency analysis, search, project overview, and knowledge persistence. Minor gaps include lack of direct file content retrieval or file listing, but the server's focus on precomputed index data means these are reasonable omissions.
Maintenance
Related MCP Connectors
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Shared memory for coding agents. Stop re-explaining your codebase every session.
One shared project memory for your AI coding tools: recall, save and brief decisions anywhere.
The project brain for AI coding agents β memory, decisions, sprints, knowledge base via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI coding assistants with persistent project memory to retain architectural decisions, code patterns, and domain knowledge across sessions. It stores data locally in a SQLite database, allowing agents to remember, recall, and manage project-specific context using full-text search.3 npmApache 2.0
- AlicenseAqualityDmaintenanceProvides persistent cross-session memory and full-text search for AI coding assistants, storing project context, decisions, and preferences while enabling searchable access to conversation history via local SQLite.81MIT
- AlicenseAqualityBmaintenanceProvides AI coding assistants with persistent memory storage using a local SQLite database. Enables tools to remember project details, notes, and relationships across sessions to maintain context and reduce repetitive explanations.174MIT

nodespace-mcpofficial
AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to query a local knowledge base for persistent, searchable project context, reducing re-explanation and token usage.8Functional Source , Version 1.1, ALv2 Future