Turn code bases into a knowledge graphs for persistent memory
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Documented (README)
git clone https://github.com/Nxtsoft/CGraphMCP Servers overview
<div align="center"> <img src="assets/hero.svg" alt="CGraph — your codebase as a queryable knowledge graph" width="100%"> **English** · [简体中文](README.zh-CN.md) [](LICENSE) [](CMakeLists.txt) [](CMakePresets.json) [](https://modelcontextprotocol.io) [](#contributing) *Scan a project · extract structure into a deterministic graph · query it in ~10 ms from a daemon, a thin client, or an MCP server.* </div> ## Contents [Why CGraph?](#why-cgraph) · [Architecture](#architecture) · [Repository layout](#repository-layout) · [What it produces](#what-it-produces) · [Output formats](#output-formats) · [Performance](#performance) · [Retrieval benchmark](#retrieval-benchmark) · [Languages](#languages) · [Quick start](#quick-start) · [Install & Setup](#install--setup) · [Use with coding agents](#use-with-coding-agents) · [CLI · daemon · MCP reference](#cli-daemon-and-mcp-reference) · [Host integrations & enrichment](#host-integrations-and-enrichment) · [Development notes](#development-notes) · [Contributing](#contributing) · [License](#license) ## Why CGraph? Reading a large repo to answer **"what calls this?"** or **"what breaks if I change it?"** means loading dozens of files — and those answers aren't in any single file. They live in the *relationships between* files. CGraph precomputes them so you (and your AI agent) navigate by **graph, not grep**. | | | | --- | --- | | 🔗 **Reverse dependencies & blast radius** | `graph_impact` returns every transitive dependent of a symbol in ~10 ms. On a real 10,706-node repo it surfaced **93 dependents** of one god-file, instantly — an answer grep can't give you. | | 🧭 **Navigate, don't grep** | Centrality-ranked search, node neighborhoods, shortest paths, and **token-budgeted source bundles** — served warm in ~10 ms instead of many file reads that burn context. | | 🏛️ **Architecture at a glance** | Centrality ranking surfaces the load-bearing files; Leiden/Louvain community detection clusters the repo into modules automatically. | | ⚡ **Deterministic & fast** | A full **10k-node graph builds in ~2 s**; no LLM in the extraction path — same input, same graph, every time. | | 🤖 **Built for coding agents** | A standard **MCP** server drops the graph straight into Claude / Codex, so they reason over structure instead of blindly reading files. | > **The pitch in one line:** for a codebase too big to hold in your head, CGraph is the index that decides *which* code to read — `ctags`/"find all references", precomputed, centrality-ranked, and exposed over MCP. ## Architecture <div align="center"><img src="assets/architecture.svg" alt="CGraph architecture" width="100%"></div> - **`cgraph`** — one-shot scan → portable disk exports (`graph.json`, `graph.html`, `graph.svg`, `obsidian.md`, `cypher.txt`, `modules.mmd`, `modules.svg`, `design.mmd`, `design.md`). - **`graphd` + `cgraph-client`** — a resident per-project daemon with live file-watching; warm `query` / `path` / `explain` / `impact` / `context` in ~10 ms. - **`cgraph-mcp`** — a Model Context Protocol server so agents navigate the graph directly. The engine owns deterministic extraction, fragment validation, cache state, and local graph mutation; hosts own model choice and semantic enrichment. ## Repository layout ```text src/cli/ One-shot CLI entrypoint: cgraph src/daemon/ Daemon entrypoint: graphd src/client/ Thin client runtime and cgraph-client executable src/mcp/ MCP request handling and cgraph-mcp executable src/engine/ Detection, extraction, graph building, analysis, daemon ops tests/smoke/ CTest smoke coverage for engine, daemon, MCP, and integration paths tests/fuzz/ Optional libFuzzer targets integrations/ Host hook and always-on integration scripts docs/ Host integration contract and benchmark notes vendor/ Vendored tree-sitter core and grammars ``` ## What it produces A single scan turns a source tree into an interactive, explorable graph — communities colored, hubs sized by centrality: <div align="center"><img src="assets/graph-example.png" alt="CGraph interactive viewer on a 10,708-node codebase" width="90%"></div> <sub>The real `graph.html` viewer on a 10,708-node / 28,945-edge codebase — self-contained HTML, no external JS.</sub> ## Output formats - `graph.json` — directed node-link JSON with graph metadata, nodes, and links. Node ids derive from each file's path relative to the project root, so the same commit built from two checkouts yields the same ids and two graphs can be joined by id; `source_file` stays the path the graph was read from - `graph.html` — browser-readable interactive graph view - `graph.svg` — static graph visualization - `obsidian.md` — markdown export for Obsidian-style navigation - `cypher.txt` — Neo4j Cypher statements - `modules.mmd` — module dependency diagram as Mermaid - `modules.svg` — module dependency diagram as a layered static image - `design.mmd` — entry points and their top call flows as a Mermaid `flowchart TD` - `design.md` — the same as Markdown: entry-point table, nested flows, layers by call distance ## Performance The interactive viewer used to run an O(N²) force simulation in the browser on every open. Layout is now **precomputed once in C++** (via igraph), and repaints are viewport-culled — both **dependency-free**: <div align="center"><img src="assets/performance.svg" alt="Time-to-settle: 35s to 0ms" width="100%"></div> | graph | time-to-settle **before** | **after** | per-frame repaint | | --- | --- | --- | --- | | 10,000 nodes | **35.2 s** (main thread pinned) | **~0 ms** (static layout) | **20–34× cheaper** (zoom/pan) | ## Retrieval benchmark CGraph has been scored on [Agent Retrieval Bench](https://arxiv.org/abs/2607.24882): 427 samples from 25 repositories, each checked out at its base commit, scored with the benchmark's own metric code. The table covers all 345 positive samples. | Method | Recall@20 | MRR | BCY@8k | | --- | ---: | ---: | ---: | | CGraph bin-v0.9.1 (label + code-text search) | 0.6362 | 0.2787 | 0.4319 | | CGraph bin-v0.8.3 (label-only text search) | 0.5726 | 0.2356 | 0.3790 | | RepoMap (published) | 0.6333 | 0.2158 | 0.3788 | | RepoMap (rerun on this harness) | 0.6311 | 0.2156 | 0.3846 | | Qwen3-Embedding-8B (published) | 0.7029 | 0.2336 | 0.3732 | | Qwen3-Embedding-4B (published) | 0.6306 | 0.2379 | 0.3409 | | BM25 (published) | 0.4452 | 0.1520 | 0.2051 | How bin-v0.9.1 compares: - **Recall@20.** Level with RepoMap (the difference is inside run-to-run noise of about 0.006). Below Qwen3-Embedding-8B. Above the other published single methods. - **MRR.** Higher than every published single method. - **BCY@8k.** Higher than every published single method, by more than the noise floor. - **Against the paper's fusion of Qwen3-Embedding-8B and RepoMap**, on the 287-sample core it reports: MRR is level (the fusion scores only its top 20; CGraph's MRR over its top 20 is 0.276 vs 0.271, inside the noise floor); Recall@20 (0.633 vs 0.733) and BCY@8k (0.440 vs 0.488) are lower. - **Abstention.** CGraph does not abstain on no-gold samples. Per-task tables, pins, the noise floor and caveats are in [bench/arb/RESULTS.md](bench/arb/RESULTS.md). Reproduce with `bench/arb/run.sh`. ## Languages Tree-sitter-backed structural extraction, with regex/structured extraction for a few config formats: <p> <img src="https://img.shields.io/badge/C-A8B9CC?style=for-the-badge&logo=c&logoColor=black" alt="C"> <img src="https://img.shields.io/badge/C++-00599C?style=for-the-badge&logo=cplusplus&logoColor=white" alt="C++"> <img src="https://img.shields.io/badge/C%23-512BD4?style=for-the-badge&logo=dotnet&logoColor=white" alt="C#"> <img src="https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white" alt="Go"> <img src="https://img.shields.io/badge/Groovy-4298B8?style=for-the-badge&logo=apachegroovy&logoColor=white" alt="Groovy"> <img src="https://img.shields.io/badge/Java-007396?style=for-the-badge&logo=openjdk&logoColor=white" alt="Java"> <img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black" alt="JavaScript"> <img src="https://img.shields.io/badge/Kotlin-7F52FF?style=for-the-badge&logo=kotlin&logoColor=white" alt="Kotlin"> <img src="https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"> <img src="https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white" alt="Ruby"> <img src="https://img.shields.io/badge/Scala-DC322F?style=for-the-badge&logo=scala&logoColor=white" alt="Scala"> <img src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript"> <img src="https://img.shields.io/badge/TSX-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="TSX"> </p> Plus structured/regex extraction for Apex, Delphi form/source, MSBuild/XML project files, and MCP config files. ### Type members Seven languages emit a `field` node per declared member, with a `defines` edge from the owner: | Language | Owners with members | Field properties | | --- | --- | --- | | C, C++ | `class`, `struct` only — not `enum` or `union` | none | | TypeScript, TSX | interface, object type alias, class (constructor parameter properties included), enum | `type_text`, `optional`, `readonly` | | Go | struct, including multi-name and embedded fields | `type_text` | | Rust | named and tuple struct, union, enum variant, trait associated type and
What people ask about CGraph
What is Nxtsoft/CGraph?
+
Nxtsoft/CGraph is mcp servers for the Claude AI ecosystem. Turn code bases into a knowledge graphs for persistent memory It has 2 GitHub stars and its last recorded update is dated 2026-10-14.
How do I install CGraph?
+
You can install CGraph by cloning the repository (https://github.com/Nxtsoft/CGraph) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is Nxtsoft/CGraph safe to use?
+
Our security agent has analyzed Nxtsoft/CGraph and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains Nxtsoft/CGraph?
+
Nxtsoft/CGraph is maintained by Nxtsoft. The last recorded GitHub activity is dated 2026-10-14, with 2 open issues.
Are there alternatives to CGraph?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy CGraph to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/nxtsoft-cgraph)<a href="https://claudewave.com/repo/nxtsoft-cgraph"><img src="https://claudewave.com/api/badge/nxtsoft-cgraph" alt="Featured on ClaudeWave: Nxtsoft/CGraph" width="320" height="64" /></a>More MCP Servers
Reverse engineer anything with agents, from app behavior down to native binaries.
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev