Graphify Ts

by mohanagy

381 downloads Not rated yet
GitHub

About

Local MCP server and context compiler that turns TypeScript/Node workspaces into compact, verifiable context packs for AI coding agents.

Explore

- Local-first: no cloud required, your code never leaves your laptop.
- Reduces per-session input tokens by up to 5.28× on measured benchmarks.
- Supports PR review via pr_impact and review-compare tools.
- Works with Claude Code, Cursor, Copilot CLI, Gemini CLI, Aider, Codex CLI, and OpenCode.
- Uses tree-sitter AST for TypeScript/JavaScript with framework-aware passes for 9 substrates.
- Offers MCP tools like retrieve, impact, call_chain, and community_overview.

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:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Graphify Ts
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

```bash
npm install -g @mohammednagy/graphify-ts

cd your-project
graphify-ts generate . # builds graphify-out/graph.json (no API key, no cloud)
graphify-ts claude install # wires Claude Code to use it via MCP
graphify-ts doctor # checks graph freshness + agent/MCP wiring
graphify-ts status # compact readiness summary + next commands

Agent

Connection

Cursor

MCP via `.cursor/mcp.json`

Aider

AGENTS.md context-pack-first profile

OpenCode

AGENTS.md + `.opencode/plugins/graphify-ts.js` + MCP via `opencode.json` / `opencode.jsonc`

retrieve

"How does X work?" — ranked nodes + code snippets + community context

pr_impact

"Is this PR safe to merge?" — diff-aware blast radius + ranked review risks

impact

"What breaks if I refactor X?" — directed dependents + affected communities

call_chain

"How does request flow from X to Y?" — shortest execution paths

community_overview

"Show me the architecture" — communities + sizes + bridges

graph_stats

"How big is this graph?" — node/edge counts, density, file-type mix

graphify-ts produces local context packs that any modern coding agent can consume — over MCP or by piping the compiled prompt to its CLI.

| Agent | Connection | Install command |
|---|---|---|
| Claude Code | MCP via .mcp.json | graphify-ts claude <install|uninstall> [--profile core|full|strict] |
| Cursor | MCP via .cursor/mcp.json | graphify-ts cursor <install|uninstall> [--profile core|full|strict] |
| GitHub Copilot CLI | MCP via .vscode/mcp.json | graphify-ts copilot <install|uninstall> [--profile core|full|strict] |
| Gemini CLI | MCP server | graphify-ts gemini <install|uninstall> [--profile core|full|strict] |
| Aider | AGENTS.md context-pack-first profile | graphify-ts aider install |
| OpenCode | AGENTS.md + .opencode/plugins/graphify-ts.js + MCP via opencode.json / opencode.jsonc | graphify-ts opencode install |
| Codex CLI | AGENTS.md + .codex/hooks.json context-pack-first profile | graphify-ts codex install |
| Windsurf / others | Pipe graphify-ts prompt output | graphify-ts prompt "..." --provider claude |

These are local installers that write project instructions and, when the platform supports it, local MCP config or plugin files that point at the graphify-ts subprocess. No code is uploaded.

For Claude, Cursor, Copilot, and Gemini, --profile strict keeps the lean core MCP tool surface but rewrites the generated guidance into a compact flow: call context_pack once for the task before broader exploration, answer from the pack when coverage is complete, expand only when diagnostics show missing evidence, and avoid raw file search unless the pack is insufficient.

Aider and OpenCode are intentionally context-pack-first: run graphify-ts generate ., install the profile, and start broad codebase work with graphify-ts pack "<task>" --task explain before raw file search. graphify-ts aider install writes an AGENTS.md profile only; remove it with graphify-ts aider uninstall. graphify-ts opencode install writes the AGENTS.md profile, .opencode/plugins/graphify-ts.js, and the graphify MCP entry in opencode.json or opencode.jsonc; remove only graphify-ts-owned content with graphify-ts opencode uninstall. Manual verification does not require either agent binary: inspect the generated files after install, then confirm uninstall removes only the graphify-ts entries.

Codex is intentionally context-pack-first: run graphify-ts generate ., install with graphify-ts codex install, and start broad codebase work with graphify-ts pack "<task>" --task explain before raw file search. To remove the profile, run graphify-ts codex uninstall; it removes the graphify-ts AGENTS.md section and Codex hook while preserving unrelated content. Manual verification does not require Codex to be installed: inspect AGENTS.md and .codex/hooks.json after install, then confirm uninstall removes only graphify-ts content.

For practical multi-agent workflows across Claude Code, Codex, Copilot, Cursor, and Gemini, see the agent orchestration guide.

---

These six MCP tools handle the most common agent workflows in the default core profile. The full surface is 25 tools, opt-in via GRAPHIFY_TOOL_PROFILE=full or --profile full on install. --profile strict still uses the lean core tool surface, but changes the installed guidance so the agent starts with one context_pack call and expands only when the pack diagnostics say evidence is missing.

| Tool | When the agent uses it |
|---|---|
| retrieve | "How does X work?" — ranked nodes + code snippets + community context |
| pr_impact | "Is this PR safe to merge?" — diff-aware blast radius + ranked review risks |
| impact | "What breaks if I refactor X?" — directed dependents + affected communities |
| call_chain | "How does request flow from X to Y?" — shortest execution paths |
| community_overview | "Show me the architecture" — communities + sizes + bridges |
| graph_stats | "How big is this graph?" — node/edge counts, density, file-type mix |

Full-profile additions: context_pack, context_expand, context_prompt, context_session_reset, risk_map, implementation_checklist, relevant_files, feature_map, time_travel_compare, community_details, query_graph, get_node, get_neighbors, explain_node, shortest_path, graph_diff, god_nodes, semantic_anomalies, get_community. Full reference: examples/mcp-tool-examples.md.

Within one MCP stdio session, identical context_pack requests for task=explain are reused automatically when the graph version and relevant prompt/options match. The cache is memory-only, skips delta-session packs, and invalidates itself when graph.json changes.

---

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "graphify ts": {
            "graphify-ts": {
                "command": "npx",
                "args": [
                    "-y",
                    "@mohammednagy/graphify-ts@latest",
                    "serve",
                    "graphify-out/graph.json"
                ],
                "env": {
                    "GRAPHIFY_TOOL_PROFILE": "core"
                }
            }
        }
    }
}

McpServers

{
    "graphify-ts": {
        "command": "npx",
        "args": [
            "-y",
            "@mohammednagy/graphify-ts@latest",
            "serve",
            "graphify-out/graph.json"
        ],
        "env": {
            "GRAPHIFY_TOOL_PROFILE": "core"
        }
    }
}

Stop making AI agents re-read your repo. A local context plane and context compiler for Claude Code, Codex CLI, Copilot CLI, Cursor, Windsurf, and Aider — turn your TypeScript/Node workspace and PR diffs into compact, verifiable context packs.

npm
node >=20
Local first
No API keys
license MIT

---

Demo

▶ Watch the 30-second demo

<!-- GitHub auto-embeds the user-attachment video below; npm renders it as a link only.
The shields.io button above is the npm-visible affordance back to the inline player on GitHub. -->

https://github.com/user-attachments/assets/a502185f-fa12-4a8f-80d2-172847f209fd

30 seconds: install → graphify-ts generate . on the GoValidate repo (1,048 files) → graphify-ts claude install --profile core → graphify-ts compare "Explain the auth flow End to End". Anthropic-reported on the same Claude Opus run: 31 → 14 turns (2.21× fewer), 170 s → 107 s (1.58× faster), 2,811,682 → 532,021 input tokens (5.28× fewer). Receipts: docs/benchmarks/2026-05-09-govalidate-auth-e2e/.

---

Quickstart

```bash
npm install -g @mohammednagy/graphify-ts

cd your-project
graphify-ts generate . # builds graphify-out/graph.json (no API key, no cloud)
graphify-ts claude install # wires Claude Code to use it via MCP
graphify-ts doctor # checks graph freshness + agent/MCP wiring
graphify-ts status # compact readiness summary + next commands

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.