How to Integrate Codebase Memory MCP with Claude, VS Code, and CI Pipelines
Integrating Codebase Memory MCP requires installing the binary via the setup script, registering the server definition in your client's MCP configuration file, and invoking tools through the agent surface, CLI commands, or JSON-RPC interface.
Codebase Memory MCP (Multi-Client Platform) from the DeusData/codebase-memory-mcp repository is a static-analysis engine that constructs a knowledge graph of your repository and exposes it through a standardized tool interface. This guide demonstrates how to connect codebase memory MCP to Claude Code, VS Code Copilot, continuous integration pipelines, and custom IDE plugins.
Installation and Auto-Configuration
The integration begins with the one-line installer that handles binary deployment and client registration automatically. According to the README.md quick-start guide, running the setup script downloads the appropriate binary and executes the install command, which scans your system for supported agents and writes server entries to their respective configuration files.
The installer performs three critical actions:
- Detects agents: Identifies installed clients including Claude Code, Codex CLI, and VS Code
- Writes server entries: Inserts JSON snippets like
{ "command": "/usr/local/bin/codebase-memory-mcp", "args": [] }into agent-specific MCP config files such as~/.claude.json,~/.codeclimate/config.toml, or VS Code'sCode/User/mcp.json - Optional UI deployment: The
--uiflag bundles the 3-D graph visualization interface and launcheslocalhost:9749immediately after configuration
For manual configuration without the installer, add the server definition to a global or project-local .mcp.json file, or place it directly in your agent's specific configuration as documented in the repository's README.md.
Configuring Client Surfaces
Each supported client receives a specialized surface that maps MCP tools to native commands. The README.md multi-agent support section details how the installer creates distinct integration layers:
Claude Code receives three skill tiers (Scout, Verify, Auditor) that expose the full set of 15 MCP tools including trace_path, search_graph, and get_architecture.
VS Code (Copilot) reads the server entry from Code/User/mcp.json to enable graph-aware suggestions directly in the editor.
CLI-only mode operates without the coordination daemon, making it safe for scripts and CI pipelines. This mode bypasses the exact-build admission lease enforcement used for interactive sessions.
Invoking MCP Tools: Three Integration Patterns
Codebase Memory MCP exposes its graph-query capabilities through three distinct mechanisms, as implemented in the README.md how-it-works and CLI mode sections:
Agent Surface
Send natural-language requests to your AI agent, which translates them into structured tool calls. For example, asking "What calls ProcessOrder?" triggers trace_path(function_name="ProcessOrder", direction="inbound").
Command-Line Interface
Use codebase-memory-mcp cli <tool> for scripted operations. The README.md CLI mode documentation shows this pattern:
# Index a repository before querying
codebase-memory-mcp cli index_repository --repo-path $PWD
# Search for functions matching a pattern
codebase-memory-mcp cli search_graph \
--project myproject \
--label Function \
--name-pattern ".*Handler.*"
JSON-RPC Interface
Send requests over stdin/stdout to the running server using standard JSON-RPC format:
{"method":"search_graph","params":{"label":"Function","name_pattern":"User.*"}}
Note that most tools are read-only except index_repository, delete_project, and manage_adr, which mutate the graph. The daemon enforces an exact-build admission lease to prevent cache corruption from mismatched binary versions.
Environment Configuration and Extensibility
Fine-tune the integration using environment variables defined in docs/CONFIGURATION.md and supported by the internal/cbm/zstd_store.c compression layer:
- Set
CBM_CACHE_DIRto relocate the SQLite graph store - Enable
CBM_DIAGNOSTICS=1for detailed performance profiling - Use
.codebase-memory.jsonat the project level to add custom file-extension mappings for non-standard source files
The hybrid LSP integration provides semantic type resolution for 158 languages, enabling cross-module call resolution that goes beyond basic text search.
CI Pipeline and IDE Integration Examples
GitHub Actions Integration
Add automated dead-code detection to your pull request workflow:
name: Codebase Memory Checks
on: [push, pull_request]
jobs:
mcp-index:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install MCP headless binary
run: |
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup.sh | bash
- name: Index repository
run: codebase-memory-mcp cli index_repository --repo-path $PWD
- name: Detect unused functions
run: |
PROJECT=$(codebase-memory-mcp cli list_projects | jq -r .projects[0].name)
codebase-memory-mcp cli search_graph \
--project "$PROJECT" \
--label Function \
--where "NOT EXISTS { (f)<-[:CALLS]-() }" \
--output json | jq .
This pipeline leverages the search_graph tool with Cypher-style queries to identify functions lacking incoming CALLS edges, as documented in the README.md dead-code detection section.
Custom IDE Plugin Integration
Extend any editor with graph-aware capabilities using subprocess calls:
import json
import subprocess
def query_codebase_graph(project: str, cypher: str):
"""Query the MCP graph from an IDE plugin."""
proc = subprocess.Popen(
["codebase-memory-mcp", "cli", "query_graph", "--project", project],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True
)
stdout, _ = proc.communicate(json.dumps({"query": cypher}))
return json.loads(stdout)
# Find HTTP routes calling legacy endpoints
results = query_codebase_graph(
project="my-service",
cypher="""
MATCH (r:Route)-[:CALLS]->(f:Function)
WHERE f.name CONTAINS "Legacy"
RETURN r.path, f.name
"""
)
Interactive 3-D Graph Visualization
For exploratory analysis, launch the UI variant:
# Start the visualization server (requires --ui flag during install)
codebase-memory-mcp --ui=true --port=9749 &
# Open browser interface
open http://localhost:9749
The UI connects to the shared daemon managed by graph-ui/package.json entry points, rendering the knowledge graph in 3-D with interactive node inspection and context-menu tool invocation.
Summary
- Install the binary using
scripts/setup.sh(macOS/Linux) orscripts/setup-windows.ps1(Windows) to auto-configure client surfaces - Configure server entries in
~/.claude.json,Code/User/mcp.json, or.mcp.jsonto register the MCP with Claude Code, VS Code, or other agents - Invoke tools via natural language (agent surface), CLI commands like
codebase-memory-mcp cli search_graph, or JSON-RPC over stdin/stdout - Secure CI pipelines using CLI-only mode which bypasses the daemon and exact-build admission lease requirements
- Extend functionality through
docs/CONFIGURATION.mdoptions,.codebase-memory.jsonproject settings, and the hybrid LSP supporting 158 languages
Frequently Asked Questions
Can I use Codebase Memory MCP without installing the auto-configuration script?
Yes. Manual configuration simply requires adding the server definition to your client's MCP configuration file. According to the README.md manual configuration section, create or edit .mcp.json in your project root or agent configuration directory, specifying the command path to the codebase-memory-mcp binary and any required arguments.
How do I prevent the MCP daemon from locking my cache in CI environments?
Use CLI-only mode by invoking codebase-memory-mcp cli <tool> directly. As documented in the README.md CLI mode section, this mode does not start the coordination daemon and therefore avoids the exact-build admission lease enforcement, making it safe for parallel CI jobs and ephemeral containers.
What is the performance impact of the knowledge graph storage?
The system uses ZSTD compression via internal/cbm/zstd_store.c to minimize the SQLite store footprint. You can further optimize by setting CBM_CACHE_DIR to fast SSD storage or using CBM_DIAGNOSTICS=1 to profile bottlenecks. The graph supports 158 languages through the hybrid LSP without requiring full builds or index locks during queries.
Can I query the graph using custom Cypher queries from external tools?
Yes. Through the JSON-RPC interface or CLI query_graph command, you can send arbitrary Cypher queries to the knowledge graph. The README.md demonstrates this pattern for dead-code detection, and you can extend it to custom analysis by connecting any subprocess-capable language (Python, Node.js, Go) to the MCP binary's stdin/stdout interface.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →