State Memory MCP
Local SQLite graph of tasks, decisions and blockers that coding assistants keep across sessions
Builds a local graph of a codebase so an agent can query calls, routes, change impact and code.
By Martin Vogel (individual) Local · stdio Developer toolsKnowledge and memory
77 popularity score ★ 48k ↓ 16k/wk
Opens the app, which asks before it adds the server.
claude mcp add codebase-memory -- npx -y codebase-memory-mcp{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}[mcp_servers.codebase-memory]
command = "npx"
args = ["-y", "codebase-memory-mcp"]gemini mcp add --scope user codebase-memory npx -- -y codebase-memory-mcpOpens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.
git clone https://github.com/DeusData/codebase-memory-mcp.git
cd codebase-memory-mcp
scripts/build.sh --with-uiclaude mcp add codebase-memory -- '<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp'{
"mcpServers": {
"codebase-memory": {
"command": "<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp",
"args": []
}
}
}{
"mcpServers": {
"codebase-memory": {
"command": "<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp",
"args": []
}
}
}{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp",
"args": []
}
}
}[mcp_servers.codebase-memory]
command = "<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp"
args = []gemini mcp add --scope user codebase-memory '<ABSOLUTE_PATH_TO_CLONE>/build/c/codebase-memory-mcp'CBM_DOWNLOAD_URL |
Optional: Base address the npm package fetches the binary and checksums from. Must be https, or plain http to localhost. |
|---|
Indexes a repository into a graph of functions, classes, calls, HTTP routes and links between services, so a coding agent asks one structural question where it would otherwise grep and open files for many rounds. The parser covers 162 languages through tree-sitter grammars built into the program, and some of the main ones get extra type resolution on top.
The graph lives in SQLite files under ~/.cache/codebase-memory-mcp unless CBM_CACHE_DIR points elsewhere. On first use a background daemon starts for your account and is shared by every session after that. Indexing runs when the agent asks for it. Turn on auto_index and it also happens at session start, after which a watcher keeps watched git projects in sync. There is an optional graph viewer for the browser too, called CBM Lens, still in beta.
You can narrow what a client sees. Started with --tool-profile analysis it offers 13 read-only tools, and --tool-profile scout trims that to 8. In both cases the HTTP side stays off, because the source lets only the full profile serve it (src/mcp/mcp.c at the published tag). Log output can also be switched to JSON with CBM_LOG_FORMAT=json, a setting read in src/foundation/log.c that the README table does not list.
| Runtime | A prebuilt binary |
|---|---|
| Runs on | macOS, Windows, Linux |
The npm way needs Node.js 18 or later, which downloads, checks and starts the native binary for macOS, Linux or Windows on arm64 or amd64. The install script and the source build give a standalone executable instead. After any of them, `codebase-memory-mcp install` writes the config for the agents it finds. In Claude Code you can add just the server with `claude plugin marketplace add DeusData/codebase-memory-mcp` and `claude plugin install codebase-memory@codebase-memory`.
A good fit when you work in a large or multi-language codebase on your own machine and want the agent to answer questions about calls, impact and structure without reading file after file. Nothing has to leave the machine and no key is needed. If a client should only look and never change the index, start it with --tool-profile analysis. For a small project, plain file search in your agent may be enough, since the graph has to be built before it pays off.
13 only read, 1 changes things, 3 can delete or overwrite. A ? marks an optional parameter.
index_repository changesrepo_path: stringmode?: enumtarget_projects?: arrayname?: stringpersistence?: booleandoc_candidates?: booleanasync?: booleanstatus?: booleanlist_projectsdetail?: enumlimit?: integerdelete_project deletesproject: stringindex_statusproject: stringdiagnostics?: stringcheck_index_coverageproject: stringpaths?: arrayscopes?: arraysearch_graphproject: stringquery?: stringlabel?: stringname_pattern?: stringqn_pattern?: stringfile_pattern?: stringsemantic_query?: arraylimit?: integeroffset?: integerquery_graphquery: stringproject: stringgraph?: enummax_rows?: integercursor?: stringformat?: stringtrace_pathfunction_name: stringproject: stringdirection?: stringdepth?: integerlimit?: integermode?: enuminclude_tests?: booleanget_code_snippetqualified_name: stringproject: stringsource_mode?: enummax_lines?: integerget_file_outlineproject: stringfile_path: stringlimit?: integerget_graph_schemaproject: stringdiagnostics?: enumcompare_graphsbase_project: stringtarget_project: stringlimit?: integerget_architectureproject: stringpath?: stringaspects?: arraysearch_codepattern: stringproject: stringmode?: enumregex?: booleanlimit?: integerdetect_changesproject: stringscope?: enumdepth?: integerbase_branch?: stringsince?: stringmanage_adr deletesproject: stringmode?: enumcontent?: stringsection_updates?: objectingest_traces deletestraces: arrayproject: stringlabel?: string