Логотип GraphHub

GraphHub

Спільнота
slnquangtran

Local-first code intelligence for AI agents. Transform your codebase into a queryable knowledge graph. 85% token savings for Claude Code, Cursor, and MCP-compatible tools.

Видавецьslnquangtran
РепозиторійGraph-Hub
МоваTypeScript
Форки
0
Зірки
16
Доступні інструменти
0
Тип транспортуstdio
Категорії
Посилання
  • Підключайте інструменти до робочих процесів із ШІ

    GraphHub надає можливості MCP, які можуть використовувати сумісні клієнтські ШІ-застосунки та агенти.

  • Доступні інструменти: 0

    Перегляньте нижче дії, які можна викликати, з назвами й описами, якщо сервер їх надає.

  • Готова конфігурація для копіювання

    Скористайтеся прикладами конфігурації, щоб налаштувати цей сервер у вибраному клієнті MCP.

  • Показники інтересу до відкритого коду

    Зірки: 16, форки: 0 — у пов’язаному репозиторії.

Version Stars License Node

TypeScript MCP KuzuDB Tests

Quick Start · How It Works · MCP Tools · Token Savings · Roadmap


The Problem

AI coding assistants lose context between sessions. They re-read the same files, re-learn your codebase, and burn tokens on questions they've already answered.

ApproachTokens UsedWhat Happens
Traditional9,216grep → read 5 files → hope for the best
GraphHub507get_context("functionName") → done ✓

94% fewer tokens. Same answer. Every time.


⚡ Quick Start

bash
npm install graphhub

One command. GraphHub auto-detects every AI agent on your machine and writes to their global configs — no per-project setup, ever.

bash
npx graphhub setup                                # auto-detect + install present clients
npx graphhub setup --force                        # install for all 5 clients regardless
npx graphhub setup --client claude-code,kilo-cli  # pick specific clients
npx graphhub setup --dry-run                      # preview what would be installed
npx graphhub setup --list                         # list all supported clients
npx graphhub uninstall-all                        # remove from all clients
bash
git clone https://github.com/slnquangtran/Graph-Hub.git
cd Graph-Hub && npm install

npm run index -- /path/to/your/project
npm run setup -- /path/to/your/project

🧠 How It Works

  Your Source Code
        │
        ▼
  ┌─────────────────┐     ┌──────────────────┐
  │  Tree-sitter    │────▶│  KuzuDB Graph DB │
  │  AST Parser     │     │                  │
  │  TS · JS · PY   │     │  File ──CONTAINS─▶ Symbol
  └─────────────────┘     │  Symbol ──CALLS──▶ Symbol
        │                 │  File ──IMPORTS──▶ File
        ▼                 │  Symbol ──INHERITS▶ Symbol
  ┌─────────────────┐     └────────┬─────────┘
  │  Local Embeddings│             │
  │  (MiniLM-L6-v2) │      ┌──────▼──────────┐
  │  No API needed   │      │   MCP Server    │
  └─────────────────┘      │   REST API :9000 │
                            │   Dashboard :5173│
                            └─────────────────┘

Supported AI Agents

AgentGlobal ConfigStatus
Claude~/.claude/settings.json✅ Full support
OpenCode~/.config/opencode/opencode.json✅ Full support
Gemini~/.gemini/settings.json✅ Full support
Antigravity~/.antigravity/mcp.json✅ Full support
Kilo~/.config/kilo/kilo.json✅ Full support

📊 Token Savings

Real measurements on GraphHub's own codebase — not synthetic benchmarks.

TaskWithout GraphHubWith GraphHubSavings
Find function callers9,216507🟢 94%
Impact analysis7,281673🟢 91%
List file symbols2,745322🟢 88%
Search code logic2,115759🟡 64%
Codebase overview2,3811,389🟡 42%
Total23,7383,650🚀 85%

Result: 5× more tasks in the same context window.


🛠 MCP Tools

