codingest-mcp

codingest-mcp

Serves a live code-graph workbench over stdio for MCP clients/agents, enabling Cypher queries and codebase analysis via KGLite tools.

Category
访问服务器

README

codingest

CI crates.io PyPI Docs License: MIT

Parse polyglot codebases into queryable kglite knowledge graphs — tree-sitter parsers for 14 languages, call / type / inheritance / route edges, an optional markdown-docs pass, and multi-git-revision merged graphs.

codingest is the standalone home of KGLite's former in-tree code_tree component. The graph engine (storage backends, the Cypher pipeline, .kgl persistence) and the MCP protocol server are imported from kglite as cargo libraries — this repo owns only the code-tree component itself. Four surfaces ship from one workspace: a CLI, an MCP server, a Python wheel, and a Rust crate.

Documentation: codingest.readthedocs.io

Requirements — kglite ≥ 0.14

codingest builds against 0.14-only engine APIs (kglite::api::code_entities, kglite_mcp_server::run_with_code_tree_hooks) that KGLite added when it removed its in-tree builder. These are not in any 0.13.x release.

  • Rust / crates.io: codingest cannot be published, and a checkout without a sibling ../KGLite cannot build, until kglite 0.14.0 is on crates.io. Local development uses a path dependency on the sister checkout (see Dependency policy).
  • Python wheel: pip install codingest pulls kglite>=0.13 for the loader half of the handoff, but the builder half needs a kglite that understands 0.14 graphs. Install kglite>=0.14 alongside it.

Install

pip install codingest          # Python wheel (grammars bundled) — ALSO installs the `codingest` CLI
cargo install codingest-cli    # pure-Rust `codingest` builder CLI (no Python)
cargo install codingest-mcp    # the code-graph MCP server

The Python wheel bundles the codingest terminal command (the codingest-cli Rust library is linked into the wheel's extension), so pip install codingest alone gives you both import codingest and codingest build/status — the cargo install codingest-cli route is only needed for a pure-Rust install. This makes the pip-only flow pip install kglite codingest && kglite skill install self-sufficient (the installed code-review skill shells out to codingest build/status).

(All become available once kglite 0.14.0 is published — see Requirements.)

Quick start

CLI

# Build a code graph from a checkout
codingest build /path/to/repo
# → /path/to/repo/.kglite/code-review.kgl

# Build committed content at specific revisions (multi-rev merged graph)
codingest build /path/to/repo --revs v1.0 v2.0

# Check whether an existing graph is stale relative to the tree
codingest status /path/to/repo

Then query or describe the .kgl with kglite (kglite.load(...), the kglite shell, or any MCP/Bolt client).

MCP server

# Serve a live code-graph workbench over stdio for an MCP client / agent
codingest-mcp --root-dir /path/to/repo

codingest-mcp embeds the kglite-mcp-server tool surface (set_root_dir, graph_overview, cypher_query, read_code_source, …) and injects the codingest builder, so set_root_dir builds a graph. Running plain kglite-mcp-server against a workspace refuses to build — it has no in-tree builder anymore. See the MCP docs.

Python wheel

import codingest

g = codingest.build(".")                 # returns a real kglite.KnowledgeGraph
g.cypher("MATCH (f:Function) RETURN f.name LIMIT 10")
codingest.build(".", save_to="code.kgl") # also persist the .kgl
codingest.build(".", rev="v1.0")         # build a git revision (or revs=[...])
codingest.repo_tree("owner/name")        # clone a GitHub repo and build

The .kgl-bytes handoff. The codingest and kglite wheels are two separate compiled extensions and can't share live Rust objects, so build() constructs the graph with codingest's native builder, serializes it to a .kgl, then calls the installed kglite wheel's load() and returns that object — a genuine kglite.KnowledgeGraph, so every downstream kglite API works.

Bundled CLI. The same wheel also provides the codingest terminal command (a codingest/cli.py console-script shim forwarding into the linked codingest-cli library), so codingest build/status works straight after pip install codingest — identical semantics to cargo install codingest-cli.

Rust crate

[dependencies]
codingest = "0.1"   # needs kglite 0.14 on crates.io (see Requirements)
kglite = "0.14"
use codingest::build_code_tree; // = builder::run_with_options
let graph = build_code_tree(dir, /*verbose=*/false, /*include_tests=*/true,
                            /*save_to=*/None, /*max_loc=*/None, /*include_docs=*/false)?;
// Query with kglite's Cypher pipeline, persist with kglite::api::io, …

Workspace layout

Crate What it is
crates/codingest The component library (codingest): builder, parsers, manifest reader, docs pass, multi-rev merge, cross-language edges. Extracted from the former KGLite/crates/kglite/src/code_tree/ (removed upstream 2026-07-16) and re-targeted at the public kglite::api facade. Ships the codingest_stats + codingest_bench binaries.
crates/codingest-cli codingest binary — build a checkout or git revision(s) into a .kgl graph, status to check staleness.
crates/codingest-mcp codingest-mcp binary — the full MCP tool surface imported from the kglite-mcp-server library, with the codingest builder injected.
crates/codingest-py PyO3 wrapper built by maturin into the codingest wheel (pip install codingest). Python package source is codingest/; pyproject.toml drives the maturin build. Not published to crates.io (publish = false).

CI-equivalent local gate: make gate

make gate is the single-entry-point local gate that mirrors CI (cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, workspace build + test incl. the golden oracle) and adds codingest-specific checks (determinism reproducer, codingest_bench parity smoke, the wheel build + the tests/python acceptance suite). Run it before pushing. Individual steps are also targets (make clippy, make determinism, …); make fmt auto-formats.

The golden-digest oracle

KGLite deleted its in-tree code_tree builder on 2026-07-16, so the old two-builder parity sweep is gone. The authority it enforced was frozen while the builders were still verified identical, into per-corpus SHA-256 digests under crates/codingest/tests/goldens/ (committed fixtures — no network). The golden_parity test builds each corpus with only the codingest builder, digests a canonical exhaustive graph rendering, and compares to the frozen golden. The multi-rev fixture is guarded instead by rev_self_consistency. Regenerate goldens only for deliberate builder-behavior changes: cargo test -p codingest --test parity -- --ignored capture_goldens (details in crates/codingest/tests/goldens/README.md).

Dependency policy

kglite and kglite-mcp-server are path dependencies on the sister checkout ../KGLite with a version = "0.13" crates.io fallback. The fallback is kept at 0.13 (not 0.14) only because the local sister checkout is still versioned 0.13.4 while carrying the 0.14 APIs — a path dep's version requirement must be satisfiable by the path crate, so 0.14 would break the local build today. When kglite 0.14.0 ships, the maintainer bumps both fallbacks to 0.14 and flips the CODINGEST_KGLITE_READY CI variable (see the workspace Cargo.toml note and .github/workflows/ci.yml).

Parity with the (now-removed) in-tree component

codingest was extracted to be feature- and performance-identical to kglite's in-tree code_tree. KGLite removed that module on 2026-07-16, so parity is now enforced against a frozen record of its last-known-good output rather than live cross-comparison. See PARITY.md (stats-diff + timing), BENCHMARKS.md (build-time + Cypher benchmarks), crates/codingest/tests/parity.rs (the golden oracle), and docs/mcp-parity.md (the MCP↔builder coupling and the hook).

tests/python-legacy/ preserves KGLite's full 47-file kglite.code_tree behavioral suite verbatim as the dormant behavioral spec — the source of truth for what the Python builder guaranteed (see its README).

License

MIT © Kristian dF Kollsgård. codingest is an independent project; it depends on kglite at runtime but is not otherwise affiliated with it.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选