Agenten stärken
Der eigene Befehl des Herausgebers. Kein PlugMCP-Endpunkt.
Host a copy with our keys and logs.
npx -y [email protected]Claude Code hat keinen Installationslink für einen lokalen Befehl. Kopieren Sie den Befehl unten und führen Sie ihn in einem Terminal aus.
claude mcp add andrew-hernandez-paragon-code-graph-context -- npx -y code-graph-context@5.9.0In einem Terminal ausführen.
{ "mcpServers": { "andrew-hernandez-paragon-code-graph-context": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
Remote-URL oder ein Befehl auf Ihrem Rechner? Worin sich die beiden Installationen unterscheiden
Auf PlugMCP ausführen
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
StartenGive 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.
┌─────────────────────────────────────────────────────────────┐
│ YOUR CODEBASE │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Service │ │Controller│ │ Module │ │ Entity │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
└───────┼─────────────┼─────────────┼─────────────┼──────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ CODE GRAPH CONTEXT │
│ │
│ AST Parser ──► Neo4j Graph ──► Vector Embeddings │
│ (ts-morph) (Relationships) (Local or OpenAI) │
│ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ CLAUDE CODE │
│ │
│ "What services depend on UserService?" │
│ "What's the blast radius if I change this function?" │
│ "Find all HTTP endpoints that accept a UserDTO" │
│ "Refactor this across all 47 files that use it" │
│ │
└─────────────────────────────────────────────────────────────┘
TypeScript Source → AST Parser (ts-morph) → Neo4j Graph + Vector Embeddings → MCP Tools
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 - Embedding service (local sidecar or OpenAI)src/mcp/mcp.server.ts - MCP server and tool registrationDual-Schema System:
Nodes have both coreType (AST) and semanticType (framework meaning), enabling queries like "find all controllers" while maintaining AST precision.
No API keys required. Local embeddings work out of the box using a Python sidecar.
npm install -g code-graph-context
code-graph-context init # Sets up Neo4j + Python sidecar + downloads embedding model
The init command handles everything:
neo4j if missing and runs it as a launchd agent (dev.code-graph-context.neo4j) with its own config, plugins and data under ~/.local/share/code-graph-context/neo4j, so brew upgrade never touches them; elsewhere it starts a Docker container. Force a provider with --native or --docker.~/.config/code-graph-context/config.json, so the MCP server knows what to startclaude mcp add --scope user code-graph-context -- code-graph-context
That's it. No API keys needed. Restart Claude Code and you're ready to go.
Want to use OpenAI instead? See Embedding Configuration below.
In Claude Code, say:
"Parse this project and build the code graph"
Claude will run parse_typescript_project and index your codebase.
Claude Code stores MCP server configs in JSON files. The location depends on scope:
If you prefer to edit the config files directly:
~/.claude.json (user scope - recommended):
{
"mcpServers": {
"code-graph-context": {
"command": "code-graph-context"
}
}
}
With OpenAI (optional):
{
"mcpServers": {
"code-graph-context": {
"command": "code-graph-context",
"env": {
"OPENAI_EMBEDDINGS_ENABLED": "true",
"OPENAI_API_KEY": "sk-your-key-here"
}
}
}
}
From source installation:
{
"mcpServers": {
"code-graph-context": {
"command": "node",
"args": ["/absolute/path/to/code-graph-context/dist/cli/cli.js"]
}
}
}
Find code by describing what you need, not by memorizing file paths:
"Find where user authentication tokens are validated"
"Show me the database connection pooling logic"
"What handles webhook signature verification?"
Before you refactor, understand the blast radius:
┌─────────────────────────────────────────────────────────────┐
│ Impact Analysis: UserService.findById() │
├─────────────────────────────────────────────────────────────┤
│ Risk Level: HIGH │
│ │
│ Direct Dependents (12): │
│ └── AuthController.login() │
│ └── ProfileController.getProfile() │
│ └── AdminService.getUserDetails() │
│ └── ... 9 more │
│ │
│ Transitive Dependents (34): │
│ └── 8 controllers, 15 services, 11 tests │
│ │
│ Affected Files: 23 │
│ Recommendation: Add deprecation warning before changing │
└─────────────────────────────────────────────────────────────┘
Explore relationships in any direction:
UserController
│
├── INJECTS ──► UserService
│ │
│ ├── INJECTS ──► UserRepository
│ │ │
│ │ └── MANAGES ──► User (Entity)
│ │
│ └── INJECTS ──► CacheService
│
└── EXPOSES ──► POST /users
│
└── ACCEPTS ──► CreateUserDTO
Find code that can be safely removed:
Dead Code Analysis: 47 items found
├── HIGH confidence (23): Exported but never imported
│ └── formatLegacyDate() in src/utils/date.ts:45
│ └── UserV1DTO in src/dto/legacy/user.dto.ts:12
│ └── ... 21 more
├── MEDIUM confidence (18): Private, never called
└── LOW confidence (6): May be used dynamically
Identify DRY violations across your codebase:
Duplicate Groups Found: 8
Group 1 (Structural - 100% identical):
├── validateEmail() in src/auth/validation.ts:23
└── validateEmail() in src/user/validation.ts:45
Recommendation: Extract to shared utils
Group 2 (Semantic - 94% similar):
├── parseUserInput() in src/api/parser.ts:78
└── sanitizeInput() in src/webhook/parser.ts:34
Recommendation: Review for consolidation
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.
┌──────────────────┐
│ ORCHESTRATOR │
│ │
│ "Add JSDoc to │
│ all services" │
└────────┬─────────┘
│
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Worker 1 │ │ Worker 2 │ │ Worker 3 │
│ │ │ │ │ │
│ Claiming │ │ Working │ │ Claiming │
│ AuthSvc │ │ UserSvc │ │ PaySvc │
└──────────┘ └──────────┘ └──────────┘
│ │ │
└─────────────┼─────────────┘
│
▼
┌─────────────────────────────┐
│ PHEROMONE TRAILS │
│ │
│ AuthService: [claimed] │
│ UserService: [modifying] │
│ PayService: [claimed] │
│ CacheService: [available] │
│ │
└─────────────────────────────┘
Agents leave markers on code nodes that decay over time—like ants leaving scent trails:
Self-healing: If an agent crashes, its pheromones decay and the work becomes available again.
Explicit task management with dependencies:
┌─────────────────────────────────────────────────────────────┐
│ TASK QUEUE │
├─────────────────────────────────────────────────────────────┤
│ [available] Add JSDoc to UserService priority: high │
│ [claimed] Add JSDoc to AuthService agent: worker1 │
│ [blocked] Update API docs ─────────────────► depends on ──┤
│ [in_progress] Add JSDoc to PaymentService agent: worker2 │
│ [completed] Add JSDoc to CacheService ✓ │
└─────────────────────────────────────────────────────────────┘
// Orchestrator decomposes the task and creates individual work items
swarm_post_task({
projectId: "backend",
swarmId: "swarm_rename_user",
title: "Update UserService.findUserById",
description: "Rename getUserById to findUserById in UserService",
type: "refactor",
createdBy: "orchestrator"
})
// Workers claim and execute tasks
swarm_claim_task({ projectId: "backend", swarmId: "swarm_rename_user", agentId: "worker_1" })
// ... do work ...
swarm_complete_task({ taskId: "task_1", agentId: "worker_1", action: "complete", summary: "Renamed method" })
For optimal swarm execution, install the included Claude Code skill that teaches agents the coordination protocol:
# Copy to your global skills directory
mkdir -p ~/.claude/skills
cp -r skills/swarm ~/.claude/skills/
Or for a specific project:
cp -r skills/swarm .claude/skills/
The skill provides:
Once installed, just say "swarm" or "parallel agents" and Claude will use the skill automatically.
See skills/swarm/SKILL.md for the full documentation.
Pattern 1: Discovery → Focus → Deep Dive
list_projects → search_codebase → traverse_from_node → traverse (with skip for pagination)
Pattern 2: Pre-Refactoring Safety
search_codebase("function to change") → impact_analysis(nodeId) → review risk level
Pattern 3: Code Health Audit
detect_dead_code → detect_duplicate_code → prioritize cleanup
Pattern 4: Multi-Agent Work
swarm_post_task → swarm_claim_task → swarm_complete_task → swarm_get_tasks(includeStats) → swarm_cleanup
All query tools require projectId for isolation. You can use:
proj_a1b2c3d4e5f6 (auto-generated)my-backend (from package.json)/path/to/project (resolved automatically)// These all work:
search_codebase({ projectId: "my-backend", query: "auth" })
search_codebase({ projectId: "proj_a1b2c3d4e5f6", query: "auth" })
search_codebase({ projectId: "/path/to/my-backend", query: "auth" })
Deep understanding of NestJS patterns:
@Controller, @Get, @Post, etc.)@Injectable)@Module)@IsString, @IsEmail, etc.)NestJS-Specific Relationships:
INJECTS - Dependency injectionEXPOSES - Controller exposes HTTP endpointMODULE_IMPORTS, MODULE_PROVIDES, MODULE_EXPORTS - Module systemGUARDED_BY, TRANSFORMED_BY, INTERCEPTED_BY - MiddlewareThe parser is config-driven. Define your own framework patterns:
// Example: Custom React schema
const REACT_SCHEMA = {
name: 'react',
decoratorPatterns: [
{ pattern: /^use[A-Z]/, semanticType: 'ReactHook' },
{ pattern: /^with[A-Z]/, semanticType: 'HOC' },
],
nodeTypes: [
{ coreType: 'FunctionDeclaration', condition: (node) => node.name?.endsWith('Provider'), semanticType: 'ContextProvider' },
],
relationships: [
{ type: 'PROVIDES_CONTEXT', from: 'ContextProvider', to: 'ReactHook' },
]
};
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.
Local BGE-base embeddings (768 dimensions) are the default. No API key is needed. The Python sidecar starts automatically on first use.
An API key alone only enables natural_language_to_cypher. OpenAI embeddings require both OPENAI_EMBEDDINGS_ENABLED=true and a nonempty OPENAI_API_KEY. An explicit false overrides the deprecated OPENAI_ENABLED flag. Request failures never switch providers or models.
Use the same explicit EMBEDDING_MODEL in every client sharing a sidecar and graph. The server rejects a sidecar whose model or vector dimensions differ from the configured model, including different models with equal dimensions.
The sidecar uses MPS (Apple Silicon GPU) when available, falling back to CPU. The server owns its lifetime: it exits after EMBEDDING_IDLE_TIMEOUT_S seconds (default 600, 0 disables) without a /embed request, whoever sent it, and the MCP server starts it again on the next embedding (~15-20s).
Any process can start a server that outlives it with code-graph-context embeddings start. It exits 0 once /health is ok (printing the model and port) and exits 1 with the reason and the log path (code-graph-context-embedding-sidecar.log in the temp directory) otherwise. A server started this way does not watch a parent process; one spawned by the MCP server still exits when the MCP server does (EMBEDDING_WATCH_PARENT=0 turns that watch off).
Device override: Set
EMBEDDING_DEVICE=cputo force CPU if MPS causes issues.Half precision: Set
EMBEDDING_HALF_PRECISION=trueto load the model in float16, roughly halving memory usage.
Set via the EMBEDDING_MODEL environment variable:
Dimensions describe vector size, not retrieval quality. Compare models using queries and relevant results from your own code and notes.
Example: Use a lightweight model on a low-memory machine:
claude mcp add --scope user code-graph-context \
-e EMBEDDING_MODEL=BAAI/bge-base-en-v1.5 \
-- code-graph-context
Changing models requires re-embedding all affected code and session memory. Re-parsing code alone does not convert note or bookmark vectors. Equal vector dimensions do not make two models compatible.
Back up the graph first. Preserve node IDs, note content, and relationships by replacing embedding properties in place. Vector indexes are shared across projects, so changing index dimensions requires coordinating every affected project and client. Updating the package does not migrate existing vectors.
When upgrading a graph built with the previous CodeSage default, explicitly keep EMBEDDING_MODEL=codesage/codesage-base-v2 until you migrate it. Existing BGE users can keep their configuration. New graphs default to BGE.
To use OpenAI embeddings:
claude mcp add --scope user code-graph-context \
-e OPENAI_EMBEDDINGS_ENABLED=true \
-e OPENAI_API_KEY=sk-your-key-here \
-- code-graph-context
# Check the server is registered
claude mcp list
# Verify Neo4j is running (shows the provider, service state, Bolt and APOC)
code-graph-context status
# Test manually
code-graph-context status
"Failed to generate embedding" — The local sidecar may not have started. Check:
# Verify Python deps are installed
code-graph-context status
# Re-run init to fix sidecar setup
code-graph-context init
Out of memory (large model on 16GB machine) — Switch to a lighter model:
claude mcp add --scope user code-graph-context \
-e EMBEDDING_MODEL=BAAI/bge-base-en-v1.5 \
-- code-graph-context
Using OpenAI and getting auth errors — Ensure your key is configured:
claude mcp remove code-graph-context
claude mcp add --scope user code-graph-context \
-e OPENAI_EMBEDDINGS_ENABLED=true \
-e OPENAI_API_KEY=sk-your-key-here \
-- code-graph-context
For large codebases, increase memory limits:
# Stop and recreate with more memory
code-graph-context stop
code-graph-context init --memory 4G
Use async mode for large projects:
parse_typescript_project({
projectPath: "/path/to/project",
tsconfigPath: "/path/to/project/tsconfig.json",
async: true // Returns immediately, poll with check_parse_status
})
code-graph-context init [options] # Set up Neo4j + Python sidecar + embedding model
code-graph-context status # Check provider, Neo4j and sidecar status
code-graph-context stop # Stop Neo4j (launchd service or container)
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)--native / --docker - Choose the provider (default: native on macOS with Homebrew, otherwise Docker)--pagecache <size> - Page cache size (default: 1G)-f, --force - Recreate the container, or regenerate native config and restart (data is kept)If a Docker graph named code-graph-neo4j is already running on the same ports, native init configures but does not start Neo4j; it points to code-graph-context migrate-from-docker. That command moves the graph with every node, embedding and index, upgrading the store through Neo4j 5.26 on the way, and leaves the Docker container and volume stopped but intact; code-graph-context migrate-from-docker --rollback returns to them. Do not also run brew services start neo4j: it starts a second Neo4j without this config.
git clone https://github.com/andrew-hernandez-paragon/code-graph-context.git
cd code-graph-context
npm install
npm run build
npm run dev # Watch mode
Conventional Commits: feat|fix|docs|refactor(scope): description
MIT - see LICENSE
A Model Context Protocol (MCP) server that builds rich code graphs to provide deep contextual understanding of TypeScript codebases to Large Language Models.
{ "mcpServers": { "andrew-hernandez-paragon-code-graph-context": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}Tools
Noch keine Tool-Liste. Remote-Server erhalten eine nach dem ersten Health-Check.
FAQ
Kopieren Sie auf dieser Seite die stdio-Konfiguration für Cursor, Claude Desktop, Claude Code oder VS Code. Sie nutzt die Installation des Herausgebers, keinen PlugMCP-Proxy.
In diesem Eintrag ist keine erforderliche Umgebungsvariable aufgeführt.
Code Graph Context läuft lokal über stdio.
Zuletzt geprüft: 2026-11-11. A Model Context Protocol (MCP) server that builds rich code graphs to provide deep contextual understanding of TypeScript codebases to Large Language Models.