GraphHub registers 27 MCP tools across 7 categories. Click each to expand.

typescript
// Natural language → code
semantic_search({ query: "authentication validation", mode: "hybrid" })

// Exact or fuzzy symbol name
search_by_name({ name: "validateToken" })

// Results grouped by file
search_grouped({ query: "error handling middleware" })

// Cosine-similar symbols
find_similar({ name: "parseRequest", top_k: 5 })

// Explain which strategy was chosen
explain_search({ query: "jwt token refresh" })
typescript
// Callers + callees of a symbol
get_context({ name: "validateToken" })

// Full blast radius before you edit
impact_analysis({ name: "handleRequest" })

// Callers/callees for many symbols at once
batch_context({ names: ["validateToken", "handleRequest", "parseBody"] })

// Symbols in git-changed files + risk buckets
changed_symbols({ diff: "staged" })

// Raw Cypher for power users
query_graph({ cypher: "MATCH (s:Symbol)-[:CALLS]->(t) RETURN s.name, t.name LIMIT 20" })

// All symbols in a file
get_file_symbols({ path: "src/services/auth/token.ts" })
typescript
// RAG search + context + impact + next steps in one call
debug_trace({ query: "null pointer in auth middleware", top_k: 3 })
typescript
// Find functions/classes nobody calls — safe to delete?
find_dead_code({ kinds: ["function", "method"] })

// Find near-duplicate implementations (uses stored embeddings, no API cost)
find_duplicates({ name: "validateToken", min_similarity: 0.85, cross_file_only: true })

// Detect circular import chains and mutual-recursion call cycles
find_cycles({ type: "both", max_length: 3 })
typescript
// Save a learning
remember({ content: "Auth uses JWT with 15m TTL", type: "learning", project: "myapp" })

// Retrieve by similarity
recall({ query: "how does auth work?" })

// Chronological view
timeline({ limit: 20, project: "myapp" })

// Update or delete
update_observation({ id: "abc-123", content: "Updated: now uses refresh tokens" })
forget({ project: "myapp", type: "learning" })

// Linked to specific symbols
related_observations({ symbol: "validateToken" })
typescript
// Store a bug fix pattern
remember_bugfix({
  symptom: "TypeError: Cannot read property user of undefined",
  root_cause: "req.session was null on the /guest route",
  fix: "Added session guard at middleware entry",
})

// Recall by symptom similarity — even next week
recall_bugfix({ symptom: "undefined user property on guest route" })

// Cache which skill worked for a task
remember_skill_choice({
  task_description: "rename a function safely across the repo",
  skill_path: ".claude/skills/refactoring/SKILL.md",
  outcome: "success",
})

// Route future similar tasks to the same skill
recall_skill_choice({ task_description: "rename a symbol in multiple files" })

✨ Features

🧩 Core Intelligence

  • Knowledge Graph — functions, classes, imports, call chains stored in KuzuDB
  • Semantic Search — natural language queries, no API costs (local MiniLM-L6-v2)
  • Impact Analysis — see blast radius before editing, direct + indirect callers
  • Session Memory — remember / recall / forget across sessions
  • Pattern Memory — recall past bug fixes and skill choices by similarity
  • One-Shot Debug — debug_trace chains search → context → impact in one call
  • Batch Context — callers/callees for many symbols in one round trip

🚀 Developer Experience

  • One Command — npm install graphhub configures all detected agents globally
  • 5 Agents — Claude Code, OpenCode, Gemini CLI, Antigravity, Kilo CLI
  • Auto-Reindex — PostToolUse hook keeps graph fresh after commits
  • Always-On — PreToolUse hook reminds Claude about the graph before every search
  • Graph Report — auto-generated GRAPH_REPORT.md with god nodes + clusters
  • 100% Local — all data stays in .graphhub/, no telemetry, no cloud
  • React Dashboard — interactive call graph at :5173

🌐 Language Support

