gograph

Local Go static analysis, call-graph, blast-radius, and CI architecture-gate CLI—with a built-in stdio MCP server (gograph mcp).
gograph indexes a Go repository into a local AST and optional type-checked (CHA/SSA) graph. Use it from the terminal or CI to trace transitive callers, select tests for uncommitted changes, render Mermaid dependency diagrams, and enforce package boundaries—without hosted services, embeddings, or target-code execution.
# Install
brew install --cask ozgurcd/tap/gograph
# or: go install github.com/ozgurcd/gograph/cmd/gograph@latest
# Index a Go repository (AST + type-checked CHA/SSA)
gograph build . --precise
# CLI workflows: blast radius, Mermaid graphs, targeted tests, CI gates
gograph impact Store.Save
gograph callers Store.Save --mermaid
gograph tests Store.Save --transitive
gograph tests --uncommitted --format go-test --max-depth 3
gograph boundaries && gograph gate
# Built-in stdio MCP server (no manual build step required)
gograph mcp .
Documentation ·
Interactive Demo ·
CI Architecture Gates ·
Tool Comparisons ·
Benchmark

Quick Start
1. Build and Inspect the Graph
gograph doctor --json # verify binary path and graph health
gograph build . --precise # AST + type-checked CHA/SSA graph
gograph build . --precise --strict # CI mode: exit non-zero if precise enrichment falls back
gograph stats # inspect precision and package/symbol/call counts
Common build flags:
--tags=integration — include build-tagged files and tests in the fingerprinted graph context.
--exclude-dirs=legacy,examples/broken — omit unrelated non-compiling subtrees (details).
--memory-mode=low --max-memory=1GiB — reduce Go heap pressure on constrained CI hosts without reducing precision.
--force — rebuild and rewrite even when the graph is current; without it, a build of an unchanged checkout writes nothing.
--rev origin/main (global query flag) — query another commit, branch, or tag without a checkout (cached under <user cache>/gograph/revs/, shared by worktrees; precise when the working graph is precise).
2. Repository-Wide and Symbol Queries
# Repository-wide entry points (no symbol name required)
gograph summary
gograph hotspot --top 10
gograph coupling --internal-only
gograph flow --no-tests
# Symbol-level analysis (supports path/to/file.go:Name and file.go:Receiver.Method)
gograph explore YourSymbol --compact
gograph context YourSymbol
gograph plan YourSymbol
gograph path HandleOrder CommitLedger --mermaid
3. CLI and Built-In MCP Server
- CLI: Reads
.gograph/graph.json produced by gograph build . (or --precise). Check freshness with gograph stale (exit 0 current, 2 stale, 1 error).
- MCP (
gograph mcp .): Requires no manual build step. It builds an in-memory graph on first use, incrementally reparses changed packages before queries, and writes no disk artifacts unless started with --persist-refresh.
Local-only analysis: gograph does not execute target code or transmit source or telemetry to external services. It invokes the installed go toolchain for module/build context and --precise package loading (set GOPROXY=off GOTOOLCHAIN=local for offline runs). See docs/security-model.md for symlink confinement, .artifacts.lock publication, SHA-256 policy markers, and platform atomicity details.
Why gograph?
Illustrative point-in-time output comparison from an earlier gograph revision
(counts vary as the repository evolves; these commands return different kinds
of evidence):