# ozgurcd/gograph [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/ozgurcd/gograph  
**GitHub Stars:** 233  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/ozgurcd-gograph

## Description
An AST-aware structural repository graph engine and MCP server designed for AI agents. Understands Go struct embeds, public API surfaces, SQL queries, and error mapping to give agents instant codebase context without blindly grepping.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/ozgurcd/gograph), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
brew install --cask ozgurcd/tap/gograph
```

2. Start the server:

```sh
gograph mcp . --persist-refresh
```

## Documentation

## What ozgurcd/gograph does

ozgurcd/gograph analyzes Go repositories as structured graphs rather than treating them as collections of text files. It indexes syntax and can add type-checked call relationships through CHA/SSA analysis. Queries can cover symbols, callers and callees, interface implementations, struct field mutations, HTTP routes, static PostgreSQL queries, error origins, package coupling, and dependency paths.

The project combines a command-line interface with a built-in stdio MCP server. The CLI supports repository summaries, hotspot and coupling reports, blast-radius analysis, source extraction, targeted test selection, coverage-gap reports, API comparison, package-boundary checks, architecture policies, and Mermaid graph output. MCP exposes the repository query, analysis, and workflow capabilities as project tools, along with session lifecycle tools. A separate workspace mode can query multiple independently indexed repositories through a deterministic cross-repository overlay.

## How it works

Run `gograph build .` to create the repository graph. Adding `--precise` enables type-checked CHA/SSA enrichment; `--strict` makes a precise build fail if it falls back. The CLI stores its normal graph under `.gograph/graph.json` and uses metadata to determine whether a rebuild is needed. Queries can target symbols by name or by selectors such as `path/to/file.go:Name` and `file.go:Receiver.Method`.

`gograph mcp .` starts the built-in stdio server without requiring a separate build command. It creates an in-memory graph on first use and incrementally reparses changed packages before answering queries. Starting it with `--persist-refresh` enables disk persistence for refreshes. The CLI can also inspect another commit, branch, or tag with `--rev`, and can emit structured JSON, file-only results, or Mermaid diagrams for supported analyses.

Test selection follows changed code through the graph and can produce runnable `go test -run` commands. Options support transitive selection, package narrowing, skipping tests that already passed on identical inputs, early stopping, and coverage reports. Security-flow analysis traces configured source-to-sink paths, while architecture commands evaluate import boundaries and policy thresholds.

## Setup and configuration

Install with Homebrew:

```bash
brew install --cask ozgurcd/tap/gograph
```

Or install the command with Go:

```bash
go install github.com/ozgurcd/gograph/cmd/gograph@latest
```

Build and inspect a repository with:

```bash
gograph build . --precise
gograph stats
gograph doctor --json
```

Start the MCP transport from the repository directory with `gograph mcp .`. The Go toolchain is used for module and package-loading context. Offline operation can be configured with `GOPROXY=off GOTOOLCHAIN=local`. Build selection also supports tags, excluded directories, low-memory mode, and an explicit memory limit. Architecture gate thresholds are configured in `.gograph.yml`; security-flow sanitizer rules use `gograph/flow.json`.

## Tools and capabilities

- Trace direct and transitive callers, callees, paths, and interface implementations.
- Identify changed-code test targets and untested production paths.
- Render graph slices as text, JSON, file lists, or Mermaid diagrams.
- Inspect repository hotspots, coupling, flows, and package relationships.
- Enforce package boundaries, complexity limits, instability limits, and other policy predicates.
- Compare exported API surfaces against a revision and analyze workspace-wide relationships.

## Limitations and notes

Analysis is local: gograph does not run target code or transmit source or telemetry to hosted services. Precise analysis depends on the installed Go toolchain and the repository's build context. Files excluded from that context can still be printed with source queries but are not indexed. MCP refreshes are in memory by default, while persistence requires the explicit `--persist-refresh` option. Workspace member refresh and overlay publication are CLI mutations; the workspace MCP tools are read-only.

The CLI and MCP interfaces have different scopes. Process, host, artifact, build, validation, gate, snapshot, installation, startup, version, and help operations remain CLI-only, while repository analysis and workflow commands have MCP equivalents.

_Full upstream README: https://allmcps.com/mcp/ozgurcd-gograph/readme_

