{"id":50704347,"url":"https://github.com/ildus/grph","last_synced_at":"2026-06-09T10:32:03.428Z","repository":{"id":362835783,"uuid":"1257457557","full_name":"ildus/grph","owner":"ildus","description":"Self-contained code intelligence CLI + MCP and LSP servers","archived":false,"fork":false,"pushed_at":"2026-06-06T05:25:52.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-06T07:11:05.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ildus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-02T17:40:50.000Z","updated_at":"2026-06-06T05:25:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ildus/grph","commit_stats":null,"previous_names":["ildus/grph"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ildus/grph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ildus%2Fgrph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ildus%2Fgrph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ildus%2Fgrph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ildus%2Fgrph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ildus","download_url":"https://codeload.github.com/ildus/grph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ildus%2Fgrph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34103355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-09T10:32:01.937Z","updated_at":"2026-06-09T10:32:03.397Z","avatar_url":"https://github.com/ildus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grph\n\nSelf-contained code intelligence CLI + MCP and LSP servers — a single binary\nfor semantic search, call graph traversal, and AI agent context across\nRust, Python, JavaScript/TypeScript, Go, C/C++, Shell, and embedded SQL/C.**\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Rust](https://img.shields.io/badge/rust-1.80+-orange.svg)](https://www.rust-lang.org)\n\n---\n\n## Features\n\n- **Code graph extraction** — Functions, classes, interfaces, methods, imports, constants, decorators, and their relationships (`calls`, `contains`, `imports`, `extends`, `implements`, `decorates`)\n- **Tree-sitter first, regex fallback** — precise AST extraction for supported languages; regex as safety net\n- **Incremental sync** — `sync` detects changed files and replaces only stale graph fragments\n- **Call graph traversal** — `callers`, `callees`, and bounded BFS `trace` between symbols\n- **AI context builder** — Extracts keyword-matched source slices for agent task descriptions\n- **MCP server** — JSON-RPC over stdio, 11 tools, compatible with Claude Desktop, opencode, Goose, and other MCP clients\n- **LSP server** — JSON-RPC over stdio for editor features backed by the same `.grph/grph.db` index\n- **Single binary** — ~12–14 MB, zero runtime dependencies\n- **`.gitignore`-aware** — Uses the `ignore` crate; skips `node_modules/`, `target/`, etc.\n\n## Supported Languages\n\n| Language | Extensions |\n|----------|------------|\n| Rust | `.rs` |\n| Python | `.py`, `.pyw`, `.pyi` |\n| JavaScript | `.js`, `.mjs`, `.cjs`, `.jsx` |\n| TypeScript | `.ts`, `.tsx` |\n| Go | `.go` |\n| C | `.c`, `.h` |\n| C++ | `.cpp`, `.cc`, `.cxx`, `.c++`, `.hpp`, `.hxx`, `.h++` |\n| Shell | `.sh`, `.bash` |\n| ESQL/C and EQUEL/C | `.sc`, `.qsc`, `.qsh` |\n\n## Installation\n\n```bash\n# From source (requires Rust 1.80+)\ncargo install --path grph-cli\n\n# Or build locally\ncargo build --release\n# Binary at: target/release/grph\n```\n\n## Quick Start\n\n```bash\n# Initialize the code graph in your project\ngrph init -i\n\n# Search for symbols\ngrph query \"handle_login\"\n\n# Search with JSON output\ngrph query \"handle_login\" --json\n\n# Find who calls a function\ngrph callers handle_login\n\n# Find what a function calls\ngrph callees handle_login\n\n# Trace a path between two symbols\ngrph trace authenticate handle_login\n\n# See project stats\ngrph status\n\n# Build AI agent context for a task\ngrph context \"fix the authentication bug in login handler\"\n\n# Start the MCP server from the current project\ngrph serve --mcp\n\n# Start the LSP server from the current project\ngrph serve --lsp\n```\n\n## CLI Commands\n\n| Command | Description |\n|---------|-------------|\n| `grph init` | Initialize `.grph/grph.db` database |\n| `grph init -i [--no-resolve]` | Initialize + index all files |\n| `grph index [--force] [--quiet] [--no-resolve] [-j \u003cn\u003e] [path]` | Extract symbols and edges from all source files |\n| `grph sync [--file \u003cpath\u003e] [--resolve] [--resolve-limit \u003cn\u003e] [path]` | Incremental sync, or resolve pending references without re-indexing |\n| `grph status` | Show file / node / edge counts |\n| `grph query \u003cname\u003e [--kind \u003ckind\u003e] [--limit \u003cn\u003e] [--json]` | LIKE-based search for symbols |\n| `grph files [--format \u003cfmt\u003e] [--filter \u003cpattern\u003e] [--max-depth \u003cn\u003e] [--json]` | List indexed files |\n| `grph callers \u003csymbol\u003e [--limit \u003cn\u003e] [--json]` | Find incoming `calls` edges |\n| `grph callees \u003csymbol\u003e [--limit \u003cn\u003e] [--json]` | Find outgoing `calls` edges |\n| `grph trace \u003cfrom\u003e \u003cto\u003e` | Bounded BFS path between two symbols |\n| `grph context \u003ctask\u003e` | Extract code context for an AI agent task |\n| `grph explore \u003cquery\u003e` | Grouped symbols + source snippets |\n| `grph impact \u003csymbol\u003e [--depth \u003cn\u003e] [--json]` | Impact radius analysis |\n| `grph ctags [--output \u003cpath\u003e]` | Generate Universal Ctags-compatible `tags` file |\n| `grph serve --mcp [--path \u003cpath\u003e]` | Start MCP JSON-RPC server over stdio |\n| `grph serve --lsp [--path \u003cpath\u003e]` | Start LSP JSON-RPC server over stdio |\n| `grph uninit [--force] [path]` | Remove `.grph` from a project |\n\n## Ctags Generation\n\nGenerate a Universal Ctags-compatible `tags` file from indexed nodes — no re-parsing required. The tags use the tree-sitter line numbers already stored in the database.\n\n```bash\n# Generate tags in the project root\ngrph ctags\n\n# Write to a custom path\ngrph ctags --output ~/.tags/myproject\n```\n\n**Output format** — extended format (`format=2`) with line-number addresses:\n\n- Standard `{name}\\t{file}\\t{line};\"\\t{kind}` fields\n- Extended fields: `kind:`, `line:`, `end:`, `language:`, `qualified:`, `signature:`\n- Sorted alphabetically by name → file → line\n- Header includes `!_TAG_FILE_FORMAT`, `!_TAG_FILE_SORTED`, `!_TAG_PROGRAM_NAME`, `!_TAG_PROGRAM_VERSION`\n- Kind letters follow Universal Ctags conventions (`f`=function, `c`=class, `s`=struct, `m`=method, etc.)\n\nWorks with any editor that reads ctags files (Vim, Neovim, Emacs, VS Code with ctags extension).\n\n## MCP Server\n\nStart the MCP server for use with AI coding assistants:\n\n```bash\ngrph serve --mcp\n```\n\n`grph serve --mcp` uses the current directory by default. Pass `--path /path/to/project` when the MCP client cannot set `cwd`.\n\nConfigure your MCP client (e.g., Claude Desktop):\n\n```json\n{\n  \"mcpServers\": {\n    \"grph\": {\n      \"command\": \"grph\",\n      \"args\": [\"serve\", \"--mcp\"],\n      \"cwd\": \"/path/to/your/project\"\n    }\n  }\n}\n```\n\n### MCP Tools\n\nThese are the tool names returned by `tools/list` and accepted by `tools/call`:\n\n| Tool | Required arguments | Optional arguments | Description |\n|------|--------------------|--------------------|-------------|\n| `grph_search` | `query` | `kind`, `limit`, `json`, `projectPath` | Search symbols by name prefix |\n| `grph_context` | `task` | `max_nodes`, `projectPath` | Build AI context for a task |\n| `grph_callers` | `symbol` | `limit`, `projectPath` | Find what calls a symbol |\n| `grph_uncalled` | | `limit`, `json`, `projectPath` | List functions with no callers |\n| `grph_callees` | `symbol` | `limit`, `projectPath` | Find what a symbol calls |\n| `grph_impact` | `symbol` | `depth`, `projectPath` | Analyze impact radius |\n| `grph_node` | `symbol` | `projectPath` | Return one symbol node as JSON |\n| `grph_status` | | `projectPath` | Show index statistics |\n| `grph_files` | | `json`, `projectPath` | List indexed files |\n| `grph_trace` | `from`, `to` | `projectPath` | Trace a call path between two symbols |\n| `grph_explore` | `query` | `max_files`, `projectPath` | Explore symbols grouped by file |\n\nExample `tools/call` requests:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"grph_search\",\"arguments\":{\"query\":\"handle_login\",\"limit\":20}}}\n```\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"grph_callers\",\"arguments\":{\"symbol\":\"handle_login\",\"projectPath\":\"/path/to/project\"}}}\n```\n\nTool arguments use snake_case for grph-specific options, such as `max_nodes` and `max_files`. `projectPath` selects the project root when the MCP client cannot provide one through `cwd`, `rootUri`, or `workspaceFolders`.\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `GRPH_MCP_TOOLS` | (all) | Comma-separated allowlist of MCP tools |\n| `GRPH_MCP_FRAME_BYTES` | `1048576` | Max `Content-Length` frame size in bytes |\n| `GRPH_MCP_MAX_MESSAGE_BYTES` | `1048576` | Max newline-delimited JSON message size in bytes |\n\n## LSP Server\n\nStart the LSP server for editors that can launch a stdio language server:\n\n```bash\ngrph serve --lsp\n```\n\n`grph serve --lsp` uses the current directory by default. Pass `--path /path/to/project` when the editor cannot set `cwd`. The project must already be initialized and indexed with `grph init -i`.\n\nSupported LSP features:\n\n- Document symbols\n- Go to definition\n- References\n- Hover\n- Workspace symbol search\n- Call hierarchy incoming and outgoing calls\n- Incremental sync on document save\n\n## Project Structure\n\n```\ngrph/\n├── grph-core/          # Core library — extraction, DB, graph traversal\n│   └── src/\n│       ├── extraction/  # Tree-sitter \u0026 regex extractors\n│       ├── db/          # SQLite schema \u0026 queries\n│       ├── graph/       # BFS, callers, callees, impact_radius\n│       ├── context/     # AI context builder\n│       ├── search/      # Symbol search\n│       └── resolution/  # Cross-file reference resolution\n├── grph-cli/           # CLI binary (clap-based)\n├── grph-mcp/           # MCP JSON-RPC server\n├── grph-lsp/           # LSP JSON-RPC server\n├── Cargo.toml          # Workspace root\n└── README.md           # This file\n```\n\n## How It Works\n\n1. **Extraction** — Walks source files with `ignore::WalkBuilder`, parses each file with tree-sitter, extracts nodes (functions, classes, etc.) and edges (`calls`, `contains`, `extends`, `implements`, `decorates`). Falls back to regex if a tree-sitter grammar is unavailable.\n\n2. **Resolution** — Resolves call targets to node IDs within the same file during extraction. Captures unresolved cross-file references and resolves them in a post-indexing pass.\n\n3. **Storage** — Nodes and edges stored in SQLite (`grph.db`). Schema includes indexes for fast symbol lookup and graph traversal.\n\n4. **Integration transports** — MCP and LSP both use JSON-RPC 2.0 over stdio. MCP supports Content-Length framing and line-delimited JSON, while LSP uses standard Content-Length framing.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fildus%2Fgrph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fildus%2Fgrph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fildus%2Fgrph/lists"}