How to Configure Codebase-Memory-MCP: From Zero to Production
Codebase-Memory-MCP requires zero mandatory configuration—install the binary and optionally register it with your agent's MCP config file to enable 14 code‑intelligence tools.
The DeusData/codebase-memory-mcp repository provides a fully functional MCP server that works immediately after installation. While the binary operates out-of-the-box, you can customize its behavior through environment variables, agent-specific JSON configurations, and project-level settings. This guide covers every configuration layer from basic installation to advanced tuning.
Installation and Basic Setup
Download and Install the Binary
Install the server using the official installer script, which validates checksums and writes the binary to your system path. The installation requires no external dependencies or API keys.
# Install the standard binary
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
The installer script (scripts/install.sh) handles platform detection, checksum verification, and can optionally create default MCP configuration files. After installation, the codebase-memory-mcp command is available globally.
Configure Codebase-Memory-MCP for Your Agent
To enable your coding agent to discover the 14 available tools—including index_repository, search_graph, and query_semantic—you must register the server in your agent's MCP configuration.
Claude Code Configuration
For Claude Code, create or edit the .mcp.json file in your global configuration directory:
cat <<EOF > ~/.claude/.mcp.json
{
"mcpServers": {
"codebase-memory-mcp": {
"command": "/usr/local/bin/codebase-memory-mcp",
"args": []
}
}
}
EOF
VS Code and Other Editors
VS Code users should add the server to settings.json under the mcpServers key. Other agents follow similar patterns, requiring only the absolute path to the binary and optional arguments array.
Optional Environment Variables
Control runtime behavior through five documented environment variables. These settings are processed in src/cli/cli.c and apply globally across all projects.
- CBM_CACHE_DIR: Override the default SQLite graph storage location (defaults to system cache directory)
- CBM_LOG_LEVEL: Adjust verbosity from
errortotracefor debugging - CBM_WORKERS: Limit parallel indexing workers to manage CPU usage
- CBM_DOWNLOAD_URL: Specify an alternate endpoint for binary updates
- CBM_DIAGNOSTICS: Enable verbose diagnostic output for troubleshooting
# Use custom cache location and increase logging
export CBM_CACHE_DIR=$HOME/.my-cbm-cache
export CBM_LOG_LEVEL=debug
codebase-memory-mcp config list # Verify settings
Advanced Configuration Options
Enable Auto-Indexing
Automatically index new projects when an agent first connects by using the CLI configuration API. This creates a background watcher that monitors file changes without manual intervention.
codebase-memory-mcp config set auto_index true
codebase-memory-mcp config set auto_index_limit 50000 # Max files per project
The auto-index logic is implemented in src/cli/cli.c alongside the environment variable handlers.
Ignore Patterns with .cbmignore
Prevent unwanted files from cluttering the semantic graph by creating a .cbmignore file in your project root. The ignore chain follows this precedence: hard-coded defaults → .gitignore → .cbmignore.
Common patterns to exclude:
node_modules/dist/andbuild/directories- Generated assets (
*.min.js,*.css.map)
Custom File Extensions
Map non-standard extensions to supported languages using either per-project .codebase-memory.json files or the global config at ~/.config/codebase-memory-mcp/config.json. This ensures files like .blade.php or .mjs receive proper parsing and semantic analysis.
Summary
- Zero configuration required: Install the binary and run immediately without API keys or external services.
- Agent registration: Add one JSON entry to
.mcp.json(Claude Code) orsettings.json(VS Code) to enable 14 MCP tools. - Environment tuning: Use
CBM_CACHE_DIR,CBM_LOG_LEVEL, andCBM_WORKERSto control storage, logging, and performance. - Project customization: Enable auto-indexing, configure
.cbmignorepatterns, and define custom file extensions for specialized workflows.
Frequently Asked Questions
Does Codebase-Memory-MCP require an API key?
No. The binary operates entirely client-side using local SQLite storage for the semantic graph. No external API keys, cloud services, or network authentication are required for core functionality.
Where is the SQLite graph database stored?
By default, the graph database stores in your system cache directory. Override this location by setting the CBM_CACHE_DIR environment variable before starting the server, or verify the current path using codebase-memory-mcp config list.
How do I ignore node_modules and build directories?
Create a .cbmignore file in your project root and list patterns exactly as you would in .gitignore. The system automatically respects .gitignore first, then applies your .cbmignore rules, ensuring generated assets and dependencies never enter the code graph.
Can I use Codebase-Memory-MCP with Python projects?
Yes. The repository includes Python package instructions in pkg/pypi/README.md for pip-based installation. All configuration options—environment variables, ignore patterns, and custom extensions—apply identically whether you install via the shell script or the Python package.
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 →