Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@sdsrs/code-graph-mcp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sdsrs/code-graph-mcp

MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

code-graph-mcp

A high-performance code knowledge graph server implementing the Model Context Protocol (MCP). Indexes codebases into a structured AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing — designed to give AI coding assistants deep, structured understanding of your code.

Features

  • Multi-language parsing — Tree-sitter based AST extraction for TypeScript, JavaScript, Go, Python, Rust, Java, C, C++, HTML, CSS
  • Semantic code search — Hybrid BM25 full-text + vector semantic search with Reciprocal Rank Fusion (RRF), powered by sqlite-vec
  • Call graph traversal — Recursive CTE queries to trace callers/callees with cycle detection
  • HTTP route tracing — Map route paths to backend handler functions (Express, Flask/FastAPI, Go)
  • Incremental indexing — Merkle tree change detection with file system watcher for real-time updates
  • Context compression — Token-aware snippet extraction for LLM context windows
  • Embedding model — Optional local embedding via Candle (feature-gated embed-model)
  • MCP protocol — JSON-RPC 2.0 over stdio, plug-and-play with Claude Code, Cursor, and other MCP clients

Architecture

src/
├── mcp/          # MCP protocol layer (JSON-RPC, tool registry, server)
├── parser/       # Tree-sitter parsing, relation extraction, language support
├── indexer/      # 3-phase pipeline, Merkle tree, file watcher
├── storage/      # SQLite schema, CRUD, FTS5 full-text search
├── graph/        # Recursive CTE call graph queries
├── search/       # RRF fusion search combining BM25 + vector
├── embedding/    # Candle embedding model (optional)
├── sandbox/      # Context compressor with token estimation
└── utils/        # Language detection, config

Quick Start

Prerequisites

  • Rust 1.75+ (2021 edition)
  • A C compiler (for bundled SQLite / sqlite-vec)

Build

# Default build (with local embedding model)
cargo build --release

# Without embedding model (lighter build)
cargo build --release --no-default-features

Run

The server communicates via JSON-RPC 2.0 over stdin/stdout:

cd /path/to/your/project
code-graph-mcp

Configure with Claude Code

Add to your MCP settings:

{
  "mcpServers": {
    "code-graph": {
      "command": "/path/to/code-graph-mcp",
      "cwd": "/path/to/your/project"
    }
  }
}

MCP Tools

ToolDescription
semantic_code_searchHybrid BM25 + vector + graph search for AST nodes
get_call_graphTrace upstream/downstream call chains for a function
find_http_routeMap route path to backend handler function
get_ast_nodeExtract a specific code symbol from a file
read_snippetRead original code snippet by node ID with context
start_watch / stop_watchStart/stop file system watcher for incremental indexing
get_index_statusQuery index status and health
rebuild_indexForce full index rebuild

Supported Languages

TypeScript, JavaScript, Go, Python, Rust, Java, C, C++, HTML, CSS

Storage

Uses SQLite with:

  • FTS5 for full-text search
  • sqlite-vec extension for vector similarity search
  • Merkle tree hashes for incremental change detection

Data is stored in .code-graph/index.db under the project root (auto-created, gitignored).

Development

# Run tests
cargo test

# Run tests without embedding model
cargo test --no-default-features

# Check compilation
cargo check

License

See LICENSE for details.

Keywords

mcp

FAQs

Package last updated on 11 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts