gograph

Developer tools

Local Go repository call graphs and structural analysis for coding agents over stdio.

Your AI app calls the gograph MCP server, which does the developer tools work and sends the result back to the chat.

About gograph

gograph is a community MCP server from ozgurcd, filed in our directory under developer tools. Local Go repository call graphs and structural analysis for coding agents over stdio.

gograph is listed in the official MCP registry as io.github.ozgurcd/gograph, version 1.7.32.

At a glance

Publisher
ozgurcd (community)
Runs
See the README for setup
Install from
MCP bundle: https://github.com/ozgurcd/gograph/releases/download/v1.7.32/gograph_1.7.32_darwin_amd64.mcpb
Written in
Go
License
MIT
GitHub stars
234
Official MCP registry
io.github.ozgurcd/gograph

How to set up gograph

  1. Follow the install steps in the gograph README; it is written in Go, so have that toolchain ready.
  2. Check the gograph README for keys or settings; the registry lists none that gograph requires.
  3. Add gograph to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the gograph tools to confirm the connection.
  5. Run one read-only task with gograph first, and keep your app asking before each tool call until the results look right.

gograph compared with similar servers

  • Reqable by ElonJask has fewer GitHub stars than gograph (234 against 234); both are community servers, and both run locally.
  • Protoc Gen Go by redpanda-data has more GitHub stars than gograph (235 against 234); both are community servers, and both run locally.
  • Agentcad by jdilla1277 has fewer GitHub stars than gograph (231 against 234); both are community servers, and both run locally.

Before you connect gograph

  • Give gograph its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each gograph tool call until you trust what it does with them.
  • Treat text that gograph fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for gograph on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for gograph

How marketing and sales teams put gograph to work, by company size. Pick the size closest to yours and start gograph on one use case.

Small business

  • A small business with a developer can use gograph to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask gograph to explain and fix a marketing site issue without context switching between tools.
  • gograph runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use gograph to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect gograph to keep scripts and automations documented and versioned as they change.
  • Start gograph on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out gograph with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on gograph so web and marketing engineering share one reviewed way of working with AI.
  • gograph is a community server, so have security review the code and pin a version before gograph touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

gograph README

From ozgurcd/gograph on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

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 (gograph.identuum.ai) · 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 (github.com/ozgurcd/gograph/blob/main/docs/build-selection.md).
  • --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 (decided from the small .gograph/graph.meta.json sidecar, so it takes a fraction of a second).
  • --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):

Task grep -rn gograph Observed output difference
Find callers of loadGraph 158 matching lines (comments, docs, vars) 56 AST-derived call-site rows ~65% fewer rows in that run
Locate symbol definitions 842 lines matching "Symbol" 83 true type/method declarations ~90% noise eliminated
Read one function body cat displays 180+ lines of the whole file source extracts the 12-line function ~93% fewer source lines in that run
Gather common symbol context Separate node, source, caller, callee, and test queries context bundles those fields Five evidence types in one response

Key Capabilities

Call-Graph and Blast-Radius Analysis, trace direct and transitive callers, callees, paths, interface implementations (CHA/SSA), struct field mutations, HTTP routes, static PostgreSQL queries, and error origins. Export graph slices as text, --json, --files-only, or --mermaid.

Change-Scoped Test Selection and Coverage Gaps, run gograph tests --uncommitted --format go-test --max-depth 3 to print runnable go test -run commands for local changes (--package <pkg> narrows them to one package; stderr notes how much of a selection rests only on possible interface-dispatch paths and what --exact-only keeps), gograph tests --uncommitted --skip-passed --run to run only the tests that have not already passed on identical inputs in any checkout (each package is recorded as it finishes; --max-time and --stop-on-fail stop early; on a --precise graph a process start, unnamed environment read or service connection refuses only the tests that may reach it; see gograph help test-memory), gograph untested --exclude-interface-methods to list untested production paths, and gograph uncovered --uncommitted --coverprofile cover.out to report unexecuted changed lines.

