Stores and queries code graph representations with vector indexing, enabling graph traversal, relationship analysis, and semantic search across parsed TypeScript/NestJS codebases.
Provides deep understanding of NestJS architectural patterns including controllers, services, modules, dependency injection, HTTP endpoints, guards, pipes, and interceptors.
Generates embeddings for semantic code search, powers natural language to Cypher query conversion, and enables vector-based similarity matching for code discovery.
Parses TypeScript projects using AST analysis to extract code entities, relationships, and framework patterns for graph-based code understanding.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Code Graph Contextfind all services that depend on the UserRepository"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Code Graph Context
Give your AI coding assistant a photographic memory of your codebase.
Code Graph Context is an MCP server that builds a semantic graph of your TypeScript codebase, enabling Claude to understand not just individual files, but how your entire system fits together.
Config-Driven & Extensible: Define custom framework schemas to capture domain-specific patterns beyond the included NestJS support. The parser is fully configurable to recognize your architectural patterns, decorators, and relationships.
Why Code Graph Context?
Without Code Graph | With Code Graph |
Claude reads files one at a time | Claude understands the entire dependency tree |
"What uses this?" requires manual searching | Instant impact analysis with risk scoring |
Refactoring misses edge cases | Graph traversal finds every reference |
Large codebases overwhelm context | Semantic search finds exactly what's relevant |
Multi-file changes are error-prone | Swarm agents coordinate parallel changes |
Features
Multi-Project Support: Parse and query multiple projects in a single database with complete isolation
Semantic Search: Vector-based search using OpenAI embeddings to find relevant code
Natural Language Querying: Convert questions into Cypher queries
Framework-Aware: Built-in NestJS schema with ability to define custom framework patterns
Weighted Graph Traversal: Intelligent traversal scoring paths by importance and relevance
Workspace Support: Auto-detects Nx, Turborepo, pnpm, Yarn, and npm workspaces
Parallel & Async Parsing: Multi-threaded parsing with Worker threads for large codebases
Streaming Import: Chunked processing for projects with 100+ files
Incremental Parsing: Only reparse changed files
File Watching: Real-time graph updates on file changes
Impact Analysis: Assess refactoring risk (LOW/MEDIUM/HIGH/CRITICAL)
Dead Code Detection: Find unreferenced exports with confidence scoring
Duplicate Detection: Structural (AST hash) and semantic (embedding similarity) duplicates
Swarm Coordination: Multi-agent stigmergic coordination with pheromone decay
Architecture
Core Components:
src/core/parsers/typescript-parser.ts- AST parsing with ts-morphsrc/storage/neo4j/neo4j.service.ts- Graph storage and queriessrc/core/embeddings/embeddings.service.ts- OpenAI embeddingssrc/mcp/mcp.server.ts- MCP server and tool registration
Dual-Schema System:
Core Schema: AST-level nodes (ClassDeclaration, MethodDeclaration, ImportDeclaration, etc.)
Framework Schema: Semantic interpretation (NestController, NestService, HttpEndpoint, etc.)
Nodes have both coreType (AST) and semanticType (framework meaning), enabling queries like "find all controllers" while maintaining AST precision.
Quick Start
Prerequisites
Node.js >= 18
Docker (for Neo4j)
OpenAI API Key
1. Install
2. Configure Claude Code
Add to Claude Code with your OpenAI API key:
That's it. Restart Claude Code and you're ready to go.
3. Parse Your Project
In Claude Code, say:
"Parse this project and build the code graph"
Claude will run parse_typescript_project and index your codebase.
Configuration Files
Claude Code stores MCP server configs in JSON files. The location depends on scope:
Scope | File | Use Case |
User (global) |
| Available in all projects |
Project |
| Project-specific config |
Local |
| Git-ignored local overrides |
Manual Configuration
If you prefer to edit the config files directly:
~/.claude.json (user scope - recommended):
From source installation:
Environment Variables
Variable | Required | Default | Description |
| Yes | - | For embeddings and NL queries |
| No |
| Neo4j connection URI |
| No |
| Neo4j username |
| No |
| Neo4j password |
Core Capabilities
Semantic Code Search
Find code by describing what you need, not by memorizing file paths:
Impact Analysis
Before you refactor, understand the blast radius:
Graph Traversal
Explore relationships in any direction:
Dead Code Detection
Find code that can be safely removed:
Duplicate Code Detection
Identify DRY violations across your codebase:
Swarm Coordination
Execute complex, multi-file changes with parallel AI agents.
The swarm system enables multiple Claude agents to work on your codebase simultaneously, coordinating through the code graph without stepping on each other.
Two Coordination Mechanisms
1. Pheromone System (Stigmergic)
Agents leave markers on code nodes that decay over time—like ants leaving scent trails:
Pheromone | Half-Life | Meaning |
| 2 min | "I'm looking at this" |
| 1 hour | "This is my territory" |
| 10 min | "I'm actively changing this" |
| 24 hours | "I finished work here" |
| Never | "Don't touch this" |
| 5 min | "I'm stuck" |
Self-healing: If an agent crashes, its pheromones decay and the work becomes available again.
2. Task Queue (Blackboard)
Explicit task management with dependencies:
Swarm Tools
Tool | Purpose |
| Decompose a task and spawn worker agents |
| Add a task to the queue |
| Query tasks with filters |
| Claim/start/release a task |
| Complete/fail/request review |
| Leave a marker on a code node |
| Query what other agents are doing |
| Remove pheromones after completion |
Example: Parallel Refactoring
Install the Swarm Skill
For optimal swarm execution, install the included Claude Code skill that teaches agents the coordination protocol:
Or for a specific project:
The skill provides:
Worker agent protocol with step-by-step workflow
Multi-phase orchestration patterns (discovery, contracts, implementation, validation)
Common failure modes and how to prevent them
Complete tool reference
Once installed, just say "swarm" or "parallel agents" and Claude will use the skill automatically.
See skills/swarm/SKILL.md for the full documentation.
All Tools
Tool | Description |
Discovery | |
| List parsed projects in the database |
| Semantic search using vector embeddings |
| Explore relationships from a node |
| Convert questions to Cypher queries |
Analysis | |
| Assess refactoring risk (LOW/MEDIUM/HIGH/CRITICAL) |
| Find unreferenced exports and methods |
| Find structural and semantic duplicates |
Parsing | |
| Build the graph from source |
| Monitor async parsing jobs |
| Auto-update graph on file changes |
| Stop file watching |
| List active file watchers |
Swarm | |
| Plan and spawn parallel agents |
| Add task to the queue |
| Query tasks |
| Claim/start/release tasks |
| Complete/fail/review tasks |
| Leave coordination markers |
| Query what others are doing |
| Clean up after swarm completion |
Utility | |
| Verify database connectivity |
Tool Workflow Patterns
Pattern 1: Discovery → Focus → Deep Dive
Pattern 2: Pre-Refactoring Safety
Pattern 3: Code Health Audit
Pattern 4: Multi-Agent Work
Multi-Project Support
All query tools require projectId for isolation. You can use:
Project ID:
proj_a1b2c3d4e5f6(auto-generated)Project name:
my-backend(from package.json)Project path:
/path/to/project(resolved automatically)
Framework Support
NestJS (Built-in)
Deep understanding of NestJS patterns:
Controllers with route analysis (
@Controller,@Get,@Post, etc.)Services with dependency injection mapping (
@Injectable)Modules with import/export relationships (
@Module)Guards, Pipes, Interceptors as middleware chains
DTOs with validation decorators (
@IsString,@IsEmail, etc.)Entities with TypeORM relationship mapping
NestJS-Specific Relationships:
INJECTS- Dependency injectionEXPOSES- Controller exposes HTTP endpointMODULE_IMPORTS,MODULE_PROVIDES,MODULE_EXPORTS- Module systemGUARDED_BY,TRANSFORMED_BY,INTERCEPTED_BY- Middleware
Custom Framework Schemas
The parser is config-driven. Define your own framework patterns:
The dual-schema system means every node has:
coreType: AST-level (ClassDeclaration, FunctionDeclaration)semanticType: Framework meaning (NestController, ReactHook)
This enables queries like "find all hooks that use context" while maintaining AST precision for refactoring.
Troubleshooting
MCP Server Not Connecting
Missing OPENAI_API_KEY
Symptoms: "Failed to generate embedding" errors
Fix: Ensure the key is in your config file:
Neo4j Memory Issues
For large codebases, increase memory limits:
Parsing Timeouts
Use async mode for large projects:
CLI Commands
Init options:
-p, --port <port>- Bolt port (default: 7687)--http-port <port>- Browser port (default: 7474)--password <password>- Neo4j password (default: PASSWORD)-m, --memory <size>- Heap memory (default: 2G)-f, --force- Recreate container
Contributing
Conventional Commits: feat|fix|docs|refactor(scope): description
License
MIT - see LICENSE