Codegraphx (cgx)
About
CodeGraphX (CGX) — a local, token-efficient codebase graph engine & MCP server for AI coding agents. Tree-sitter parsing, a bi-temporal SQLite semantic graph, O(1) symbol lookup, and impact/blast-radius tracing so agents answer 'what breaks if I change this?' in a few hundred tok
Details
- Author
- techcraze00
- GitHub stars
- 1
- Downloads
- 332
- Categories
- Other, AI, Developer Tools
Jump to
- Persistent, queryable graph of code symbols and relationships
- O(1) symbol lookup via Bloom filter
- Recursive upstream/downstream impact tracing
- Cross-language call graph linking (frontend to backend routes)
- Bi-temporal history: query codebase as of any commit
- Token-optimized output in TOON format for AI agents
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Codegraphx (cgx)Command (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install with npm install -g codegraphx, then run cgx init to index the codebase. Query symbols with cgx query <symbol> or trace impact with cgx impact. The MCP server (cgx-mcp) exposes six tools for AI agents, with zero-config auto-indexing on first start.
get_graph_status
Get the current status of the CodeGraphX graph.
list_files
List all files in the codebase.
explain_impact
Provides a high-level summary of a symbol's blast radius (upstream/downstream).
check_symbol_exists
Instantly check if a symbol exists using a Bloom filter.
verify_task
High-level tool to verify if a specific task description has been implemented in a commit.
get_session_diff
Get a summary of changes in the current session or a specific branch.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"codegraphx (cgx)": {
"codegraphx": {
"description": "CodeGraphX MCP server for codebase intelligence. Enables AI assistants to query indexed source code, analyze dependencies, trace symbol impact, verify implementation tasks, inspect repository changes, and navigate large codebases without expensive file scanning.",
"command": "npx",
"args": [
"-y",
"-p",
"codegraphx",
"cgx-mcp"
]
}
}
}
}
McpServers
{
"codegraphx": {
"description": "CodeGraphX MCP server for codebase intelligence. Enables AI assistants to query indexed source code, analyze dependencies, trace symbol impact, verify implementation tasks, inspect repository changes, and navigate large codebases without expensive file scanning.",
"command": "npx",
"args": [
"-y",
"-p",
"codegraphx",
"cgx-mcp"
]
}
}
CodeGraphX (CGX)
<p align="center">