CI Architecture and Policy Gates, enforce package import layers (gograph boundaries), complexity/instability/god-object limits (gograph gate via .gograph.yml), exported API drift (gograph api --since origin/main), and machine-verifiable structural predicates (gograph validate), or drop the root GitHub Action (uses: ozgurcd/gograph@v1.7.30) directly into any Go repository workflow for checksum-verified installs, inline PR annotations, and collapsible step summaries. See the CI Architecture Gates guide.

Security Flow Triage, gograph flow --no-tests traces interprocedural source-to-sink paths from HTTP requests, decoded JSON, and environment variables to SQL, process execution, filesystem, and outbound HTTP sinks, with configurable sanitizer rules in gograph/flow.json.

Federated Workspaces, model multiple checked-out repositories through independently fingerprinted repository graphs plus a small deterministic cross-repository overlay. Resolution scopes support alternative fleets such as OSS/CE without merging repository ownership. P0 resolves Go modules, ordinary cross-repository Go calls, and first-class HTTP contracts for workspace-wide status, query, path, and impact analysis. The four read-only workspace MCP tools return the same native result values as CLI --json; member refresh and overlay publication remain explicit CLI mutations. Workspace guide →

Built-In Native MCP Server, all 66 repository query, analysis, and workflow capabilities have project-MCP equivalents (gograph_<command>) plus 4 session lifecycle tools (70 project tools total), and a separate 4-tool workspace MCP server (gograph workspace mcp). CLI-only process/host/artifact operations are build, validate, doctor, gate, snapshot, plugin/hook installation, MCP startup, workspace build/member refresh, version, and help. Complete CLI/MCP matrix →

Explicit Freshness and Query Contracts, CLI --json envelopes include gograph.graph-state.v1 (source, freshness, completeness, precision, refresh/persistence outcome); MCP attaches the same state in _meta.gograph_graph_state. File-qualified selectors (path/to/file.go:Name, file.go:Receiver.Method; an exact-case spelling wins over names differing only by case; gograph source prints a .go file the build context leaves out, unindexed), bounded pagination (--limit/--cursor), and constant/field resolution are specified in docs/query-contracts.md.

Agent Compliance Auditing, optional local session tracking (gograph session create|end|audit|cleanup) records whether agents run plan before edits and review after, grading sessions A–F without logging raw query results. See llm-wiki/session-scope.md.

Companion projects: Scrinium provides repository-owned, evidence-backed knowledge for coding agents, while Rulefloor binds repository invariants to concrete tests and detects drift. They are independent, optional tools.

Command Reference

Query and composed-analysis commands support --json; --files-only emits deduplicated paths; --mermaid renders callers, callees, impact, endpoint, dependents, deps, path, coupling, and diagram as fenced Mermaid (MCP accepts mermaid=true).

Category Commands What it does
Indexing build . [--precise] [--strict] [--force] [--tags=...] [--exclude-dirs=...] [--memory-mode=low] [--max-memory=1GiB], stale, stats Parse AST, optionally enrich with CHA/SSA, verify freshness and build health.
Navigation explore, query, strings, callers [--depth N], callees [--depth N], path, source, node Ranked discovery, symbol/string search, call chains, exact AST source extraction.
Context context, explain, focus, endpoint, summary Bundled structural evidence in a single call.
Change Analysis plan, review [--uncommitted], risk, impact [--uncommitted|--since], changes [--git], api --since Pre-edit impact planning, post-edit review, blast radius, and API drift.
Testing & Coverage tests [symbol] [--transitive], tests --uncommitted|--since <ref> --format go-test [--package <pkg>], tests ... --skip-passed --run [--max-time D] [--stop-on-fail], coverage <TestFunc>, untested [--coverprofile], uncovered --uncommitted --coverprofile, fixtures, mocks Direct/transitive test attribution, runnable go test -run selection, untested paths, and unexecuted changed lines.
Architecture & CI boundaries [--create], gate [init], check [--since|--uncommitted], coupling, complexity [--no-tests] [--top N], godobj, orphans, arity, snapshot Layer import rules (gograph/boundaries.json), CI metric gates (.gograph.yml), complexity, coupling, and unreachable-symbol sweeps.
Machine Validation version --json, validate --repo PATH --binding-json JSON --json, whatsnew [--since vX.Y.Z] Closed structural and policy predicates (imports_only_from, callers_only_from, call_arg_constant) with tri-state exit codes (0 pass, 1 fail, 2 cannot evaluate).
Types & Infrastructure implementers, interfaces, fields, embeds, constructors, literals, usages, mutate, schema, routes, sql, envs, errors, concurrency [--locks <function>], globals, httpcalls, deps, dependents, imports Interface satisfaction, mutations, HTTP routes, static PostgreSQL queries, env reads, concurrency (with per-function lock scopes), and package dependencies.
Security & Errors flow [--no-tests] [--source] [--sink], errorflow, trace Source-to-sink taint leads with gograph/flow.json sanitizers; reverse-BFS error tracing.
Diagnostics & Docs doctor [--json], hotspot, returnusage, skeleton, diagram, public, identity, doc <pkg[.Symbol]>, wiki, session Install/graph diagnostics, hotspots, Mermaid architecture diagrams, go doc wrapper, llm-wiki/ generator, and audit sessions.

