graphify MCP Server: Query Codebase Knowledge Graphs Locally
graphify MCP Server: Query Codebase Knowledge Graphs Locally
graphify is a Python-based MCP Server that converts entire codebases—along with their documentation, SQL schemas, configuration files, and even PDFs—into a queryable knowledge graph. This local-first approach uses deterministic AST parsing via tree-sitter, ensuring every edge in the graph is explained without relying on vector stores.
Exposing Your Codebase as an MCP Server
The core utility of graphify for developers working with Model Context Protocol clients lies in its ability to expose the generated knowledge graph as an MCP Server. This allows for repeated, programmatic tool-call access from clients like Claude Code, Cursor, Codex, and Gemini CLI.
Once you've processed your codebase into a graph.json file, serving it as an MCP Server is straightforward:
python -m graphify.serve graphify-out/graph.jsonAlternatively, the --graph flag is also accepted:
python -m graphify.serve --graph graphify-out/graph.jsonThis command makes your comprehensive codebase graph available to any MCP-compatible tool, enabling deep, contextual queries directly against your project's structure and content.
What the Codebase Map Buys You
The knowledge graph generated by graphify offers several distinct capabilities, all accessible once served via MCP:
- God Nodes: Identify the most-connected concepts within your codebase, revealing critical components that everything flows through.
- Communities: Automatically split the graph into logical subsystems using the Leiden algorithm, providing LLM-free labels for each community.
- Cross-File Links: Resolve
calls,imports,inherits, andmixes_inrelationships across approximately 40 languages, powered by tree-sitter AST parsing. - Query, Path, Explain: Directly query the
graph.jsonto ask questions, trace paths between two entities, or get an explanation for a specific concept. - Rationale + Doc Refs: Elevate comments like
# NOTE:and# WHY:along with ADR/RFC citations into first-class nodes, linked directly to the relevant code. - Beyond Code: Integrate documentation, PDFs, images, and even video/audio files into the same unified knowledge graph.
Crucially, the code parsing is entirely local and uses tree-sitter, meaning nothing leaves your machine. Only the semantic pass over docs and media calls an external backend, and only if explicitly configured.
Wiring into Claude Code and Other Clients
For clients like Claude Code, Cursor, Codex, and Gemini CLI, graphify acts as a /graphify skill. This means these tools can invoke the served graph to perform specific queries, trace dependencies, or retrieve explanations about your codebase. For instance, a developer using Claude Code could ask "Show me the path between UserAuthenticationService and DatabaseConnectionPool" and receive a detailed, explained path directly from graphify's local graph. This tight integration allows for context-aware interactions without sending proprietary code to external LLM services for analysis.