SC

sdsrss/code-graph-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

101 stars 19 forks 质量 85 趋势 21MIT

sdsrss/code-graph-mcp 是从 https://github.com/sdsrss/code-graph-mcp. 导入的 MCP 服务器候选

概览

sdsrss/code-graph-mcp 是从 https://github.com/sdsrss/code-graph-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一款高性能代码知识图谱服务器,实现了模型上下文协议(MCP)。将代码库索引为结构化的AST知识图谱,支持语义搜索、呼叫图遍历和HTTP路由追踪——旨在为AI编码助手提供对代码的深入结构化理解。

特色

  • 多语言解析 — 跨层级的树置AST提取:
  • Full(调用 + 导入 + 继承):TypeScript/TSX、JavaScript、Go、Python、Rust、Java。HTTP 路由提取还涵盖 TypeScript/TSX + JavaScript(Express/Connect)、Go (net/http)、Python (Flask/FastAPI)和 Rust axum(.route() 链,带有内联 .nest() 前缀;仅限命名处理程序)——actix/rocket 和 Java Spring 尚未实现路由提取
  • 烟雾测试(调用 + 导入 + 继承):C#、Kotlin、Ruby、PHP、Swift、Dart
  • Limited(函数 + 调用 + #include 导入 + gtest 测试标记 + C++ 基类继承 + Class::method 作用域限定):C,C++
  • 脚本:Bash(函数 + 命令 + source/. 导入)、Markdown(标题)
  • 仅支持文件-FTS(无AST符号提取):HTML、CSS、JSON

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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 AST extraction across tiers of depth:
    • Full (calls + imports + inheritance): TypeScript/TSX, JavaScript, Go, Python, Rust, Java. HTTP route extraction additionally covers TypeScript/TSX + JavaScript (Express/Connect), Go (net/http), Python (Flask/FastAPI), and Rust axum (.route() chains with inline .nest() prefixes; named handlers only) — actix/rocket and Java Spring are not yet route-extracted
    • Smoke-tested (calls + imports + inheritance): C#, Kotlin, Ruby, PHP, Swift, Dart
    • Limited (functions + calls + #include imports + gtest test markers + C++ base-class inheritance + Class::method scope qualification): C, C++
    • Scripting: Bash (functions + commands + source/. imports), Markdown (headings)
    • File-FTS only (no AST symbol extraction): HTML, CSS, JSON
    • Test markers — detected from the AST for Rust (#[test] / #[cfg(test)]), JavaScript/TypeScript/TSX (describe/it/test blocks and their callbacks) and C/C++ (gtest TEST macros). Go, Python, Java and the rest fall back to path/name heuristics (tests/, src/test/java/, *_test.*, *.test.js, test_*, *Test)
    • Value/type references — a references relation for symbols that are used without being called, imported or inherited (path-qualified constants, type-position uses, functions passed as values): Rust, TypeScript/TSX, JavaScript, Python, Go, Java, C, C++
  • 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 net/http, Rust axum)
  • Dead code detection — Find unreferenced symbols with smart Orphan/Exported-Unused classification
  • Impact analysis — Determine the blast radius of code changes by tracing all dependents
  • Incremental indexing — Merkle tree change detection with a file system watcher; changed files are re-indexed when the next MCP query tool call arrives (get_index_status does not count). Smart event filtering skips metadata-only changes (chmod, xattr)
在 GitHub 查看完整 README

安装

npx -y @sdsrs/code-graph
新手?先看 mcpskill.org 教程 →

配置

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