</p>
<p align="center">
<a href="https://www.npmjs.com/package/codegraphx"></a>
<a href="https://www.npmjs.com/package/codegraphx"></a>
<a href="LICENSE"></a>
<a href="https://nodejs.org"></a>
<a href="https://modelcontextprotocol.io"></a>
<a href="https://techcraze00.github.io/CodeGraphX/"></a>
</p>
<p align="center"><strong>Website:</strong> <a href="https://techcraze00.github.io/CodeGraphX/">techcraze00.github.io/CodeGraphX</a> · <strong>npm:</strong> <a href="https://www.npmjs.com/package/codegraphx"><code>codegraphx</code></a></p>
> CodeGraphX (CGX) is a local, token-efficient codebase graph engine for AI coding agents and human developers. It parses your source with Tree-sitter, stores a bi-temporal semantic graph in SQLite, and serves it over a CLI and an MCP server — so an agent can ask "what breaks if I change this function?" and get an exact answer in a few hundred tokens instead of reading 50 files.
---
What is CodeGraphX?
Definition — CodeGraphX is a code intelligence layer: a persistent, queryable graph of your codebase's symbols (functions, classes, variables), their relationships (calls, called_by, imports, inherits, cross-language API_CALLS), and how they change over time.
What kind of tool is it? It sits in the same family as a Language Server (LSP) or a code-search index, but it is purpose-built for LLM agents:
- A Language Server answers "go to definition" for an editor, one symbol at a time.
- A grep / embedding search finds text, not structure.
- CodeGraphX answers structural, whole-repo reasoning questions — impact/blast-radius, dependency cycles, cross-language contracts, "does this symbol even exist?" — and serializes the answer in a token-optimized form an agent can drop straight into its context.
The core problem it solves — AI coding agents burn most of their token budget re-discovering a codebase: opening files, scrolling, grepping, re-reading the same modules every session. CodeGraphX indexes once and answers those questions from a graph, so the agent spends tokens reasoning instead of scanning.
---
Why it's useful (the token economics)
Every agent action has a token cost. Consider a common question: "What will break if I change validateInput?"
| Approach | What the agent does | Rough context cost |
|---|---|---|
| No CGX | Greps for validateInput, opens ~15–50 candidate files, reads each to trace call sites | tens of thousands of tokens, several tool round-trips |
| With CGX | explain_impact({ symbol_name: "validateInput" }) → one small JSON of upstream callers + downstream callees | a few hundred tokens, one round-trip |
The savings compound because CGX serializes its graph in TOON (Token-Oriented Object Notation) instead of JSON — a compact tabular encoding that removes the repeated keys and braces that dominate JSON token counts.
> Honest framing: the accuracy numbers below are measured against a hand-labeled corpus. The token figures above are an illustrative model of typical agent behavior, not a lab benchmark — the exact ratio depends on your repo and agent. The mechanism (one targeted graph query vs. many file reads) is what delivers the win.
Where CGX pays off most:
- Large / unfamiliar repos where "read everything" is infeasible.
- Long agent sessions (the graph is a cache the agent doesn't have to rebuild).
- Cross-language stacks (React ⇄ Express/Flask/FastAPI) where call graphs don't span files.
- Refactors and reviews, where blast-radius and dead/broken-import detection matter.
---
Full capabilities
| Capability | What it gives you |
|---|---|
| 🧠 Symbol graph | Every function/class/method with calls, called_by, imports, inherits edges |
| ⚡ O(1) symbol lookup | Bloom filter answers probable_yes / definite_no without touching the DB |
| 💥 Impact tracing | Recursive upstream (callers) / downstream (callees) blast-radius via a SQL CTE |
| 🌉 Cross-language linking | Matches frontend fetch/axios calls to backend routes as confidence-scored API_CALLS edges |
| 🕑 Bi-temporal history | Append-only graph — query the codebase as of any commit; nothing is ever destroyed |
| 🩺 Doctor diagnostics | Reports missing/unresolvable imports, unresolved call targets, circular dependencies, syntax errors |
| ✅ Task verification | Compares a task description against a commit's actual symbol changes; flags untested additions |
| 🔀 Session / branch diff | Structural summary of added/removed/modified symbols vs. HEAD or a branch |
| 🌐 Interactive dashboard | D3.js force graph of the whole codebase in the browser |
| 📦 TOON artifacts | Token-optimized graph + file-index exports for agent context injection |
| 🔐 100% local | No cloud, no telemetry, no network — code never leaves the machine |
| 🤖 MCP server | 6 tools exposed to any MCP-compatible agent, with zero-config auto-indexing |
---
Tech used in this project
| Layer | Technology |
|---|---|
| Parsing | Tree-sitter with per-language grammars (tree-sitter-python, -javascript, -typescript, -html, -css) |
| Storage | SQLite via better-sqlite3 (default) or Postgres (pg), through the Kysely type-safe query builder |
| Agent protocol | Model Context Protocol SDK (@modelcontextprotocol/sdk) over stdio |
| Probabilistic lookup | bloom-filters |
| Token-optimized output | TOON (@toon-format/toon) |
| CLI | Commander + @clack/prompts for the interactive setup |
| File watching | chokidar |
| Runtime | Node.js ≥ 18, CommonJS |
---
Supported languages
| Language | Extensions | Extracts |
|---|---|---|
| Python | .py | functions, classes, calls, imports (incl. package-relative . / ..), Flask/FastAPI routes |
| JavaScript | .js, .jsx | functions, classes, arrow fns, calls, imports/require, local bindings, fetch/axios calls, Express routes |
| TypeScript | .ts, .tsx | same as JS plus TS-specific declarations |
| HTML | .html | elements / structural symbols |
| CSS | .css | selectors (classes, ids) |
---
Installation
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





