# Graphify

> Graphify transforms entire codebases into persistent, queryable Knowledge Graphs and provides an MCP server interface for structural code reasoning, dependency mapping, graph state inspection, and switching between codebase graphs.

- Skill: `lensetek/graphify` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lensetek/graphify`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lensetek/graphify/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: lensetek (https://skillmd.com/u/lensetek)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lensetek/graphify

---


# Graphify Knowledge Graph & MCP Skill

`graphify` is an on-device, deterministic codebase analysis engine powered by Tree-sitter AST parsing. It converts source code, SQL schemas, documentation, and metadata into a queryable **Knowledge Graph** (`graph.json`) and visualization (`graph.html`).

---

## 🚀 Core Capabilities

1. **Deterministic AST Parsing:** Maps actual code relationships (function calls, class inheritance, module imports, schema keys) rather than relying solely on semantic vector search.
2. **Persistent Knowledge Graph:** Generates `/output/graphify/graph.json` and a human-readable `/output/graphify/GRAPH_REPORT.md`.
3. **Interactive Graph Inspector:** Inspect current graph nodes, edges, complexity metrics, or switch context between multiple indexed targets in `/output/graphify/`.
4. **MCP Server Integration:** Exposes tools for AI assistants (`query_graph`, `get_node`, `get_neighbors`, `shortest_path`).

---

## 🛠️ CLI Commands & Usage

### 1. Auto-Installation & Setup
If `graphify` is not yet installed on the system, run:
```powershell
uv tool install "graphifyy[mcp]"
# or
pipx install "graphifyy[mcp]"
```

### 2. Generating a Knowledge Graph
To index the current workspace and save results into `/output/graphify/`:
```powershell
uv tool run --from "graphifyy[mcp]" graphify . --output-dir ./output/graphify
```

### 3. Graph Inspector & State Switcher
To inspect active graph status or list indexed graphs:
```powershell
# Check if active graph exists
Test-Path ./output/graphify/graph.json

# Read graph summary report
Get-Content ./output/graphify/GRAPH_REPORT.md -Head 50
```

### 4. Running the MCP Server
To launch the Graphify MCP server on port 7812:
```powershell
uv tool run --from "graphifyy[mcp]" graphify mcp serve --port 7812
```

---

## 🔌 Exposed MCP Tools

When the Graphify MCP Server is running, agents can utilize the following tools:

| Tool | Purpose | Example Query |
| :--- | :--- | :--- |
| `query_graph` | Search nodes & relationships matching keywords or queries | `query_graph("authentication flow")` |
| `get_node` | Retrieve complete details of a specific function, class, or file node | `get_node("script.js:initApp")` |
| `get_neighbors` | List upstream/downstream callers & imports of a node | `get_neighbors("AGENTS.md")` |
| `shortest_path` | Find dependency path between two components | `shortest_path("index.html", "graphify")` |

---

## 📁 Output & Obsidian Vault Integration

All deliverables are saved under `/output/graphify/` in compliance with SkillForge project guardrails:

- **`GRAPH_REPORT.md`**: Markdown summary containing frontmatter metadata and Obsidian Wikilinks (`[[Note Title]]`).
- **`graph.html`**: Standalone D3/Vis.js interactive web graph viewer.
- **`graph.json`**: Structural JSON representation for programmatic agent context.

---

## 🛡️ Fallback & Recovery Protocol

If `graphifyy` fails to run or encounters syntax errors on unsupported languages:
1. Fall back to standard AST parsing or structural `ripgrep` (`grep_search`).
2. Log error details to `/output/graphify/error.log`.
3. Notify user and offer automatic re-installation via `uv tool install --force "graphifyy[mcp]"`.

