@sdsrs/code-graph

data-ai MCP Server

AST knowledge graph MCP server for Claude Code — semantic search, call graph traversal, HTTP route tracing, impact analysis. Auto-indexes 10 languages via Tree-sitter.

VerifiedInstall Ready
data-aidata-ai
1 views45 stars6 forksv0.74.2MIT

Why This Matters

Discovered via github-topic:mcp and last synced 3mo ago.

VerifiedInstall Ready
Source
github-topic:mcp
Stars
45
Last synced
3mo ago
Install
Instructions detected

Install

1. Install the package

npx -y @sdsrs/code-graph

2. Add to claude_desktop_config.json

{
  "mcpServers": {
    "-sdsrs-code-graph": {
      "command": "npx",
      "args": [
        "@sdsrs/code-graph"
      ]
    }
  }
}

Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) / %APPDATA%\Claude\claude_desktop_config.json (Windows)

35
Tools
0
Resources
0
Prompts
Standard I/O
Transport

Available Tools (35)

project_map

Full project architecture: modules, dependencies, entry points, hot functions

get_call_graph

Show call graph (callers/callees)

find_dead_code

Find unused code (orphans and exported-unused)

find_similar_code

Find semantically similar code (requires embeddings)

incremental-index

—

Rust

.rs

CSS

.css

Scenario

Traditional

Language

Extensions

Command

Description

module_overview

Module symbols grouped by file and type

health-check

`get_index_status`

Python

.py, .pyi

benchmark

—

Java

.java

HTML

.html, .htm

impact_analysis

Impact analysis (callers, routes, risk level)

map

`project_map`

Go

.go

semantic_code_search

FTS5 search by concept

get_ast_node

Show symbol details (code, type, signature)

Kotlin

.kt, .kts

Dart

.dart

Metric

Without code-graph

trace_http_chain

Trace HTTP route → handler → downstream calls

find_references

Find all references to a symbol

JavaScript

.js, .jsx, .mjs, .cjs

PHP

.php

Glob

## Architecture ``` src/ ├── domain.rs # Shared constants, relation types, env-var config ├── mcp/ # MCP protocol layer (JSON-RPC, tool registry, server) │ └── server/ # McpServer with IndexingState + CacheState sub-structs ├── parser/ # Tree-sitter parsing, relation extraction, LanguageConfig dispatch ├── indexer/ # 3-phase pipeline, Merkle tree, file watcher ├── storage/ # SQLite schema (v6), CRUD, FTS5, migrations ├── graph/ # Recursive CTE call graph queries ├── search/ # RRF fusion search combining BM25 + vector ├── embedding/ # Candle embedding model (optional, masked mean pooling) ├── sandbox/ # Context compressor with token estimation └── utils/ # Language detection, config ``` ## Installation ### Option 1: Claude Code Plugin (Recommended) Install as a Claude Code plugin for the best experience — includes slash commands, agents, skills, auto-indexing hooks, StatusLine health display, and automatic updates: ```bash # Step 1: Add the marketplace /plugin marketplace add sdsrss/code-graph-mcp # Step 2: Install the plugin /plugin install code-graph-mcp ``` What you get: - **MCP Server** — All code-graph tools available to Claude - **Slash Commands** — `/understand <module>`, `/trace <route>`, `/impact <symbol>` - **Code Explorer Agent** — Deep code understanding expert via `code-explorer` - **Auto-indexing Hook** — Incremental index on every file edit (PostToolUse) - **StatusLine** — Real-time health display (nodes, files, watch status) — compatible with other plugins' StatusLine via composite multiplexer - **Auto-update** — Checks for new versions every 6h, updates silently #### Manual Update ```bash npm update -g @sdsrs/code-graph ``` Then reconnect the MCP server in Claude Code with `/mcp`. > **Note:** Auto-update is disabled in the source repo directory (dev mode). Use manual update when developing the plugin itself. #### Invited-memory mode (quieter prompts) By default, every user prompt the plugin deems code-related gets a small context injection from `code-graph` CLI output. If you'd rather rely on MEMORY.md + explicit tool calls, opt into invited-memory mode: 1. Adopt the plugin contract into your project's memory index (idempotent, self-heals): ```bash code-graph-mcp adopt ``` This writes `plugin_code_graph_mcp.md` (decision rules) into `~/.claude/projects/<slug>/memory/` and links it from `MEMORY.md` inside a sentinel block. Run `code-graph-mcp unadopt` to remove. 2. Set the activation env var in `~/.claude/settings.json`: ```json { "env": { "CODE_GRAPH_QUIET_HOOKS": "1" } } ``` 3. Restart Claude Code. Session startup skips the project-map injection, UserPromptSubmit stops auto-injecting context, and the MCP `instructions` become a short pointer to the MEMORY.md file. ### Option 2: Claude Code MCP Server Only Register as an MCP server without the plugin features: ```bash claude mcp add code-graph-mcp -- npx -y @sdsrs/code-graph ``` ### Option 3: Cursor / Windsurf / Other MCP Clients Add to your MCP settings file (e.g. `~/.cursor/mcp.json`): ```json { "mcpServers": { "code-graph": { "command": "npx", "args": ["-y", "@sdsrs/code-graph"] } } } ``` ### Option 4: npx (No Install) Run directly without installing: ```bash npx -y @sdsrs/code-graph ``` ### Option 5: npm (Global Install) Install globally, then run anywhere: ```bash npm install -g @sdsrs/code-graph code-graph-mcp ``` ## Uninstallation ### Claude Code Plugin ```bash # Uninstall the plugin /plugin uninstall code-graph-mcp # (Optional) Remove the marketplace /plugin marketplace remove code-graph-mcp # (Optional) Clean up all config and cache data node ~/.claude/plugins/cache/code-graph-mcp/code-graph-mcp/*/scripts/lifecycle.js uninstall ``` ### Claude Code MCP Server ```bash claude mcp remove code-graph-mcp ``` ### Cursor / Windsurf / Other MCP Clients Remove the `code-graph` entry from your MCP settings file (e.g. `~/.cursor/mcp.json`). ### npm (Global) ```bash npm uninstall -g @sdsrs/code-graph ``` ## MCP Tools

dependency_graph

File-level dependency graph

C

.c, .h

ast_search

Structural search with `--type`/`--returns`/`--params` filters

TypeScript

.ts, .tsx

Ruby

.rb

Swift

.swift