# graphify MCP Server: Query Codebase Knowledge Graphs Locally

> graphify transforms any codebase, including docs and schemas, into a queryable knowledge graph. It exposes this graph as an MCP Server, enabling deterministic AST parsing and rich cross-file insights for tools like Claude Code and Cursor.

**Published:** 2026-09-09T12:00:38.767+00:00

**Keywords:** graphify,mcp-server,graphify-labs,knowledge-graph,codebase-analysis

# 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:

```bash
python -m graphify.serve graphify-out/graph.json
```

Alternatively, the `--graph` flag is also accepted:

```bash
python -m graphify.serve --graph graphify-out/graph.json
```

This 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`, and `mixes_in` relationships across approximately 40 languages, powered by tree-sitter AST parsing.
*   **Query, Path, Explain:** Directly query the `graph.json` to 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.

## References
- [graphify on GitHub](https://github.com/Graphify-Labs/graphify)
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/introduction)
- [graphify on model-context-protocol.com](https://model-context-protocol.com/servers/)

## Related Repository

- [graphify](https://model-context-protocol.com/servers/graphify)

**Source:** https://model-context-protocol.com/blog/graphify-mcp-server-query-codebase-knowledge-graphs-locally-mcp-server-guide