Full command reference with flags and examples: gograph.identuum.ai/docs/command-reference/

GitHub Action (ozgurcd/gograph@v1.7.30)

Run gograph architecture gates directly in GitHub Actions on Linux or macOS runners without building from source:

- uses: ozgurcd/gograph@v1.7.30
  id: gograph
  with:
    gates: 'auto,api'
    detect-tests: 'true'
    summary: 'true'
  • Checksum-verified installation: Downloads the matching Linux or Darwin (x86_64/arm64) release archive plus checksums.txt, verifies SHA-256 before extraction, and caches the binary under the runner tool cache (or uses binary-path when supplied).
  • Inputs: version, binary-path, working-directory (.), precise (true), strict (true), tags, exclude-dirs, base-ref (auto-detected on pull_request events), gates (auto, none, or comma-separated gate,boundaries,check,flow,api), boundaries-config, check-config, flow-config, fail-on-flow (true), detect-tests (false), and summary (true).
  • auto discovery: Enables only committed configs (.gograph.yml, gograph/boundaries.json, gograph/checks.json, gograph/flow.json) or explicit *-config inputs and ignores untracked .gograph/ files.
  • Inline PR annotations & Step Summary: Emits ::error / ::warning annotations from boundaries, check, flow --no-tests, and api --since, and appends collapsible review + impact (or summary) blocks to GITHUB_STEP_SUMMARY.
  • Outputs: gate-status (passed|failed), api-breaking (true|false|skipped), and go-test-pattern (runnable go test lines when detect-tests: 'true').
Architecture Boundary Enforcement (gograph/boundaries.json)

Generate a baseline from current imports with gograph boundaries --create, or define layers in gograph/boundaries.json:

{
  "layers": [
    { "name": "domain", "packages": ["internal/domain/**"], "may_import": [] },
    { "name": "handler", "packages": ["internal/handler/**"], "may_import": ["internal/service/**", "internal/domain/**"] }
  ]
}

Run gograph build . --precise && gograph boundaries in CI; violations exit non-zero with exact file and line numbers. See docs/architecture-boundaries.md.

Security Flow Sanitizer Policy (gograph/flow.json)

gograph flow --no-tests reads gograph/flow.json (else .gograph/flow.json, or --config <path>):

{
  "sanitizers": [
    { "function": "security.CleanPath", "for": ["filesystem"] },
    { "function": "security.ValidateURL", "for": ["outbound_http"] }
  ]
}

Omit for to trust the return value for every sink kind. A validator returning only bool or error does not sanitize the original input.

Machine-Readable Structural Validation (gograph validate)

Validate closed structural predicates without parsing text output:

gograph validate --repo /work/project --binding-json '{"schema_version":"gograph.binding.v1","predicate":"symbol_exists","subject":{"language":"go","kind":"symbol","id":"example.com/project/internal/auth::Authorize"},"required_precision":"ast"}' --json

