Graph X
A knowledge graph MCP server that indexes your codebase into a local SQLite graph and provides tools for project mapping, file summaries, and impact analysis, drastically reducing token usage in AI coding assistants.
README
<p align="center"> <img src="docs/logo.svg" width="130" alt="Graph X logo"> </p>
<h1 align="center">Graph X</h1>
<p align="center"> A local knowledge graph for any project — built to make Claude Code (or any MCP client)<br> dramatically cheaper and smarter on your codebase. </p>
<p align="center"> <img src="https://img.shields.io/badge/license-MIT-4fc59a" alt="MIT license"> <img src="https://img.shields.io/badge/node-%E2%89%A522.5-9d8cff" alt="Node 22.5+"> <img src="https://img.shields.io/badge/dependencies-zero-d97757" alt="Zero dependencies"> <img src="https://img.shields.io/badge/MCP%20tools-7-5eb3d6" alt="7 MCP tools"> </p>
<p align="center"> <b>English</b> · <a href="README.ru.md">Русский</a> · <a href="README.az.md">Azərbaycanca</a> · <a href="README.tr.md">Türkçe</a> · <a href="README.es.md">Español</a> </p>
Graph X automatically indexes every file in a folder, extracts the relationships between them — imports, doc links, tests, semantic similarity — and stores them in a local SQLite graph. That graph is then served two ways: to Claude Code through 7 MCP tools, and to you as an interactive, live-updating force-directed graph in the browser.
Why it exists: without a graph, Claude re-reads your files from scratch every session — tens of thousands of tokens just to "learn" the project. With Graph X, Claude queries the graph first (a full project map costs ~600 tokens, a file summary ~200) and only opens the 2–3 files that actually matter. Typical result: 8–10× fewer tokens per session, faster answers, better focus.
This is the tool's own repository rendered by its own snapshot command:
(Formerly "bilik-qrafi" — Azerbaijani for "knowledge graph".)
Highlights
- Zero dependencies. No
npm install, ever. One Node.js binary, built-innode:sqliteandnode:zlib. The MCP protocol, PDF/DOCX text extraction, TF-IDF semantic search, HTTP/SSE server and graph physics are all hand-rolled in ~2,500 lines. - Incremental & live. Hash-based indexing (a no-change re-index takes ~10 ms on this repo); a file watcher re-indexes on save and pushes updates to the browser over SSE.
- Understands more than code. JS/TS, Python, PHP, Vue/Svelte, HTML, CSS — plus Markdown links,
[[wiki-links]], and full text inside PDF and DOCX files. - Finds hidden structure. TF-IDF semantic edges connect files that talk about the same thing even when no import or link exists between them.
- Claude-native. One
setupcommand registers the MCP server, teaches Claude the "query the graph before reading files" rule, and lets Claude render the graph for you on request. - Neumorphic UI. Soft light/dark chrome, keyboard-first (
/to search,Escto reset), impact mode that shows what breaks if a file changes.
Quickstart
Requirements: Node.js ≥ 22.5 on your PATH, or a portable node.exe dropped at .tools/node/node.exe (no admin rights needed — grab it from nodejs.org/dist).
graphx index . # build the graph for the current folder
graphx stats . # print the project map in the terminal
graphx serve . # interactive graph at http://localhost:7341
Windows: graphx.cmd (or double-click graph.cmd to start the server and open the browser). macOS/Linux: ./graphx.sh.
Try the demo
The repo ships with a small but realistic project — demo/shop-api — an Express e-commerce API with an auth stack, routes, a database layer, payments, docs and tests. Its graph looks like this:
Notice what the graph surfaces instantly: docs/architecture.md and src/auth/login.js are the most connected nodes, tests attach to what they cover with their own edge kind, and dashed lines mark documentation and semantic links. Explore it live:
graphx serve demo/shop-api --port 7345
Use it with Claude Code
One command attaches Graph X to any project:
graphx setup C:\path\to\your-project
It writes four things into the target project (and nothing else), then runs the first index:
| File | Purpose |
|---|---|
.mcp.json |
Registers the graph-x MCP server for that folder |
CLAUDE.md |
Appends the rule: query the graph before reading files |
.claude/launch.json |
Lets Claude start the graph UI itself when you ask to see it |
.gitignore |
Excludes the .graph/ database |
Restart your Claude Code session in that folder and Claude gains seven tools:
| Tool | What it does | ≈Tokens |
|---|---|---|
project_map |
Whole-project map: counts, folders, hub files with summaries | 600 |
find_relevant |
Semantic + structural search, ranked with summaries | 300–1k |
get_summary |
One file's summary, exports, dependencies — without reading it | 200 |
get_connections |
Every inbound/outbound edge of a file | 300 |
impact_analysis |
Reverse-dependency BFS: what breaks if this file changes | 500 |
graph_snapshot |
Renders the graph to SVG so Claude can show it in chat | 100 |
reindex |
Incremental re-scan after big refactors | 100 |
A typical session then looks like: "where is authentication handled?" → Claude calls project_map, then find_relevant("authentication"), then reads only the one or two files that matter. The graph keeps itself fresh — any tool call re-checks the filesystem if the index is older than 60 seconds.
Full walkthrough: docs/SETUP.md · Tool reference: docs/MCP-TOOLS.md
The graph UI
Node = file (color = type, size = connections). Line = relationship (dashed = doc/semantic). Drag nodes, pan and zoom, click a node for its summary, connections and token stats. / focuses search, type chips filter, and impact mode paints the clay-colored wave of files that transitively depend on the one you click. The sun/moon button flips the neumorphic chrome between light and dark.
Adding data
There is no import step — drop files into the indexed folder:
| Kind | Formats | What gets extracted |
|---|---|---|
| Code | JS/TS/JSX/TSX, Python, PHP, Vue, Svelte, HTML, CSS/SCSS… | imports/exports, functions, classes → structural edges |
| Notes | .md (links + [[wiki-links]]), .txt, .rst |
links, headings → doc edges |
| Documents | .pdf, .docx |
full text via the built-in zero-dep extractor → searchable, semantically linked |
| Config | package.json, .env, YAML/TOML/JSON |
dependencies, entry points |
While serve runs, changes appear in the browser within ~2 seconds. Scanned (image-only) PDFs are indexed as metadata-only nodes — no OCR yet.
For a personal knowledge base, point it at a vault folder: graphx setup C:\Vault && graphx serve C:\Vault --port 7342. Every folder gets its own independent .graph/graph.db.
Index a GitHub repository
No git required — Graph X downloads the archive over HTTPS and unpacks it with its own zip reader:
graphx github vercel/next.js # owner/name (default branch)
graphx github owner/repo#dev my-folder # branch + custom target
The repo arrives already indexed and Claude-ready (setup runs automatically).
Settings
Optional per-project graphx.config.json (template: graphx config --init):
{
"port": 7341,
"ignoreDirs": ["legacy"],
"ignoreFiles": ["*.generated.ts"],
"semanticThreshold": 0.36,
"staleSeconds": 60
}
This repository uses one to keep demo/ out of its own graph. All keys: docs/CONFIGURATION.md.
CLI reference
| Command | Description |
|---|---|
graphx index [path] [--force] |
Incremental index (hash-based); --force rebuilds everything |
graphx stats [path] |
Project map in the terminal |
graphx serve [path] [--port n] |
Web UI + live watch |
graphx mcp [path] |
MCP server over stdio (used by Claude Code) |
graphx setup [path] |
Attach to a project (MCP + rules + launch config + first index) |
graphx snapshot [path] [--out f] [--max n] |
Render the graph to a standalone SVG |
graphx github <repo> [dir] |
Download a GitHub repo and attach the graph |
graphx config [path] [--init] |
Show effective settings / create a config file |
Architecture
files → watcher (hash diff) → parsers (imports/links) + PDF/DOCX extractor + TF-IDF
↓
SQLite .graph/graph.db (files / edges / meta)
↓ ↓
MCP server (stdio) HTTP + SSE server
↓ ↓
Claude Code browser graph UI
Module-by-module notes live in CLAUDE.md.
Limitations & roadmap
Parsing is regex-based (tree-sitter planned) — string literals can occasionally leak keywords. Summaries are structural (LLM summaries planned). Semantic search is TF-IDF (neural embeddings planned). No OCR for scanned PDFs; XLSX/PPTX not indexed yet.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。