mcp-codebase-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-codebase-server
A security-first MCP (Model Context Protocol) server for C++ monorepos. Gives Claude Desktop and VS Code deep codebase awareness — symbol search, impact analysis, branch diff review, linting, and format checking — without ever sending raw source code to external AI.
Security Guarantees
Guarantee | How |
Zero code egress | Raw source code never leaves your machine |
Pre-index secret scrubbing | Known secret patterns redacted before SQLite index |
Structured metadata only | AI receives symbol graphs, signatures, dependency maps — never file contents |
Output validation | Every tool response is scanned before returning — defence in depth |
LDAP identity binding | Every tool call stamped with developer identity (or OS username in degraded mode) |
stdio transport | Zero inbound network ports |
Related MCP server: claude-context-local
Prerequisites
Requirement | Notes |
Node.js 20+ | Required for |
C++ monorepo on disk | Set |
Docker (optional) | Required only for |
clang-format (optional) | Required only for |
Quick Start
# 1. Install dependencies
npm install
# 2. Copy and edit the environment file
cp .env.example .env
# Edit .env — at minimum set REPO_PATH=/absolute/path/to/your/monorepo
# 3. Build
npm run build
# 4. Index the codebase (first time, and after large changes)
npm run index
# 5. Start the server
npm start
# Should print: [server] mcp-codebase-server v0.1.0 readyEnvironment Configuration (.env)
# REQUIRED
REPO_PATH=/absolute/path/to/your/monorepo
# Optional overrides
# INDEX_DB_PATH=$HOME/.mcp-server/index.db
# AUDIT_LOG_DIR=$HOME/.mcp-server/audit
# LOG_LEVEL=info
# Docker — required for run_linter (clang-tidy)
DOCKER_CONTAINER=your-build-container-name
COMPILE_COMMANDS_PATH=/container/path/to/compile_commands.json
CONTAINER_REPO_PATH=/container/path/to/repo
CLANG_TIDY_BIN=/usr/lib/llvm-17/bin/clang-tidy # full path if not on container PATH
# Host clang-format — required for format_check
CLANG_FORMAT_BIN=/opt/homebrew/bin/clang-format # brew install clang-format
# LDAP / Active Directory (leave blank for OS-username fallback)
# LDAP_URL=ldap://ldap.yourcompany.com:389
# LDAP_BASE_DN=dc=yourcompany,dc=com
# LDAP_BIND_DN=cn=mcp-service,ou=serviceaccounts,dc=yourcompany,dc=com
# LDAP_BIND_PASSWORD=Connecting to Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"codebase": {
"command": "node",
"args": [
"--env-file=/absolute/path/to/mcp-codebase-server/.env",
"/absolute/path/to/mcp-codebase-server/dist/index.js"
]
}
}
}Restart Claude Desktop. The 8 codebase tools will appear in the tool list.
Connecting to VS Code (Cline / Continue)
Add to .vscode/mcp.json in your workspace:
{
"servers": {
"codebase": {
"type": "stdio",
"command": "node",
"args": [
"--env-file=/path/to/mcp-codebase-server/.env",
"/path/to/mcp-codebase-server/dist/index.js"
]
}
}
}Available Tools (8 total)
Navigation & Search
Tool | What it returns |
| Ranked list of symbols matching a name, concept, or keyword. Never raw code. |
| Full structural profile: location, signature, includes, sibling symbols, complexity. |
| Everything a file defines + what it includes + git change history + architectural role. |
| Index health: symbol count, file count, CMake targets, include edges. Call first if results seem incomplete. |
Impact Analysis
Tool | What it returns |
| Given a file or symbol: all files that need recompilation, affected CMake targets, risk level (low/medium/high/critical), test suites to run. |
| Given a branch name: all changed files with their symbols, aggregate blast radius, risk level, and test suites. Essential before code review or merge. |
Code Quality
Tool | What it returns |
| Runs clang-tidy inside the build container. Returns structured findings (file, line, severity, rule, message). Never raw code. Requires Docker. |
| Runs clang-format |
Typical Workflow
1. diff_review branch=feature/my-branch
→ Lists changed files + symbols + risk level
2. blast_radius file=src/core/MyChangedHeader.hpp
→ Shows full recompilation impact
3. run_linter files=[changed files from step 1]
→ Checks for clang-tidy issues
4. format_check files=[changed files from step 1]
→ Confirms formatting is clean before mergeIndexer
The indexer uses tree-sitter for AST-accurate C++ symbol extraction:
Functions, methods (including qualified
Foo::bar()), constructors, destructorsOperator overloads (
operator==,operator[])Template functions and class templates
Classes, structs, enums
Namespace context preserved
Run the indexer:
npm run index # indexes REPO_PATH from .envRebuild after large file additions/deletions:
rm ~/.mcp-server/index.db && npm run indexThe index also builds:
Include graph — transitive
#includedependency map (used byblast_radius)CMake target map — which targets own which files (used by
blast_radiusanddiff_review)
Secret Scrubbing
Secrets are redacted before indexing — they never enter the SQLite database.
Redacted patterns include:
PEM private keys
API keys and auth tokens
Hardcoded passwords
Internal IP addresses
Flask / Django secret keys
Base64-encoded credentials
All redacted values are replaced with [REDACTED:<type>] in signatures.
Audit Logs
Every tool call is logged to ~/.mcp-server/audit/YYYY-MM-DD.jsonl.
Each entry contains: timestamp, session ID, developer identity, tool name, query, files accessed, result count, duration.
Logs never contain: raw code, secret values, or file contents.
Project Structure
mcp-codebase-server/
├── src/
│ ├── index.ts # Entry point — boots server, registers all 8 tools
│ ├── config/
│ │ └── config.ts # Zod-validated config from env vars + ~/.mcp-server/config.json
│ ├── audit/
│ │ └── audit-logger.ts # Structured JSONL audit logging (never logs code)
│ ├── security/
│ │ ├── secret-scrubber.ts # Pre-index secret redaction pipeline
│ │ ├── output-validator.ts # Post-response secret pattern scanner
│ │ └── ldap-identity.ts # LDAP developer identity (OS username fallback)
│ ├── indexer/
│ │ ├── cpp-indexer.ts # tree-sitter AST C++ parser → SQLite symbol index
│ │ ├── include-graph.ts # #include transitive dependency graph
│ │ ├── cmake-parser.ts # CMakeLists.txt target → file mapping
│ │ └── index-runner.ts # CLI entry point for npm run index
│ └── tools/
│ ├── search-code.ts # search_code
│ ├── get-symbol.ts # get_symbol
│ ├── explain-file.ts # explain_file
│ ├── index-stats.ts # index_stats
│ ├── blast-radius.ts # blast_radius
│ ├── diff-review.ts # diff_review
│ ├── run-linter.ts # run_linter (clang-tidy via Docker)
│ └── format-check.ts # format_check (clang-format on host)
├── scripts/
│ ├── verify-blast-radius.ts
│ ├── verify-diff-review.ts
│ ├── verify-run-linter.ts
│ ├── verify-run-linter-live.ts
│ └── verify-format-check.ts
├── .env.example # Template — copy to .env and fill in
├── package.json
└── tsconfig.jsonRoadmap
Phase | Status | Items |
Phase 1 | ✅ Complete | Symbol index, code search, file explanation, secret scrubbing, LDAP audit |
Phase 2 | ✅ Complete | tree-sitter parser, include graph, CMake map, blast_radius, diff_review, run_linter, format_check |
Phase 3 | Planned | Mermaid diagram generation (include graph, CMake targets, C4 architecture) |
Phase 4 | Planned | Convention registry, project memory, git history context |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Every employee asks your codebase from Claude, without access to it. Statistics on each developer.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides semantic code intelligence to help users search, navigate, and analyze entire codebases using plain English. It enables Claude to perform architectural overviews, bug detection, and refactor suggestions through local semantic search and keyword indexing.MIT
- AlicenseNot gradedqualityDmaintenanceProvides Claude Code with local semantic search and indexing of your codebase using AST-aware chunking and hybrid search, enabling deep code understanding without sending data to the cloud.56 PyPIMIT
- FlicenseNot gradedqualityCmaintenanceProvides precise C++ code semantic analysis for AI coding tools like Claude Code and Cursor by integrating clangd static analysis, enabling symbol definition lookup, reference tracking, and hover information.1-
- AlicenseAqualityBmaintenanceEnables Claude and Claude Code to scan local repositories, generate interactive architecture maps, and trace transitive callers to assess change impact.359 npm1MIT