Supports symbol_exists, package_imports, call_edge_exists, type_implements, imports_only_from, callers_only_from, and call_arg_constant. Read-only; exits 0 (pass), 1 (fail), or 2 (cannot evaluate / invalid). See docs/machine-validation-contract.md.

Built-In MCP Server and AI Agent Integration

Connect any MCP client over local stdio:

gograph mcp .                                     # in-memory auto-refresh (default)
gograph mcp . --persist-refresh                   # opt in to publishing refreshed .gograph/ artifacts
gograph mcp . --tags=integration                  # retain build tags on every refresh
gograph mcp . --memory-mode=low --max-memory=1GiB # low-memory refresh policy
  • Claude Desktop & Claude Code: Run gograph add-claude-plugin to register Claude Desktop MCP, install shared rules, and register the PreToolUse hook gograph hook --agent claude (gograph hook --agent codex|opencode|agy serves the other agents; gograph hook --help prints each registration). For Claude Code MCP, run claude mcp add gograph -- gograph mcp ., or install via the plugin marketplace (/plugin marketplace add ozgurcd/gograph then /plugin install gograph@gograph).
  • Official MCP Registry (preview): MCPB-capable clients can discover io.github.ozgurcd/gograph in the official MCP Registry. See docs/mcp-registry.md for platform asset selection and limitations.
  • Codex & other agents: See docs/codex-integration.md and docs/coding-agent-usage.md.
  • Generated llm-wiki/: Run gograph wiki to emit machine-readable overview, architecture, hotspot, route, and per-package markdown pages.

How gograph Complements gopls, golangci-lint and ripgrep

  • gopls, live IDE diagnostics, autocomplete, cursor navigation, and compiler-backed renames.
  • golangci-lint, file- and package-level lint rules, bug checks, and style enforcement.
  • ripgrep, literal text, comment, config, and non-Go file search.
  • gograph, persisted repository call graph for transitive blast radius, change-scoped test selection, CI layer/metric gates, and composed MCP queries.

Full comparison: gograph.identuum.ai/docs/comparisons/.

Correctness Model and Non-Goals
  • Default mode (build .) uses Go AST parsing and heuristics; tolerates incomplete or non-compiling code.
  • Precise mode (build . --precise) adds go/types CHA/SSA enrichment for compilable repository packages (scoped to repository packages, not the full transitive dependency closure). Failed enrichment warns and records precise_fallback (or exits non-zero with --strict), while retaining an existing fresh precise artifact on a failed retry.
  • Open CHA and heuristics: Open interface dispatch is conservative (possible static targets, not runtime proof). Reflection, unsafe, plugins, unnamed concrete types, and runtime-generated SQL remain incomplete. Static test attribution and security flow are review aids, not runtime coverage or exploitability proofs.
  • Non-goals: No multi-language parsing, no AI/model API calls, no embeddings or SaaS backend, no remote telemetry, and no replacement for compiler/type-checker correctness.
  • Security and confinement details: See docs/security-model.md.

Contributing and License

Pull requests welcome, see CONTRIBUTING.md for local verification (make test / make test-quick) and release preparation (make bump-patch, make bump-minor, make bump-major via go run ./cmd/mcpb-release prepare). gograph is MIT-licensed (LICENSE).

Questions about gograph

What is the gograph MCP server?

Local Go repository call graphs and structural analysis for coding agents over stdio. gograph is maintained by ozgurcd on GitHub at ozgurcd/gograph, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the gograph MCP server?

gograph doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (ozgurcd/gograph). Like most servers, gograph ends with a command or URL you paste into your AI app's MCP config.

Does gograph need an API key?

The registry lists no required keys for gograph. Check the gograph README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is gograph an official MCP server?

No. gograph is a community server maintained by ozgurcd. Community servers can be excellent; read the code and the open issues before you give gograph access to company data.

What license is gograph under?

gograph is released under the MIT license, according to its GitHub repository. The license covers the code of gograph; the service it connects to has its own terms.