Skip to content

MCP Server

The Archgate MCP server exposes your project’s ADRs and compliance checks to AI agents over the Model Context Protocol. Any MCP-compatible client — Claude Code, Cursor, or custom tooling — can connect to it.

The server uses stdio transport. Start it with:

Terminal window
archgate mcp

You do not typically run this command manually. Instead, configure your AI tool to launch it automatically (see below).

Add the following to your project’s .mcp.json file (create it if it does not exist):

{
"mcpServers": {
"archgate": {
"command": "archgate",
"args": ["mcp"]
}
}
}

Claude Code reads this file on startup and connects to the Archgate MCP server automatically. You can also run archgate init (which defaults to --editor claude) to generate this configuration along with the full .archgate/ directory.

Run archgate init --editor cursor to generate .cursor/mcp.json with the same server configuration. See the Cursor Integration guide for details.

The server registers five tools that AI agents can call.

Run ADR compliance checks against the codebase.

ParameterTypeDescription
adrIdstring?Only check a specific ADR by ID
stagedboolean?Only check git-staged files

Returns a JSON summary with pass/fail status, violation counts, and detailed results including file paths and line numbers.

List all ADRs in the project with metadata.

ParameterTypeDescription
domainstring?Filter by domain (backend, frontend, data, architecture, general)

Returns an array of objects with id, title, domain, and rules fields for each ADR.

Get changed files grouped by domain with applicable ADR briefings. This is the recommended starting point for an agent beginning a task — it combines file change detection, domain grouping, and ADR summarization into a single call.

ParameterTypeDescription
stagedboolean?When true, only include git-staged files. Default: all changed files
runChecksboolean?When true, run compliance checks and include results
domainstring?Filter results to a single domain

Returns briefings containing only the Decision and Do’s/Don’ts sections of each applicable ADR, keeping the response concise.

Read the current Claude Code session transcript for the project. Returns filtered entries (user and assistant messages) from the most recent session JSONL file.

ParameterTypeDescription
maxEntriesnumber?Maximum relevant entries to return (default: 200, most recent)

Read Cursor agent session transcripts for the project. Returns filtered entries from Cursor’s agent-transcripts JSONL files.

ParameterTypeDescription
maxEntriesnumber?Maximum relevant entries to return (default: 200, most recent)
sessionIdstring?Specific session UUID to read. If omitted, reads the most recent session

Read the full content of an ADR by ID. Replace the id placeholder with the ADR identifier (for example, adr://ARCH-001).

Returns the complete ADR markdown including frontmatter, rationale, decision, do’s and don’ts, consequences, compliance, and references sections.

If the MCP server starts in a directory without an .archgate/ directory, all tools remain available but return guidance instructing the agent to run archgate init to initialize governance. The server does not crash or refuse to start — it provides actionable feedback so the agent can bootstrap the project.

A typical AI agent session using the MCP server follows this pattern:

  1. Agent calls review_context with runChecks: false to get a condensed briefing of all ADRs that apply to the current set of changed files.

  2. Agent reads the briefings and identifies which architectural constraints apply to its task.

  3. Agent reads a full ADR via adr://ARCH-002 (for example) when it needs the complete rationale or implementation examples beyond the condensed briefing.

  4. Agent writes code following the constraints from the applicable ADRs.

  5. Agent calls check with staged: true to validate compliance. If violations are found, the response includes file paths and line numbers so the agent can fix them.

  6. Agent iterates until check reports zero violations.