LanguageSupportParser
TypeScript / TSX✅ FullTree-sitter AST
JavaScript / JSX✅ FullTree-sitter AST
Python✅ FullTree-sitter AST
Go · Rust · Java⚡ PartialText chunker
Markdown · Shell✅ FullText chunker

⚙️ Configuration

bash
npx graphhub setup

Auto-detects and writes to each agent's global config — no per-project setup needed.

ClientGlobal Config File
Claude Code~/.claude/settings.json
OpenCode~/.config/opencode/opencode.json
Gemini CLI~/.gemini/settings.json
Antigravity~/.antigravity/mcp.json
Kilo CLI~/.config/kilo/kilo.json

Existing keys are preserved — only the graphhub entry is added or updated. Use --force to install for agents that aren't yet present. A postinstall hook runs automatically after npm install graphhub; opt out with GRAPHHUB_NO_INSTALL=1, CI=1, or npm_config_global=true.

bash
npm run install-claude

Adds PreToolUse/PostToolUse hooks and updates CLAUDE.md. The setup command above covers MCP config only.

json
{
  "mcpServers": {
    "graphhub": {
      "command": "npx",
      "args": ["tsx", "src/index.ts", "serve"],
      "cwd": "/path/to/graphhub"
    }
  }
}

📋 Commands

CommandDescription
npm run index -- <dir>Index a directory into the knowledge graph
npm run serveStart MCP server (stdio)
npm run serve-apiStart REST API on port 9000
npm run dashboardStart API + React dashboard
npm run reportGenerate GRAPH_REPORT.md
npm run visualizeExport graph to Mermaid format
npm run setupConfigure all supported MCP clients
npm run uninstall-allRemove GraphHub from all clients
npm run install-claudeConfigure Claude Code hooks + CLAUDE.md (legacy)
npm testRun 77-test suite

🏗 Tech Stack

ComponentTechnology
Parserweb-tree-sitter (WASM)
DatabaseKuzuDB (embedded graph)
Embeddings@xenova/transformers · all-MiniLM-L6-v2
MCP@modelcontextprotocol/sdk
APIExpress.js
DashboardReact + Vite + React Flow
TestsVitest · 77 tests

🗺 Roadmap

  • Session memory (remember / recall / forget)
  • Always-on PreToolUse hooks
  • PostToolUse auto-reindex
  • Graph report generation
  • Verified 85% token reduction
  • Class hierarchy edges (INHERITS, IMPLEMENTS)
  • One-shot debug_trace and bulk batch_context
  • Pattern memory for bug fixes and skill routing
  • One-command multi-client setup (Claude Code, OpenCode, Gemini CLI, Antigravity, Kilo CLI)
  • Global install — writes to home-dir configs so all projects benefit without per-project setup
  • .gitignore support (cross-platform, including Windows path normalization)
  • Proper database lifecycle — close() releases the file lock on MCP server, watch mode, and CLI exit

Coming next:

  • Dead code detection (find_dead_code)
  • Duplicate function detection (find_duplicates)
  • Circular dependency / call cycle detection (find_cycles)
  • Worker thread indexing for large repos
  • Native Go / Rust / Java Tree-sitter grammars
  • Community detection (Leiden algorithm)

