|
| 1 | +<p align="center"> |
| 2 | + <img src="website/public/logo.svg" width="120" alt="IGraph Logo" /> |
| 3 | +</p> |
| 4 | + |
| 5 | +<h1 align="center">IGraph</h1> |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + Code knowledge graph builder — Parsing → Semantics → Vectorization |
| 9 | +</p> |
| 10 | + |
| 11 | +<p align="center"> |
| 12 | + <a href="README.md">简体中文</a> · English |
| 13 | +</p> |
| 14 | + |
| 15 | +<p align="center"> |
| 16 | + <a href="https://www.npmjs.com/package/igraph-cli"><img src="https://img.shields.io/npm/v/igraph-cli?color=blue&label=npm" alt="npm version" /></a> |
| 17 | + <a href="https://github.com/Ychangqing/IGraph/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Ychangqing/IGraph" alt="license" /></a> |
| 18 | + <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="node version" /></a> |
| 19 | + <a href="https://github.com/Ychangqing/IGraph/actions"><img src="https://img.shields.io/github/actions/workflow/status/Ychangqing/IGraph/deploy-docs.yml?label=docs" alt="docs build" /></a> |
| 20 | + <a href="https://github.com/Ychangqing/IGraph/issues"><img src="https://img.shields.io/github/issues/Ychangqing/IGraph" alt="issues" /></a> |
| 21 | +</p> |
| 22 | + |
| 23 | +<p align="center"> |
| 24 | + <a href="https://ychangqing.github.io/IGraph/">Documentation</a> · |
| 25 | + <a href="https://ychangqing.github.io/IGraph/guide/quick-start">Quick Start</a> · |
| 26 | + <a href="https://ychangqing.github.io/IGraph/reference/cli">CLI Reference</a> · |
| 27 | + <a href="https://ychangqing.github.io/IGraph/features/mcp">MCP Integration</a> |
| 28 | +</p> |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 🎯 Introduction |
| 33 | + |
| 34 | +IGraph parses a code repository into a knowledge graph made of symbol nodes and call-relation edges. It enriches that graph with LLM-generated semantic summaries and vector indexes, then serves retrieval through dual-channel RRF fusion across dense vectors and FTS5 full-text search. It can also mount multimodal resources such as PRDs and DB schemas to build cross-modal associations, and includes an MCP Server that connects directly to AI assistants such as Cursor and Claude Code. |
| 35 | + |
| 36 | +## ✨ Core Capabilities |
| 37 | + |
| 38 | +| Capability | Description | |
| 39 | +|------------|-------------| |
| 40 | +| 🌳 Multi-language parsing | A tree-sitter powered 5-pass pipeline supporting TypeScript, JavaScript, Python, Go, and Java | |
| 41 | +| 🧠 Semantic summaries | Uses an LLM to summarize files and symbols, with heuristic fallback when `--no-llm` is enabled | |
| 42 | +| 🔍 Dual-channel retrieval | BGE-M3 vectors plus FTS5 full-text search, fused through RRF | |
| 43 | +| 📎 Multimodal mounting | Builds cross-modal links for PRD documents and DB schemas based on semantic similarity | |
| 44 | +| ⚡ Incremental builds | Cascading updates based on SHA-256 diffs, rebuilding only affected files | |
| 45 | +| 🤖 MCP integration | Connects to Cursor and Claude Code with a single command | |
| 46 | + |
| 47 | +## 📦 Installation |
| 48 | + |
| 49 | +**Requirements:** Node.js >= 18 and a C/C++ build toolchain for native dependencies. |
| 50 | + |
| 51 | +```bash |
| 52 | +# Install globally |
| 53 | +npm install -g igraph-cli |
| 54 | + |
| 55 | +# Or install locally in a project |
| 56 | +npm install igraph-cli |
| 57 | +``` |
| 58 | + |
| 59 | +<details> |
| 60 | +<summary>Build toolchain setup</summary> |
| 61 | + |
| 62 | +- **macOS:** `xcode-select --install` |
| 63 | +- **Linux:** `sudo apt install build-essential python3` |
| 64 | +- **Windows:** Visual Studio Build Tools |
| 65 | + |
| 66 | +</details> |
| 67 | + |
| 68 | +## 🚀 Quick Start |
| 69 | + |
| 70 | +```bash |
| 71 | +# 1. Initialize |
| 72 | +igraph init |
| 73 | + |
| 74 | +# 2. Add credentials (global config shared by all projects) |
| 75 | +igraph config set apiKey sk-... |
| 76 | + |
| 77 | +# 3. Build the graph |
| 78 | +igraph build |
| 79 | + |
| 80 | +# 4. Register the MCP Server with an AI assistant |
| 81 | +igraph register |
| 82 | + |
| 83 | +# 5. Query in natural language |
| 84 | +igraph query "Where is user authentication implemented?" |
| 85 | +``` |
| 86 | + |
| 87 | +> If no API key is available, run `igraph build --no-llm` to use heuristic fallback. `query` and `serve` will automatically fall back to FTS5-only retrieval. |
| 88 | +
|
| 89 | +For more usage details, see the [documentation](https://ychangqing.github.io/IGraph/guide/quick-start). |
| 90 | + |
| 91 | +## 🤖 MCP Integration |
| 92 | + |
| 93 | +```bash |
| 94 | +# Automatically detect installed AI assistants and register |
| 95 | +igraph register |
| 96 | + |
| 97 | +# Specify a target |
| 98 | +igraph register --target claude |
| 99 | +igraph register --target cursor |
| 100 | + |
| 101 | +# Unregister |
| 102 | +igraph unregister |
| 103 | +``` |
| 104 | + |
| 105 | +After registration, AI assistants can directly call four read-only retrieval tools: |
| 106 | + |
| 107 | +| Tool | Description | |
| 108 | +|------|-------------| |
| 109 | +| `igraph_explore` | Natural-language retrieval with expanded graph context | |
| 110 | +| `igraph_node` | Get node details by symbol name | |
| 111 | +| `igraph_file` | Get graph information by file path | |
| 112 | +| `igraph_related` | Expand related resources for a symbol | |
| 113 | + |
| 114 | +See the [MCP Tool documentation](https://ychangqing.github.io/IGraph/reference/mcp-tools) for details. |
| 115 | + |
| 116 | +## 📋 Command Cheat Sheet |
| 117 | + |
| 118 | +| Command | Description | |
| 119 | +|---------|-------------| |
| 120 | +| `igraph init` | Initialize configuration | |
| 121 | +| `igraph build` | Build the graph with automatic incremental updates | |
| 122 | +| `igraph rebuild` | Clear data and rebuild from scratch | |
| 123 | +| `igraph status` | Show graph status | |
| 124 | +| `igraph query` | Run natural-language retrieval | |
| 125 | +| `igraph eval` | Evaluate retrieval quality | |
| 126 | +| `igraph serve` | Start the MCP Server | |
| 127 | +| `igraph register` | Register with an AI assistant | |
| 128 | +| `igraph mount prd` | Mount PRD documents | |
| 129 | +| `igraph mount db` | Mount DB schemas | |
| 130 | +| `igraph config` | Manage global configuration | |
| 131 | + |
| 132 | +## 🗂 Supported Languages and Formats |
| 133 | + |
| 134 | +| Category | Language / Type | Extensions | |
| 135 | +|----------|-----------------|------------| |
| 136 | +| Code | TypeScript | `.ts` `.tsx` `.mts` `.cts` | |
| 137 | +| Code | JavaScript | `.js` `.jsx` `.mjs` `.cjs` | |
| 138 | +| Code | Python | `.py` `.pyi` | |
| 139 | +| Code | Go | `.go` | |
| 140 | +| Code | Java | `.java` | |
| 141 | +| Multimodal | PRD documents | `.md` `.txt` `.pdf` `.docx` | |
| 142 | +| Multimodal | DB schemas | `.sql` `.ddl` `.json` `.xlsx` | |
| 143 | + |
| 144 | +## 🛠 Development |
| 145 | + |
| 146 | +```bash |
| 147 | +npm run dev # watch mode |
| 148 | +npm test # vitest |
| 149 | +npm run lint # eslint |
| 150 | +npm run typecheck # type checking |
| 151 | +npm run build # build |
| 152 | +``` |
| 153 | + |
| 154 | +## 🤝 Contributing |
| 155 | + |
| 156 | +Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. |
| 157 | + |
| 158 | +## 📄 License |
| 159 | + |
| 160 | +[MIT](LICENSE) © 2024-present IGraph |
0 commit comments