Getting started
Install ProjGraph, point it at code you already have, and read the diagram it gives back. This page takes you through the first run for both the CLI and the MCP server. For the full set of flags on each command, see the CLI reference.
Before you start
You need the .NET 10 SDK or later. Check what you have:
dotnet --version
On Windows x64, Linux x64 and Arm64 (glibc or musl), and macOS Arm64, both the CLI and the MCP server install as Native AOT executables that start without loading the .NET runtime. Other platforms get a framework-dependent build that runs on the runtime the SDK includes.
ProjGraph reads source files directly. You do not need to build the project you are analysing, run a database, or apply migrations first.
Install the CLI
dotnet tool install -g ProjGraph.Cli
Confirm the tool is on your path. This lists the four commands and their options:
projgraph --help
If the command is not found, your shell has not picked up the global tools directory yet. Open a new terminal, or see Troubleshooting.
Draw your first diagram
Start with the solution you are standing in, because it needs no arguments beyond a path:
projgraph visualize ./MySolution.slnx
That prints a Mermaid graph to stdout, wrapped in a fenced code block ready to paste into Markdown. To read it in the terminal instead, ask for the tree:
projgraph visualize ./MySolution.slnx --format tree
Both render the same graph. Output formats covers when to reach for which.
Draw the rest
Each command takes a path and writes to stdout, so you can redirect it anywhere:
# Database schema, from an EF Core DbContext
projgraph erd ./Data/LibraryContext.cs
# One class, with its base types and dependencies
projgraph classdiagram ./Models/Book.cs --inheritance --dependencies
# Architectural metrics for the whole solution
projgraph stats ./MySolution.slnx
Use --output rather than a shell redirect when you want the file written for
you, including any missing directories:
projgraph erd ./Data/LibraryContext.cs --output docs/database-schema.md
Use it from an AI assistant
The MCP server exposes the same four analyses as tools an assistant can call, so you can ask about your architecture instead of remembering command names.
Add the server to your MCP client's configuration. Replace x.x.x with the
current version from
NuGet:
{
"servers": {
"ProjGraph.Mcp": {
"type": "stdio",
"command": "dnx",
"args": ["ProjGraph.Mcp@x.x.x", "--yes"]
}
}
}
Restart the client, then ask it something that needs the tools:
Show me the entity relationships in my DbContext.
Which projects in this solution are referenced the most?
The MCP reference documents every tool, prompt, and resource the server provides.
Where to go next
- Output formats — pick between Mermaid, tree, and Markdown.
- Showcase — real commands and the diagrams they produced.
- Troubleshooting — when a diagram comes back empty.