code-context-mcp
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.
code-context-mcp
MCP server for semantic code search and dependency graph analysis. Indexes codebases into a knowledge graph (Apache AGE) with vector embeddings (pgvector + Ollama) for AI-powered code understanding.
Supported Languages
TypeScript (
.ts,.tsx) — functions, classes, types, interfaces, importsRust (
.rs) — functions, structs, enums, traits, impl blocks, modules, use declarationsSolidity (
.sol) — contracts, functions, events, modifiers, structs, enums, interfaces, importsC - functions, enums
Related MCP server: code-graph-mcp
Prerequisites
Docker and Docker Compose
Node.js >= 18
Quick Start
# Start PostgreSQL (with AGE + pgvector) and Ollama
docker-compose up -d
# Install dependencies and build
npm install
npm run buildIndexing a Codebase
# Index a directory (project name auto-derived from directory basename)
node dist/cli/index.js index ./src
# Override the project name
node dist/cli/index.js index ./src --project my-project
# Index multiple codebases
node dist/cli/index.js index /path/to/frontend --project frontend
node dist/cli/index.js index /path/to/backend --project backendThe indexer will:
Parse all supported source files (TypeScript, Rust, Solidity) using tree-sitter
Build a code graph with functions, classes, types, contracts, traits, and their relationships
Generate vector embeddings for semantic search via Ollama
Show a progress bar during indexing
Re-running the indexer on the same directory skips unchanged files (detected via content hash).
Claude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"code-context": {
"command": "node",
"args": ["dist/mcp/server.js"],
"cwd": "/path/to/code-context-mcp",
"env": {
"PGHOST": "localhost",
"PGPORT": "5433",
"PGDATABASE": "rag_db",
"PGUSER": "postgres",
"PGPASSWORD": "postgres",
"OLLAMA_URL": "http://localhost:11434"
}
}
}
}MCP Tools
list_projects
List all indexed projects and their node counts.
Parameters: none
search_code
Semantic search across the indexed codebase. Finds functions, classes, types, and imports by meaning.
Parameter | Type | Required | Description |
| string | yes | Natural language search query |
| number | no | Maximum results (default: 10) |
| string | no | Scope search to a project |
get_call_stack
Trace the call dependency tree from a function.
Parameter | Type | Required | Description |
| string | yes | Function to trace from |
| number | no | Max traversal depth, 1-10 (default: 3) |
| string | no | Scope to a project |
get_function_context
Gather full context for a function: callers, callees, types it uses.
Parameter | Type | Required | Description |
| string | yes | Function to get context for |
| string | no | Scope to a project |
get_impact_analysis
Analyze impact of changes to a file. Shows all external code that depends on definitions in the file.
Parameter | Type | Required | Description |
| string | yes | Relative path of the file (as indexed) |
| string | no | Scope to a project |
Environment Variables
Variable | Default | Description |
|
| PostgreSQL host |
|
| PostgreSQL port |
|
| Database name |
|
| Database user |
|
| Database password |
|
| Ollama API endpoint |
Testing
Unit Tests
Unit tests run without Docker and cover extractors, scanner, registry, progress bar, embeddings, and DB queries.
npm test # Run all unit tests
npm run test:watch # Watch modeIntegration Tests
Integration tests require separate Docker containers to avoid interfering with development data.
# Start test infrastructure (separate ports: PG=5434, Ollama=11435)
docker compose -f docker-compose.test.yml up -d
# Run integration tests
npm run test:integrationIntegration tests cover the full indexing pipeline and multi-language graph population.
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
Repository knowledge graph MCP server for codebase understanding and debugging.
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that transforms codebases into intelligent, queryable knowledge bases, enabling AI assistants to perform semantic search, explore architecture, and analyze code relationships.166-
- AlicenseNot gradedqualityAmaintenanceA high-performance code knowledge graph server implementing MCP, indexing codebases into a structured AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing.3,102 npm96MIT
- AlicenseAqualityDmaintenanceMCP server for semantic code search that indexes your codebase and allows AI editors to search using natural language queries.99 npm52MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for AI coding agents that builds a complete code structure graph and semantic vector index, enabling fast querying of code entities, relationships, and impact analysis.23 npm11-