codegraphy-lite
# CodeGraphy Lite π
[](https://pypi.org/project/codegraphy-lite/)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://modelcontextprotocol.io/)
> π **Try the Live Interactive Playground in your browser:** [codegraphy.software/#playground](https://codegraphy.software/#playground) *(No install required β runs 100% locally in web assembly)*
**CodeGraphy Lite** is the standalone open-source distribution of CodeGraphy. It provides an interactive visual architecture canvas, living dependency graphs, and Model Context Protocol (MCP) server for Python and modern software codebases.
Built for developers and AI agents (Claude Code, Cursor, Windsurf, Cline), CodeGraphy Lite turns messy codebases into an intuitive, navigable 2D architectural map while slashing LLM context input tokens by **-75.5%**.
---
## π Quickstart
Run the MCP server with no manual installation (requires [uv](https://docs.astral.sh/uv/) and Python 3.9+):
```bash
uvx codegraphy-lite
```
Add it to Claude Code in one command:
```bash
claude mcp add codegraphy -- uvx codegraphy-lite
```
Or add it to Cursor (`.cursor/mcp.json` or the global Cursor MCP config):
```json
{
"mcpServers": {
"codegraphy": {
"command": "uvx",
"args": ["codegraphy-lite"],
"env": {
"CODEGRAPHY_ROOT": "/absolute/path/to/your/project"
}
}
}
}
```
To use the local web UI instead, run `uvx codegraphy-lite serve /path/to/project --scan`.
Lite is MIT-licensed, scans up to **150 files**, and exposes exactly **3 MCP tools**. Pro-only features are not included.
---
## π€ Model Context Protocol (MCP) Setup
CodeGraphy Lite includes a built-in MCP server that communicates over STDIO (JSON-RPC 2.0 / MCP 2024-11-05 standard). Use `uvx codegraphy-lite` for a zero-install start; `codegraphy-mcp` remains available as an installed alias.
### Available MCP Tools
1. `list_workspace_topics`: Lists all architectural topics, status, lane, file counts, and descriptions.
2. `get_topic_context`: Fetches topic details, 1-hop connected dependencies, and AST-extracted class/function signatures.
3. `get_architecture_summary`: Returns project architecture metrics, dependency statistics, and status distribution.
### Configuration for Cursor
In Cursor settings (`Cursor Settings -> Features -> MCP -> Add new MCP server`):
- **Name**: `codegraphy`
- **Type**: `command`
- **Command**: `codegraphy-mcp`
Or add directly to your project's `.cursor/mcp.json` or global configuration:
```json
{
"mcpServers": {
"codegraphy": {
"command": "codegraphy-mcp"
}
}
}
```
### Configuration for Claude Code
Add the following to your Claude Code configuration (`~/.claude.json` or project `.mcp.json`):
```json
{
"mcpServers": {
"codegraphy": {
"command": "codegraphy-mcp",
"env": {
"CODEGRAPHY_ROOT": "/absolute/path/to/your/project"
}
}
}
}
```
---
## π Empirical Token Benchmark (-75.5% Context Savings)
In an isolated comparative benchmark across 6 real-world closed bugfixes in major Python repositories (`encode/httpx`, `tiangolo/typer`, `Textualize/rich`), **CodeGraphy Lite reduced agent context input tokens by 75.5% (4.08x savings)** compared to standard keyword grep and whole-file reading:
| Mode | Input Tokens (`cl100k_base`) | Context Reduction | Acceptance Pass Rate | Tokens / Solved Task |
| :--- | :---: | :---: | :---: | :---: |
| **Baseline (Grep + Whole Files)** | 144,686 | *0.0% (ref)* | **100.0% (6/6)** | 24,114 |
| **CodeGraphy Lite MCP** | **35,457** | **-75.5% (4.1x savings)** | **100.0% (6/6)** | **5,909** |
| **CodeGraphy Pro (Desktop Ref)**\* | 64,348 | **-55.5% (2.25x savings)** | **100.0% (6/6)** | 10,724 |
*\*CodeGraphy Pro numbers reflect deep symbol graph index lookups and blast-radius impact analysis.*
π **Read the full benchmark methodology, task breakdowns, and honest limitations analysis in [benchmarks/BENCHMARK.md](benchmarks/BENCHMARK.md).**
---
## βοΈ Lite vs Pro Comparison
CodeGraphy Lite is free and open-source (MIT). For larger codebases, polyglot repositories, and architectural drift protection, check out **[CodeGraphy Pro](https://codegraphy.software/#compare)**:
| Capability | CodeGraphy Lite (Free / OSS) | CodeGraphy Pro ($19 Lifetime) |
| :--- | :---: | :---: |
| **Pricing & License** | **Free (MIT License)** | **$19 Lifetime License** |
| **Visual Architecture Canvas** | β
Interactive 2D Canvas | β
Interactive 2D Canvas |
| **Workspace Export / Import** | β
Human-readable `.cg.md` | β
Human-readable `.cg.md` |
| **Project File Limit** | **150 files** (Ideal for packages & services) | **Unlimited** (Enterprise mono-repos) |
| **Supported Languages** | Python AST (`ast.parse()`) | **Polyglot** (Python, TS, JS, Go, Rust, C#, Java) |
| **MCP Server Tools** | **3 Core Tools** | **11 Industrial Intelligence Tools** |
| **Blast Radius & Impact Analysis** | β None | β
Direct & Transitive Blast Radius Scoring |
| **Symbol Indexer** | Top-level signatures | β
Project-wide FQN symbol & reference index |
| **Architecture Linter & Drift** | β None | β
Tarjan cycle detection & layer boundary checks |
| **Git Architecture Diff** | β None | β
Visual PR & Branch architecture diff overlay |
π **Compare all features or get a license at [codegraphy.software/#compare](https://codegraphy.software/#compare).**
---
## β¨ Features
- πΊοΈ **Unified Architecture Graph**: Interactive React Flow graph displaying modules, services, and dependency edges with real-time drag-and-drop layout.
- ποΈ **Split Layers & Lanes**: Group architectural topics by workflow stage (`Planning`, `Development`, `Testing`, `Done`).
- π **Semantic Zoom**: Multi-level zoom with automatic Level-of-Detail (LOD)βzoom in to inspect function signatures and attached files, zoom out for high-level module topology.
- π **Portable `.cg.md` Workspaces**: Human-readable Markdown workspace specification format with two-way import/export.
- β‘ **Lightweight AST Scanner**: Fast project scanner using Python's standard library `ast.parse()` and regex import matching (scans up to 150 files).
- π€ **STDIO MCP Server (`codegraphy-mcp`)**: Exposes 3 essential architectural intelligence tools to AI assistants via JSON-RPC 2.0.
- π **100% Local-First & Private**: No cloud telemetry, no code uploads. Your codebase never leaves your machine.
---
## π οΈ CLI Reference
```
Usage:
codegraphy-lite Start the MCP STDIO server (default)
codegraphy-lite mcp Start the MCP STDIO server
codegraphy-lite serve [path] Start the local web UI (default path: .)
codegraphy-lite --version Show the installed version
serve options:
-h, --help Show this help message and exit
path Target project directory to visualize (default: current directory)
--port PORT HTTP server port (default: 8000)
--host HOST HTTP server bind host (default: 127.0.0.1)
--no-browser Do not automatically launch the browser
--scan Force automatic project directory scan on startup (up to 150 files)
-v, --version Show program's version number and exit
```
---
## π Repository Structure
```
codegraphy-lite/
βββ LICENSE # MIT License
βββ README.md # Documentation
βββ pyproject.toml # PEP 517/621 package metadata & entrypoints
βββ MANIFEST.in # Manifest for sdist packaging
βββ .gitignore # Git ignore rules
βββ benchmarks/ # Reproducible architecture benchmarks
β βββ BENCHMARK.md # Comprehensive 6-bug benchmark report
β βββ run_benchmark.py # Standalone benchmark runner (no machine-specific paths)
β βββ benchmark_results.json
βββ codegraphy_lite/ # Core Python package
β βββ __init__.py # Version definition (1.0.1)
β βββ cli.py # `codegraphy-lite` CLI entrypoint
β βββ mcp.py # `codegraphy-mcp` STDIO JSON-RPC 2.0 server
β βββ models.py # Pydantic models for graph & workspace
β βββ scanner.py # Safe stdlib AST scanner (max 150 files)
β βββ server.py # FastAPI REST & WebSocket server
β βββ storage.py # Local persistence & .cg.md codec
β βββ web/ # Bundled visual UI assets
βββ tests/ # Unit test suite
βββ test_scanner.py
βββ test_mcp.py
βββ test_server.py
```
---
## π§ͺ Running Tests
```bash
pip install -e ".[test]"
pytest tests/ -v
```
---
## π License
CodeGraphy Lite is licensed under the [MIT License](LICENSE).
TDQS
Scored across 3 tools
Each tool occupies a distinct level of the same hierarchy: enumerate modules, inspect one module in detail, and roll everything up into a project-wide summary. There is no realistic way to confuse list_workspace_topics with get_topic_context or get_architecture_summary, since each targets a different granularity (collection, single item, aggregate).
All three names follow a strict snake_case verb_noun pattern (list_/get_/get_ + domain noun). The vocabulary is also coherent: 'topic' is used consistently alongside 'workspace' and 'architecture' in a way that maps to the same domain model.
Three tools is on the thin side but fits a deliberately 'lite', read-only code graph explorer where each tool earns its place. There is no filler or redundancy, though a fourth tool (e.g. search/lookup) would round the surface out.
The read-only lifecycle (enumerate, inspect, aggregate) is fully covered and there are no dead ends for the stated analysis purpose. Minor gaps remain: no way to search or filter modules by name, no traversal beyond 1-hop dependencies, and no file-content access beyond AST signatures.