📜 Changelog

  • find_dead_code — Find functions, methods, and classes with zero callers. Common entry-point patterns (main, init, onX, handleX…) are filtered automatically; pass include_entry_points: true to see everything.
  • find_duplicates — Find near-duplicate implementations of any symbol using stored cosine embeddings. No API cost — works offline. Supports min_similarity threshold and cross_file_only filter.
  • find_cycles — Detect circular import chains and mutual-recursion call cycles up to length 3. Reports each cycle as an ordered list of file paths (import) or symbol names (call).
  • 14 new tests — Full coverage of entry-point filtering, cycle detection, similarity threshold, and cross-file filtering.
  • Global install — All adapters now write to home-dir global configs (~/.claude/, ~/.gemini/, etc.) so one npx graphhub setup --force covers every project without per-project setup
  • Kilo CLI support — New adapter for Kilo CLI (~/.config/kilo/kilo.json)
  • graphhubDir fix — npx graphhub setup now correctly resolves the package location from import.meta.url instead of process.cwd() (which pointed to the user's project, causing broken MCP server paths)
  • Gemini CLI fix — Was writing to <project>/.gemini/ instead of ~/.gemini/; fixed to use home dir
  • Windows path fix — MCP server entry paths now always use forward slashes in JSON configs
  • DB lifecycle fix — MCP server, watch mode, and all CLI commands now properly release the KuzuDB file lock on exit
  • .gitignore support — cross-platform path normalization (fixes Windows \ vs / mismatch)
  • Python parser — upgraded to full Tree-sitter AST extraction (functions, classes, calls, inheritance)
  • Import alias resolution — import { foo as bar } now stores foo as the specifier, fixing cross-file call graph edges
  • Fuzzy symbol search — case-insensitive (toLower(s.name) CONTAINS query)
  • forget() safety — requires at least one filter; no longer silently deletes all observations
  • MCP get_file_symbols — fixed: was returning an empty object (raw DB cursor)
  • Error resilience — per-file parse errors no longer abort the entire indexing run
  • BigInt coercion — KuzuDB count() results coerced to Number; JSON.stringify no longer throws on stats

🤝 Contributing

Contributions are welcome! Feel free to open an issue or submit a PR.

bash
git clone https://github.com/slnquangtran/Graph-Hub.git
cd Graph-Hub && npm install

npm test                    # run 77 tests
npm run index -- ./src      # index GraphHub itself

🔒 Privacy

100% LocalAll data stays in .graphhub/ in your project — nothing leaves your machine
No External APIsEmbeddings are generated locally with @xenova/transformers
No TelemetryZero network calls during indexing or querying

📄 License

ISC © 2024


If GraphHub saves you tokens, a ⭐ star helps others find it.

Star on GitHub

Report Bug · Request Feature · Discussions

Встановлення

TypingMind
Передумови:

Node.js 18+

{
  "mcpServers": {
    "slnquangtran-graphhub": {
      "command": "",
      "args": []
    }
  }
}

Використовуйте MCP GraphHub з різними моделями ШІ

TypingMind підключає інструменти MCP на рівні робочого простору, тож після підключення GraphHub ви можете використовувати їх із різними моделями ШІ в TypingMind, а не налаштовувати окремо для кожної моделі. Ця інтеграція MCP працює локально через конектор MCP TypingMind на вашому пристрої.

Інструкція з налаштування локального конектора

Виберіть цей варіант, якщо серверу MCP потрібен доступ до локальних файлів, програм або приватних ресурсів на вашому комп’ютері.

1

Відкрийте налаштування MCP

У TypingMind перейдіть до розділу «Налаштування», відкрийте «Розширені налаштування», потім «Протокол контексту моделі» й виберіть «Параметри конектора».

  1. Відкрийте TypingMind у браузері.
  2. Натисніть значок налаштувань.
  3. Перейдіть до розділу «Розширені налаштування».
  4. Відкрийте розділ «Протокол контексту моделі».
  5. Натисніть «Параметри конектора» й виберіть «Цей пристрій».
Екран налаштування конектора MCP у TypingMind з вибраним варіантом «Цей пристрій»
2

Виконайте команду конектора

Виберіть «Цей пристрій», скопіюйте команду з TypingMind і виконайте її в терміналі. Не зупиняйте процес, поки користуєтеся MCP.

  1. Скопіюйте команду налаштування, показану в TypingMind.
  2. Відкрийте «Термінал» у macOS або Windows Terminal у Windows.
  3. Вставте й виконайте команду.
  4. Підтвердьте встановлення пакета, якщо термінал запитає дозволу продовжити.
  5. Не закривайте вікно термінала й не зупиняйте процес, поки користуєтеся інструментами MCP.
3

Додайте GraphHub як сервер

Коли статус конектора зміниться на «Готово», натисніть «Змінити сервери» та вставте конфігурацію сервера MCP.

  1. Зачекайте, доки статус конектора зміниться на «Готово».
  2. Натисніть «Змінити сервери».
  3. Вставте конфігурацію сервера MCP GraphHub.
  4. Збережіть список серверів.
  5. Оновіть дані, щоб переконатися, що конектор досі готовий до роботи.
Налаштування MCP у TypingMind з активним сервером і кнопкою «Змінити сервери»
{
  "mcpServers": {
    "slnquangtran-graphhub": {
      "command": "npx",
      "args": [
        "-y",
        "graphhub"
      ]
    }
  }
}
4

Використовуйте підключення з різними моделями

Збережіть список серверів, відкрийте «Плагіни», увімкніть інструменти MCP для GraphHub, а потім виберіть будь-яку підтримувану модель ШІ в TypingMind і використовуйте інструменти в чаті або призначте їх агенту ШІ.

  1. Відкрийте сторінку «Плагіни» в TypingMind.
  2. Увімкніть інструменти MCP для GraphHub.
  3. Почніть чат і виберіть модель ШІ, яку хочете використовувати.
  4. Використовуйте інструменти MCP у чаті або призначте їх агенту ШІ.
  5. За потреби перемикайтеся на іншу модель ШІ без повторного підключення MCP.
Чат TypingMind із використанням увімкнених інструментів MCP і вибраної моделі ШІ
Допоможете з цим завданням через GraphHub?
GraphHub
Звісно. Я це прочитав.
Ось що я знайшов за допомогою GraphHub.

Поширені запитання

Для чого використовується сервер MCP GraphHub?

GraphHub — це сервер MCP, який дає змогу сумісним клієнтам ШІ підключатися до зовнішніх інструментів і контексту. У TypingMind ви можете додати цей сервер MCP один раз і зробити його інструменти доступними у своєму робочому просторі ШІ.

Чи можу я використовувати MCP GraphHub з кількома моделями ШІ в TypingMind?

Так. TypingMind підключає інструменти MCP на рівні робочого простору, тому ви можете використовувати GraphHub з різними моделями ШІ, як-от Claude, ChatGPT, Gemini або іншими моделями, які ви налаштували в TypingMind, без окремого налаштування сервера MCP для кожної моделі.

Навіщо використовувати MCP GraphHub із TypingMind?

TypingMind — один із найкращих інтерфейсів для чату з великими мовними моделями, адже він об’єднує різні моделі ШІ, промпти, плагіни, агентів ШІ, ключі API та інструменти MCP в одному робочому просторі. Підключивши GraphHub, ви зможете використовувати його інструменти MCP з вибраними моделями та впорядковано працювати з чатами в TypingMind.

Як підключити MCP GraphHub до TypingMind?

GraphHub працює через локальний конектор MCP TypingMind. Це найкращий варіант, коли серверу MCP потрібен доступ до локальних файлів, настільних застосунків, інструментів командного рядка або приватних ресурсів на вашому комп’ютері.

Які інструменти надає MCP GraphHub у TypingMind?

GraphHub надає можливості MCP, які можна ввімкнути на сторінці «Плагіни» в TypingMind і використовувати в чаті або призначати агентам ШІ.

Чи потрібно передавати свої ключі API в TypingMind, щоб використовувати MCP GraphHub?

Ні. TypingMind орієнтований насамперед на локальну роботу й дає змогу зберігати контроль над постачальниками моделей, ключами API, промптами та конфігурацією MCP. Якщо GraphHub потребує автентифікації, під час створення підключення додайте потрібні заголовки, налаштування OAuth або локальну конфігурацію для цього сервера MCP.

Схожі сервери MCP

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