C4 Architect
Summary: C4 Architect is a local MCP server for turning TypeScript/TSX imports into reviewable C4 architecture graphs and compact diagrams.
Analyze a target directory locally at Context, Container, or Component level, with optional boundary config and tsconfig, diagnostics, source evidence, and saved graph or summary output.
Read counts and analysis status from a saved architecture graph.
Query a saved graph for a bounded search or neighborhood with direction/depth/limit controls and optional source evidence.
Compare two saved graphs at the same C4 level and report change counts with bounded details.
Render a saved graph to a compact C4 image and Mermaid source, optionally saving Markdown, SVG, PNG, and interactive HTML.
Render authored C4 Context, Container, or Component nodes/relationships to Mermaid/PNG, optionally saving diagram artifacts.
Exports C4 architecture diagrams to editable Draw.io files with native shapes, nested deployment groups, and connector labels.
Generates Mermaid source for C4 diagrams and renders them alongside PNG, SVG, Markdown, and interactive HTML outputs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@C4 Architect analyze this TypeScript repo and generate a C4 container diagram"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
C4 Architect
Explore a TypeScript codebase without pasting the whole repository into a prompt.
C4 Architect is a local Model Context Protocol server that turns source imports into a versioned dependency graph, lets you review and name its architectural boundaries, and produces compact C4 diagrams. Use it from Codex, Claude Code, Claude Desktop, or another client that supports local MCP servers over stdio.
Published alpha · 0.2.0-alpha.16 · TypeScript / TSX · Local parsing · MIT licensed
Try the example · Walk through my system · What depends on this file? · Get started · npm package · See the diagrams · Contribute · Roadmap
Try the example
What happens if Oracle saves an event and the consumer restarts? In the example below, Kafka sends the event again. The application finds the row it already saved, acknowledges the write, and the bridge can advance its checkpoint. Follow steps 5–11 on the right. Open the full-size diagram

With the walkthrough skill available in Codex, try this prompt.
Try the Kafka and Oracle replay example. Show me what happens if Oracle saves the event and the consumer restarts. Who owns the checkpoint in each bridge placement?
With Node.js 22 or newer, install alpha.16 and run the example from any folder.
npm install -g c4-architect-mcp@0.2.0-alpha.16
c4-architect-mcp demo replayThe demo simulates one event locally. It prints paths to a Markdown report and two diagrams. Each diagram pairs a successful write with a restart after Oracle commits. With the bridge before Kafka, the application owns the checkpoint. With the bridge after Kafka, the bridge owns it. Bridge before Kafka · Bridge after Kafka · Six-case report, including failed writes
Use Node.js 22 or newer. These commands build and run the example from this checkout.
npm ci
npm run build
node dist/index.js demo replayTo follow future prereleases, install c4-architect-mcp@alpha. npm package
Related MCP server: knocoph
Walk through my system
Open Codex with the walkthrough skill available. Start with a sentence about who sends something, who receives it, and what happens next.
Walk through my system. Our web app receives orders from Kafka and stores them in Oracle. Draw the first diagram and ask me the question that matters most.
Codex saves an editable overview, a rendered diagram, and a short walkthrough.md in your project. The first question depends on what you tell it. If the consumer is unclear, it can ask who reads from Kafka. Once you name the consumer, it can ask how that component knows the Oracle write committed. First-time results for both README paths
After the global install above, run npm root -g to find the directory containing the installed c4-architect-mcp package. Copy its solution-architect-walkthrough folder from .agents/skills/ into your project's .agents/skills/ directory, then open a new Codex chat there. You can explicitly select $solution-architect-walkthrough with your description.
Solution architect walkthrough
Where an integration bridge sits changes which diagrams an architect should revisit. This skill compares alternative answers against the same set of diagrams, traces each finding to a node or arrow, and lists the questions that still need an owner’s answer.
Use
$solution-architect-walkthroughon the Kafka and Oracle RAC example. Compare a bridge that feeds Kafka with a bridge that consumes from Kafka and delivers to the application. Show which views need review and why.
Kafka and Oracle RAC bridge comparison
In the baseline design, the application consumes events from Kafka and writes records to Oracle RAC. A bridge that publishes to Kafka changes the publisher in 1 of 7 diagrams. A bridge that consumes from Kafka takes over delivery to the application, so 6 of 7 diagrams need structural review.
Diagram | Bridge before Kafka · alpha.14 report | Bridge after Kafka · alpha.14 report |
System Context | Keep Kafka as the application's direct event source. | Review R02. Show the bridge as the application's direct event source. |
Container | Keep the application server's dependency on Kafka. | Review R03. Show the bridge consuming from Kafka and delivering to the application server. |
Data Flow | Keep the event record flowing from Kafka into processing. | Review R05. The incoming record now comes from the bridge. Processing still writes to Oracle RAC. |
Component | Keep the Kafka consumer inside the application server. | Review R02. Identify the component that receives events from the bridge. |
Code | Keep the processor's | Keep the same |
Deployment | Keep the Kafka consumer in the application server runtime. | Review R02. Identify the runtime that hosts the bridge's consumer and show its connection to the application. |
System Landscape | Review R01. Show the bridge publishing to Kafka. The originating business system is still unknown. | Review R02. Show the delivery path from Kafka through the bridge to the application. |
The R numbers identify arrows within each diagram. Both reports also flag Kafka's description in System Context, Container, Component and System Landscape for a wording update. Five questions stay open in both placements, including when to checkpoint Kafka relative to the Oracle commit.
To generate both reports from the published package on macOS or Linux, run these commands.
npm install -g c4-architect-mcp@0.2.0-alpha.16
example="$(npm root -g)/c4-architect-mcp/examples/three-tier-kafka-oracle"
c4-architect-mcp review-walkthrough "$example/walkthrough.json" "$example/walkthrough/bridge-before-kafka.json" --out output/bridge-before.md
c4-architect-mcp review-walkthrough "$example/walkthrough.json" "$example/walkthrough/bridge-after-kafka.json" --out output/bridge-after.mdOpen this repository in Codex to use the prompt above. Codex discovers the skill in the checkout’s .agents/skills directory.
Through MCP, call review_architecture_walkthrough with manifestPath, scenarioPath, and outputPath. Each review checks the authored evidence against the saved diagram models. To apply it to another system, see the manifest and scenario format.
What happens if the consumer restarts after Oracle commits?
The one-command demo runs both bridge placements. To change the event or acknowledgment policy, copy the editable scenario and pass its path to review-replay. The command below runs the bundled input from a built checkout.
node dist/index.js review-replay examples/three-tier-kafka-oracle/replay/scenario.json --out output/replayThe fixture models persistence and restarts in memory. To try a design where the meaning of an acknowledgment is still open, set bridgeAcknowledgment to unspecified and compare the downstream checkpoint.
What changed in this PR?
Try this prompt in Codex with this repository, or replace the PR URL with your own. You can also generate the report from GitHub’s Actions tab. Set up the skill · Run it in GitHub Actions
Use
$what-changed-in-this-pron https://github.com/zrack/c4-architect-mcp/pull/16. Show me the dependencies it added or removed insrc, draw the focused diagram, and link each arrow to its import.
PR #16 added ten internal dependencies when it introduced explain-this-file. Follow R06 from the CLI and R08 from the MCP server. Both import the same renderer. The report matches every arrow to its source line and identifies the two type-only imports. Read the Markdown report for all ten added dependencies.

Explain this file
Use $explain-this-file on
NoteEditor.tsxin./src. What imports it, and what does it import? Show me the focused diagram and the source lines for both directions.
Try this prompt in a TakeNote checkout, or substitute a file from your own TypeScript project. On TakeNote's src snapshot, the skill narrows 108 nodes and 363 relationships to 15 nodes and 19 relationships. Two arrows show where the editor fits.
Incoming · R01.
TakeNoteApp.tsximportsNoteEditor. Read the import on line 11Outgoing · R19.
NoteEditor.tsximportsPreviewEditor. Read the import on line 12
The editor has one direct importer and 18 outgoing import statements. Ten of those statements reference packages whose installed files were unavailable in the clean checkout. The report lists every import and identifies those ten locations. Read the generated report · Open the full-size diagram
Planning a change to the editor? The file-impact report follows its callers beyond the first import, from TakeNoteApp.tsx through App.tsx to the client entry point. Trace the callers
From your project root, choose a TypeScript or TSX file under src and run the CLI with Node.js 22 or 24. The command writes a Markdown report and a focused PNG to output/.
npx -y c4-architect-mcp@0.2.0-alpha.16 explain-file ./src NoteEditor.tsx --out output/NoteEditor.mdTo use the prompt in Codex on macOS or Linux, install the package once and link its bundled skill. Then start a chat in the project you want to inspect.
npm install -g c4-architect-mcp@0.2.0-alpha.16
mkdir -p "$HOME/.agents/skills"
ln -s "$(npm root -g)/c4-architect-mcp/.agents/skills/explain-this-file" "$HOME/.agents/skills/explain-this-file"With the MCP server connected, you can also copy the installed package’s .agents/skills/explain-this-file folder into your project's .agents/skills/ directory. Read the skill
To reproduce the diagram above, use a clean checkout of the pinned TakeNote revision before installing its dependencies. Run this from the TakeNote root to include commit-pinned GitHub source links in the report.
npx -y c4-architect-mcp@0.2.0-alpha.16 explain-file ./src NoteEditor.tsx --out output/NoteEditor.md \
--github-repo taniarascia/takenote --commit e0eddbb9a21ae4cf4c4c7c183f29cfd666e08331 --source-root srcStart with evidence
An import is evidence of a code dependency. It does not, by itself, prove that two modules are separately deployed services, that an SDK call uses a particular protocol, or that a data flow is secure.
C4 Architect keeps that distinction visible. Source locations and content hashes support observed dependencies. Naming heuristics remain inferences. A separate boundary configuration records the systems, containers, and components that a person has declared. Rescanning the source preserves those declarations.
The result is a starting point for application and solution architecture review. Runtime behavior, organization structure, and enterprise architecture still need other evidence.
Available in this alpha | Purpose |
Local Tree-sitter analysis | Extract TypeScript and TSX dependencies without an LLM parsing the source files. |
Versioned graph and source evidence | Save a graph for review, with source locations, file hashes, and analysis diagnostics. |
Explicit boundary mapping | Give systems, containers, and components stable names through a separate configuration file. |
Summary, neighborhood queries, and comparison | Inspect a saved graph without returning the entire graph every time. |
Find direct and indirect importers before changing a file. Follow each reported path to its source lines. | |
Context, Container, and Component diagrams | Render a graph projection or a graph supplied by the caller. |
Deployment, Dynamic, System Landscape, and Code diagrams | Render explicit nodes and relationships supplied by the caller. |
Follow named payloads between external entities, processes and data stores. | |
Compact PNG, SVG, and interactive HTML | Trace orthogonal connections, inspect relationship labels, and export a selected view. |
Export native shapes, nested deployment groups, and connector labels that you can edit in Draw.io. Editable Draw.io export
Export a Structurizr DSL workspace with up to four views of the same model. Structurizr DSL export
Preview a diagram bundle locally, then publish its page and PNGs to a documentation workspace. Azure DevOps Wiki · Confluence Cloud · Notion
Cross-repository mapping, additional languages, and assisted threat modeling are planned. Roadmap
C4 diagrams
Trail Notes examples
Start with the whole system, then zoom in as far as the question requires. These diagrams use the same fictional trail journal app. Select a preview to open the full-size PNG, or download its JSON to render it yourself. C4 model diagram guide
Static structure
1. Context | 2. Container |
See who uses Trail Notes and the system it depends on. | Zoom into the web app, Notes API, and database. |
|
|
3. Component | 4. Code |
Follow a timed-out note submission and see who owns the retry. | See how the repository returns the original note ID or rejects a changed draft. |
|
|
Component JSON · Retry with the same request · All Component source links | Code JSON · Return the existing note · All Code source links |
The first save commits before the simulated timeout. The retry returns the same note ID and leaves one stored note. Run the TypeScript sample · See the timeout in source
For a Component example based on a real scan, follow the App.tsx → CaseWorkspace.tsx import in the ReplayCase alpha.5 diagram.
Supporting views
Use these views to show the wider landscape, a sequence of interactions, or where the software runs.
System Landscape | Dynamic | Deployment |
Place Trail Notes in the wider set of people and systems. | Follow the five steps for submitting a note. | See which hosts run the web app, API, and database. |
|
|
|
Deployment comparison
The left view places the app and database on separate hosts. The right view shows the equipment at an illustrative visitor center and traces traffic from a field tablet through the firewall to the two servers.

README deployment JSON · Physical deployment JSON
Download any example JSON and run render-diagram from the folder where you saved it. This command renders the Context example.
npx -y c4-architect-mcp@0.2.0-alpha.16 render-diagram trail-notes-context.json --out TRAIL-NOTES.mdOpen TRAIL-NOTES.html to explore the diagram.
Native data-flow diagrams
Which path writes to Oracle? In the three-tier example below, a web request gets a response. A separate Kafka event reaches the application server, which writes an event-derived record to Oracle RAC. Each arrow names the data that moves and points toward its recipient.

The editable example uses "c4Level": "DataFlow". Use ExternalEntity for sources and recipients outside the processes being described, Process for work that handles data, and DataStore for retained data. A flow connects a process to another process, an external entity or a store. Supply the payload names and directions from your design.
Download the editable JSON and run this command in the folder where you saved it.
npx -y c4-architect-mcp@0.2.0-alpha.16 render-diagram data-flow.json --out DATA-FLOW.mdOpen DATA-FLOW.html and select Kafka to highlight its outgoing event. To generate the same diagram through MCP, pass the example JSON to render_c4_mermaid with outputPath set to DATA-FLOW.md.
The seven-view walkthrough (PDF) places Data Flow on page 3, between Container and Component. Download the offline walkthrough (ZIP) and open Walkthrough.html to explore the full example.
Get started
Use Node.js 22 or 24 and npm. Run the pinned alpha without a checkout:
npx -y c4-architect-mcp@0.2.0-alpha.16 --helpThe examples pin 0.2.0-alpha.16 for a repeatable setup. c4-architect-mcp@alpha follows the prerelease channel and currently selects 0.2.0-alpha.16. npm's latest tag remains on 0.2.0-alpha.1, the initial prerelease. There is no stable release yet.
The server communicates over stdio; starting it without a subcommand waits for an MCP client rather than opening a browser page or an HTTP port. The following configurations let your client start it through npx.
Add this to ~/.codex/config.toml, or use the MCP server settings in the Codex desktop app:
[mcp_servers.c4-architect]
command = "npx"
args = ["-y", "c4-architect-mcp@0.2.0-alpha.16"]You can also register it from the Codex CLI:
codex mcp add c4-architect -- npx -y c4-architect-mcp@0.2.0-alpha.16Reconnect the server after configuration changes. See the official Codex MCP setup guide.
claude mcp add --transport stdio c4-architect -- npx -y c4-architect-mcp@0.2.0-alpha.16Use /mcp to inspect the connection. See the official Claude Code MCP documentation.
Open Settings → Developer → Edit Config and merge this entry with your existing mcpServers configuration:
{
"mcpServers": {
"c4-architect": {
"command": "npx",
"args": ["-y", "c4-architect-mcp@0.2.0-alpha.16"]
}
}
}Completely restart Claude Desktop after saving. For Windows JSON paths, use forward slashes or escape each backslash. See the official local MCP server setup guide.
These are local stdio configurations. Verify the connection in your chosen client. If a desktop app cannot find npx, use the executable's absolute path. On Windows, a client that cannot launch npx directly can use command: "cmd" with args: ["/c", "npx", "-y", "c4-architect-mcp@0.2.0-alpha.16"].
Optional global installation
npm install -g c4-architect-mcp@0.2.0-alpha.16
c4-architect-mcp --helpWith a global installation, use c4-architect-mcp as the MCP command with no arguments, or use it in place of the pinned npx command below. Use an absolute executable path if your desktop client's PATH differs from your terminal's.
Use the CLI directly
You can analyze and render without an MCP client:
npx -y c4-architect-mcp@0.2.0-alpha.16 analyze /absolute/path/to/project/src --level Component --out /absolute/path/to/project/architecture.graph.json --summary
npx -y c4-architect-mcp@0.2.0-alpha.16 summary /absolute/path/to/project/architecture.graph.json
npx -y c4-architect-mcp@0.2.0-alpha.16 render /absolute/path/to/project/architecture.graph.json --out /absolute/path/to/project/ARCHITECTURE.mdReplace /absolute/path/to/project with your project's location. Open the generated ARCHITECTURE.html beside the Markdown to explore the diagram.
For explicit compiler settings, add --tsconfig /absolute/path/to/tsconfig.json to analyze. The nearest tsconfig.json is otherwise discovered and read as data. Boundary configuration is loaded only when --config is supplied. The CLI also provides query, diff, and review commands. Use --help for their options.
Run from a checkout or try the sample
Clone the repository to contribute, inspect the source, or try the included synthetic order-service example:
git clone https://github.com/zrack/c4-architect-mcp.git
cd c4-architect-mcp
npm ci
npm test
node dist/index.js analyze examples/order-service/src --level Component --config examples/c4-architect.config.json --out output/order-service.graph.json --summary
node dist/index.js render output/order-service.graph.json --out output/ORDER-SERVICE.mdnpm test builds dist/index.js and runs the automated tests. Open output/ORDER-SERVICE.html to explore the sample. To connect an MCP client to your checkout, use node as the command and the absolute path to dist/index.js as its only argument. After changing TypeScript, run npm run build and reconnect the server to load the new code.
Analyze a project
Ask your connected client:
Use c4-architect to analyze
/absolute/path/to/project/srcat the Component level. Save the graph to/absolute/path/to/project/architecture.graph.jsonand return a summary. Review the diagnostics and inferred boundaries, then userender_architecture_graphto save/absolute/path/to/project/ARCHITECTURE.md.
The analysis tool accepts:
{
"targetDir": "/absolute/path/to/project/src",
"c4Level": "Component",
"outputPath": "/absolute/path/to/project/architecture.graph.json",
"responseMode": "summary"
}responseMode: "summary" saves the complete graph locally and returns counts and status, keeping it out of the model's context until needed. It requires outputPath. The default "graph" mode returns the graph.
Use absolute paths: an MCP client's working directory may differ from the repository you want to analyze. Check diagnostics before treating a missing edge as an absent dependency. Static analysis cannot resolve every computed import or establish every runtime connection.
The current parser covers .ts and .tsx, excluding declaration files, dependency/build/output directories, and symlink trees. It uses one nearest or explicitly supplied tsconfig.json per scan; nested project configurations are not orchestrated automatically. Static imports, re-exports, and literal import() / require() dependencies are supported; computed dependencies and parse problems remain visible through diagnostics.
Existing CSS, SVG, and other local assets found through relative imports, paths aliases, or baseUrl produce an UNSUPPORTED_MODULE_TYPE diagnostic. The graph contains the TypeScript/TSX dependencies. An unresolved specifier that matches a configured alias produces an UNRESOLVED_IMPORT diagnostic.
To name architectural boundaries, supply configPath explicitly. The example configuration demonstrates the format:
{
"schemaVersion": "1.0",
"system": { "id": "shop", "label": "Shop" },
"defaultContainer": {
"id": "application",
"label": "Application",
"technology": "TypeScript / Node.js"
},
"components": [
{ "id": "orders", "label": "Order orchestration", "paths": ["orders"] },
{ "id": "payments", "label": "Payments", "paths": ["payments"] }
]
}paths are literal file or directory prefixes relative to targetDir, not globs. Give a component a containerId when mapping it into an explicitly configured container. Ambiguous matches are rejected. Unmapped files use the default container, which is inferred unless you configure it. Keep this configuration separate from the generated graph.
{
"targetDir": "/absolute/path/to/project/src",
"c4Level": "Component",
"configPath": "/absolute/path/to/project/c4-architect.config.json",
"tsconfigPath": "/absolute/path/to/project/tsconfig.json",
"outputPath": "/absolute/path/to/project/architecture.graph.json",
"responseMode": "summary"
}Inspect before drawing
Tool | Input | Result |
|
| A Markdown report identifying the diagrams a design change affects, the supporting nodes or arrows, and open questions. |
|
| Six Kafka and Oracle replay traces, a Markdown report, and success and restart diagrams paired by checkpoint owner. |
|
| A Markdown report and focused diagram of one file’s incoming and outgoing dependencies, with source locations and unresolved imports. |
|
| A saved graph, full response, or compact summary at the requested C4 level. |
|
| A compact overview of a saved graph and its diagnostics. |
|
| A bounded neighborhood or search, with truncation reported. |
|
| Direct and indirect importers grouped by distance, with a source-linked path for each file shown. |
|
| Change counts and bounded details for snapshots at the same C4 level. |
|
| Render a saved graph or a focused neighborhood. Use |
|
| Mermaid source and a compact server-rendered PNG; saved SVG, PNG, HTML, and Markdown when requested. |
| Authored diagram fields and an optional | Editable Draw.io XML, with a file when requested. |
|
| Structurizr DSL with Context, Container, Component, or Deployment views. |
|
| Local Azure DevOps Wiki preview with PNG attachments, and optional publication. |
| The same diagram bundle and | Local Confluence preview, storage XHTML, and PNG attachments, with optional publication. |
| The same diagram bundle and | Local Notion preview, page manifest, and PNGs. Publishing creates a child page with native image blocks. |
Queries default to direction: "both", maxDepth: 1, maxNodes: 25, maxEdges: 50, and maxBytes: 16000. Source evidence is opt-in. Start with a summary, then search for a component or request its incoming or outgoing dependencies. Smaller views are usually easier to review than a complete repository drawing.
Render a saved graph directly:
{
"graphPath": "/absolute/path/to/project/architecture.graph.json",
"outputPath": "/absolute/path/to/project/ARCHITECTURE.md"
}For caller-supplied graphs, render_c4_mermaid remains available. To adapt an analysis projection manually, preserve its nodes and convert its edges:
const relationships = analysis.edges.map(edge => ({
from: edge.source,
to: edge.target,
label: edge.label,
technology: edge.protocol === "unknown" ? undefined : edge.protocol,
}));Source analysis produces Context, Container, and Component graphs. The corresponding renderer levels are C4Context, C4Container, and C4Component. Do not invent a protocol when the analysis has no evidence for it.
Render authored architecture views
All seven C4 views can render explicit nodes and relationships. Use render_c4_mermaid with the diagram fields and an optional outputPath, or save the same diagram as JSON and run npx -y c4-architect-mcp@0.2.0-alpha.16 render-diagram diagram.json --out DIAGRAM.md. Both entry points produce Mermaid source, PNG, SVG, and interactive HTML alongside the Markdown when given an output path.
| What to supply |
| Code elements such as |
| People and software systems across the scope, with relationships between them. |
| Participants as nodes and interactions in execution order in |
|
|
This deployment diagram places an API and its data store on the same host.
{
"title": "Orders on the application host",
"c4Level": "C4Deployment",
"nodes": [
{ "id": "host", "label": "Application host", "type": "DeploymentNode" },
{ "id": "api", "label": "Orders API", "type": "Container", "parentId": "host" },
{ "id": "db", "label": "Orders database", "type": "ContainerDb", "parentId": "host" }
],
"relationships": [{ "from": "api", "to": "db", "label": "Reads and writes orders" }]
}Export editable Draw.io diagrams
Save the input as physical-deployment.json and run the export command from the same directory. Trail Notes physical deployment JSON
npx -y c4-architect-mcp@0.2.0-alpha.16 render-drawio physical-deployment.json --out trail-notes.drawioUse File → Open from → Device to open the file in Draw.io. Drag a deployment group by its header to move its contents together. Double-click a group title or a relationship label to edit it. Connectors remain attached to their shapes as you move them. Draw.io editor
The same command also accepts a saved architecture graph. For MCP, send an authored diagram to render_c4_drawio, or set format: "drawio" on render_architecture_graph to export a saved graph or its focused neighborhood. Use a .drawio extension for the output path.
Trail Notes in Draw.io
Use the page tabs at the bottom of the editable file to switch views. Select any screenshot to open it full size. Download the editable four-page Draw.io file
Context | Container |
|
|
Component | Physical Deployment |
|
|
Export a Structurizr DSL workspace
The Trail Notes workspace has four views of the same system. The Component view scopes the retry flow to the Notes API. Physical Deployment places instances of the web app, API, and database on the visitor center hardware.
Save the input as structurizr-workspace.json and run the export command from the same directory. Trail Notes workspace input
npx -y c4-architect-mcp@0.2.0-alpha.16 render-structurizr structurizr-workspace.json --out workspace.dslPoint Structurizr Local at the output directory and use its diagram selector to switch views. Java or Docker is only needed to run the Structurizr viewer or validator. Structurizr Local quickstart
The CLI and MCP tool accept an authored diagram or a workspace bundle with one diagram per level. A bundle uses shared node IDs, systemId for the software system, and componentContainerId for the Component view's container. Use deploymentInstanceOf to map deployment nodes that represent software instances to their logical IDs. The Trail Notes bundle maps browser to web and database to db.
Trail Notes in Structurizr
Open the editable workspace in Structurizr Local and use the diagram selector to switch views. Select any screenshot to open it at full size. Download the editable workspace.dsl
Context | Container |
|
|
Component | Physical Deployment |
|
|
Publish to Azure DevOps Wiki
Save the input as structurizr-workspace.json and run the command from the same directory to preview the four Trail Notes diagrams. The preview writes index.html, page.md, and the PNG attachments locally. Open index.html in a browser. Trail Notes input
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-ado-wiki structurizr-workspace.json --out trail-notes-wikiTo publish, supply an existing Azure DevOps Services wiki and a page path. Set either AZURE_DEVOPS_BEARER_TOKEN to a Microsoft Entra access token for Azure DevOps or AZURE_DEVOPS_EXT_PAT to a PAT with Wiki (Read & write) access in the process environment. The preview command works without credentials. Azure DevOps authentication
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-ado-wiki structurizr-workspace.json \
--out trail-notes-wiki --publish \
--organization YOUR_ORG --project YOUR_PROJECT --wiki YOUR_WIKI --page /Trail-NotesThe MCP tool uses target: { organization, project, wiki, pagePath } and publish: true for the same operation. The publisher creates a dedicated page or updates an intact page it previously generated. Updates use Azure DevOps page versions to guard against concurrent edits. The Wiki API writes attachments separately before saving the page, so an interrupted attempt can leave uploaded PNGs behind. Wiki page API · Wiki attachments API
Trail Notes wiki preview
The local preview shows Context, Container, Component, and Physical Deployment on one page. Select the screenshot to open it at full size. Download the generated Markdown

Publish to Confluence Cloud
Save the Trail Notes input as structurizr-workspace.json and run the preview command from the same directory. Open trail-notes-confluence/index.html and select a diagram to see its PNG at full size. The directory also contains page.storage.xhtml, the page body sent to Confluence, and four PNG attachments. Trail Notes input
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-confluence structurizr-workspace.json --out trail-notes-confluenceTo publish, set CONFLUENCE_EMAIL and CONFLUENCE_API_TOKEN in the CLI or MCP server environment. The Atlassian account needs permission to create or update the page and upload attachments. Supply your Cloud site origin and numeric space ID. Add --cloud-id for a scoped API token with read:page:confluence, write:page:confluence, read:attachment:confluence, read:content-details:confluence, and write:attachment:confluence. Atlassian API tokens
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-confluence structurizr-workspace.json \
--out trail-notes-confluence --publish --site https://YOUR_SITE.atlassian.net --space-id 123456Use --parent-id to create a child page, or reuse the returned ID with --page-id to update a dedicated page created by C4 Architect. For MCP, call publish_to_confluence with target: { site, spaceId } and publish: true. The target accepts the optional fields parentId, pageId, and cloudId.
The publisher creates a placeholder page so Confluence can accept attachments before the page body is saved. If a publish is interrupted, check the reported page and retry with its ID. The publisher reuses matching attachments and uses the current published page version to reject a conflicting update. Use a separate page for manual editing and collaborative drafts. Confluence pages API · Confluence attachments API
Trail Notes Confluence preview
The local preview shows Context, Container, Component, and Physical Deployment on one page. Select the screenshot to open it at full size. The preview command above generates the PNGs referenced by the XHTML. Download page.storage.xhtml

Publish to Notion
Save the Trail Notes input as structurizr-workspace.json and run the preview command from the same directory. Open trail-notes-notion/index.html and select a diagram to see its PNG at full size. The output also contains a page.json manifest and the four PNGs. Trail Notes input
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-notion structurizr-workspace.json --out trail-notes-notionTo publish, share the parent page with a Notion connection that has Insert content access. Set NOTION_API_TOKEN in the CLI or MCP server environment. Supply the parent page ID as a UUID with or without hyphens. Notion authorization and page access
npx -y c4-architect-mcp@0.2.0-alpha.16 publish-notion structurizr-workspace.json \
--out trail-notes-notion --publish --parent-page-id YOUR_PARENT_PAGE_IDFor MCP, use publish_to_notion with target: { parentPageId } and publish: true. Each publish creates a new child page in the workspace after all PNGs upload. The publisher uses direct uploads up to 20 MiB per PNG, subject to the workspace's own limit. If Notion cannot confirm page creation, check the parent page before retrying. Notion file limits · Notion guidance for timed-out writes
Trail Notes Notion preview
The local preview shows Context, Container, Component, and Physical Deployment on one page. Select the screenshot to open it at full size. The preview command above generates the PNGs referenced by the manifest. Download page.json

Focus a diagram on one node
Both TakeNote diagrams use the same source snapshot. On the right, focusing on NoteEditor.tsx and its direct neighbors reduces the view from 108 nodes and 363 arrows to 15 nodes and 19 arrows. Follow TakeNoteApp.tsx → NoteEditor.tsx → PreviewEditor.tsx to see the difference.

Full-size TakeNote comparison PNG
Use query --search to find the exact node ID for a focused diagram. These commands use the graph from the checkout example and show the outgoing dependencies of Order orchestration.
npx -y c4-architect-mcp@0.2.0-alpha.16 query output/order-service.graph.json --search "Order orchestration" --depth 0
npx -y c4-architect-mcp@0.2.0-alpha.16 render output/order-service.graph.json --node component:orders --direction outgoing --out output/ORDER-SERVICE.outgoing.mdWith --node, render defaults to both directions, depth 1, 25 nodes, and 50 relationships. Use --direction incoming or --direction outgoing to trace one direction. Set --depth, --nodes, and --edges to adjust the view. The diagram caption shows how much of the saved graph is included. The render result reports omitted nodes and relationships and whether a node or relationship limit was reached.
The focused Markdown relationship table and interactive HTML details show up to three source locations per relationship. Use the saved graph for the full evidence.
For MCP, pass focus to render_architecture_graph. Find the ID with query_architecture_graph using search.
{
"graphPath": "/absolute/path/to/project/architecture.graph.json",
"outputPath": "/absolute/path/to/project/ARCHITECTURE.orders.md",
"focus": {
"nodeId": "component:orders",
"direction": "outgoing",
"maxDepth": 1,
"maxNodes": 25,
"maxEdges": 50
}
}What depends on this file?
Use alpha.16 to see which callers to inspect before you change a TypeScript or TSX file. For Codex, install the package and link its skill on macOS or Linux.
npm install -g c4-architect-mcp@0.2.0-alpha.16
mkdir -p "$HOME/.agents/skills"
ln -s "$(npm root -g)/c4-architect-mcp/.agents/skills/what-depends-on-this-file" "$HOME/.agents/skills/what-depends-on-this-file"You can also copy the installed package’s .agents/skills/what-depends-on-this-file folder into your project's .agents/skills/ directory. Run npm root -g to locate the package. Connect Codex to the alpha.16 MCP server using the setup instructions, then open a new chat in the project and try this prompt.
Use
$what-depends-on-this-fileon TakeNote’sNoteEditor.tsxinsrc. Which files should I review first if I change the editor? Link every step back to the source.
The report starts with the files that import the editor directly. For each indirect dependent it shows a shortest path back to the editor and the source line for each hop. The default view follows up to three hops and includes up to 25 files, counting the selected file. It reports any limits or source-resolution gaps that affect the result.
In the TakeNote example, start with TakeNoteApp.tsx: it imports the editor and renders it beside the note list. App.tsx and the client entry point reach the editor indirectly. The clean source scan covered 76 TypeScript and TSX files and marked unresolved references in the report. Editor render site · Focused diagram
To run the same analysis directly, use the CLI from the root of your project. Replace NoteEditor.tsx with the file you plan to change.
npx -y c4-architect-mcp@0.2.0-alpha.16 impact-file ./src NoteEditor.tsx --out output/NoteEditor.mdTo reproduce the published example with GitHub source links, run this from a clean checkout of the pinned TakeNote revision before installing its dependencies.
npx -y c4-architect-mcp@0.2.0-alpha.16 impact-file ./src client/containers/NoteEditor.tsx \
--out output/NoteEditor.md --depth 3 --nodes 25 \
--github-repo taniarascia/takenote --commit e0eddbb9a21ae4cf4c4c7c183f29cfd666e08331 --source-root srcThe analyze_file_impact MCP tool produces the same report and diagram. Omit the GitHub revision options when scanning local edits so the source locations refer to the files you inspected. Read the skill · Read the generated NoteEditor impact report · Regression, performance, and architect walkthrough
Review architecture changes for a pull request
With Node.js 22 or 24 and Git installed, link the packaged skill on macOS or Linux:
npm install -g c4-architect-mcp@0.2.0-alpha.16
mkdir -p "$HOME/.agents/skills"
ln -s "$(npm root -g)/c4-architect-mcp/.agents/skills/what-changed-in-this-pr" "$HOME/.agents/skills/what-changed-in-this-pr"Start a new Codex chat in your repository and try this prompt.
Use $what-changed-in-this-pr on zrack/c4-architect-mcp#16. Show me which dependencies it added or removed and link each arrow to the import.
The skill compares committed TypeScript and TSX snapshots. Its focused diagram shows only changed relationships. Numbered arrows link to source in the interactive view and match the rows in the Markdown report. Additions point to the PR head, removals to the base. Skill instructions
PR #16 added ten dependencies when it introduced explain-this-file. Follow each arrow to the import that introduced it. Read the PR #16 report · View the focused diagram
Pass review two saved graphs at the same C4 level and scan scope to see a changed component alongside its neighbors. For an added or changed dependency, this default view uses the head snapshot. If the only dependency changes are removals, it uses the base snapshot. The Markdown report also lists source edits and declared boundary changes. To compare boundary declarations, supply each revision's configuration to its scan.
npx -y c4-architect-mcp@0.2.0-alpha.16 review base.graph.json head.graph.json --out PR-ARCHITECTURE.mdTo reproduce the focused Actions view locally, use two Component graphs and add --focus-changes. For links to exact GitHub source lines, save each graph with analyze --commit SHA. Give review the same repository-relative source directory as both scans (use . for the repository root). For a PR from a fork, add --head-github-repo FORK_OWNER/FORK_REPO.
npx -y c4-architect-mcp@0.2.0-alpha.16 review base.graph.json head.graph.json \
--focus-changes --github-repo OWNER/REPO --source-root src --out PR-ARCHITECTURE.mdRun the review in GitHub Actions
Open Actions → PR architecture review → Run workflow on the default branch and enter the PR number. Use a source directory tracked in both revisions, such as
src(the default), or.for the repository root.To post a comment with the dependency counts, both scan statuses, and a download link, select Post an architecture review summary to the pull request. It defaults to off. Re-running the same workflow run updates its comment.
When the run finishes, download and extract
pr-<number>-architecture-review-<attempt>. OpenPR-ARCHITECTURE.mdfor the full list of added, removed, and modified dependencies. Open the adjacent HTML diagram and select a numbered arrow to see its source link. Keep the extracted files together.
The workflow installs the published c4-architect-mcp@0.2.0-alpha.12, scans the base and head commits recorded by GitHub, and calls review --focus-changes. Additions link to the import in the head revision, removals to the import in the base revision, and modified dependencies to both. For fork PRs, head links use the fork when available. The diagram shows up to 25 dependency changes. The report and optional PR comment give totals for the full comparison. When zero dependencies change, the artifact contains just the Markdown report.
The read-only scan does not execute PR code. To resolve package imports, it stages each revision's dependencies separately using a supported public npm v3 lockfile, with integrity checks and install scripts disabled. If a lockfile is missing, uses workspaces, or cannot be staged, that revision is scanned from source alone. Check the report for partial scans and unresolved imports. It lists up to 25 unresolved locations per revision. Sign in to GitHub to download an Actions artifact while the run retains it.
Examples from GitHub Actions
Pull request | What to trace in the uploaded report |
Ten added dependencies. Follow R06 from the CLI and R08 from the MCP server to the same new renderer. | |
Thirteen added dependencies and three removed. Follow R16 to the preview's former renderer import at the base, then R06 to its new home in the shared wiki module at the head. |
The saved examples include the original Actions artifacts and source-link checks. View the pilot results and both workflow runs
Use the workflow in another repository
Save this caller as .github/workflows/architecture-review.yml on your repository's default branch. Open Actions → Architecture review → Run workflow in that repository. Enter the PR number and a directory tracked in both revisions, or use . to scan the repository root. The report and any focused diagram appear in the calling repository's run artifacts.
name: Architecture review
on:
workflow_dispatch:
inputs:
pr_number:
description: Pull request number
type: string
required: true
source_root:
description: Repository-relative source directory
type: string
default: src
permissions:
contents: read
pull-requests: read
jobs:
review:
uses: zrack/c4-architect-mcp/.github/workflows/pr-architecture-review-report.yml@1ab91407555f60014d9c60e99513ba028c888eea
with:
pr_number: ${{ inputs.pr_number }}
source_root: ${{ inputs.source_root }}Existing callers can adopt the focused review by updating the uses commit to the one above. If your repository restricts reusable workflows, allow that reference in its Actions settings. To offer opt-in comments, call pr-architecture-review.yml at the same commit, grant the calling job pull-requests: write, and pass a Boolean post_comment input. The separate comment job posts only when requested. The scan always runs with read-only permissions.
Example output from PR #4
This earlier run used the alpha.3 single-component neighborhood view. Its optional comment shows how reviewers can reach the report from a pull request. View the original comment on PR #4
Component architecture review
55419ce→4b39e25· Base scan complete · Head scan completeDependencies · 3 added, 0 removed, 0 changed.
The focused view shows the immediate neighbors of cli.ts. Follow R01 to trace the new import of renderers/review.ts.
Read the Markdown report · Open the full-size PNG · View the Actions run

Read the diagram

Five declared components and five source-observed dependencies from the checked-in order-service example. The application is synthetic; the dependencies come from its actual source imports.
The server computes the image layout with ELK, compares horizontal and vertical arrangements, and reserves space for the wrapped labels it draws. PNG and SVG rendering do not require a browser at runtime. Mermaid remains a compatible source export; a client's Mermaid layout may differ from the server image.
The saved graph preserves the system/container hierarchy. Context, Container, and Component images show parent-container and inferred-boundary information in node descriptions. Authored Deployment diagrams can show nested hosts. Inspect those descriptions in the interactive view.
Saving ARCHITECTURE.md also writes ARCHITECTURE.svg, ARCHITECTURE.png, and ARCHITECTURE.html beside it. The Markdown shows the PNG, links to the interactive view, includes a relationship table, and retains the Mermaid source in a collapsed section.

This separate stress fixture has 20 nodes and 35 relationships, including branching, cycles, shared dependencies, and long labels. Its connections are authored test data rather than extracted source dependencies.

The 20-node stress fixture with Order orchestration selected, saved through the interactive view's export buttons.
Full-size selected PNG · Scalable selected SVG
Select a component to highlight outgoing connections in blue and incoming connections in brown. Other routes fade. Select a relationship ID to isolate that route and inspect its full label. Zoom, keyboard selection, Escape, and Show all help you move between details and the complete picture.

Export PNG and Export SVG preserve the current selection and connection highlighting across the full diagram, regardless of zoom or scroll position. PNG exports at twice the diagram's natural dimensions; SVG remains scalable. The self-contained HTML works as a local file without contacting the MCP server or an external service.
Automatic layout cannot make every graph readable at every size. Crossings can remain, and a large full-graph image may need zoom. Use selection and bounded graph queries to follow a particular change or dependency.
See image provenance and regeneration instructions to reproduce these examples.
Local execution and data
The parser reads local source files and does not call an LLM API. Generated diagrams and their interaction code are self-contained. Your MCP client receives the tool results, and its own settings determine whether those results are sent to a model or another service. Review those settings before analyzing private source.
Analysis reads the source statically and writes the requested artifacts locally. The wiki and workspace publishers also default to a local preview. With an explicit publish request and destination, they upload the generated page and diagram images. Publishing scope and credentials
Develop and verify
From a repository checkout:
npm ci
npm test
npm run test:package
npm run test:layoutThe regular tests cover parsing, graph contracts, graph operations, rendering, and MCP behavior. The package check exercises a packed installation. The layout check uses real browser geometry and downloads against synthetic 12-node and 20-node fixtures. It checks labels, routes, arrowheads, compactness, highlighting, keyboard controls, and selection-aware PNG/SVG exports.
The layout check uses installed Google Chrome by default. To use Playwright Chromium:
npx playwright install chromium
C4_BROWSER_CHANNEL=chromium npm run test:layoutFor PowerShell, set $env:C4_BROWSER_CHANNEL = "chromium" before running the test. Browser reports and generated fixtures are written under output/playwright/component-scale/. These checks cover the included cases, not every possible graph topology.
The CI workflow configures tests on Node.js 22 and 24 across Linux, macOS, and Windows, plus a Chromium layout job. See the GitHub Actions runs for results.
Build this with us
Useful contributions start with a concrete case: an import that resolves incorrectly, a boundary that is hard to express, or a diagram whose route is difficult to follow. Small, sanitized fixtures are especially valuable.
Report a bug: include a minimal input, expected result, diagnostics, and a screenshot for rendering problems.
Improve analysis: add source evidence and a regression fixture; keep observed facts separate from inference.
Improve diagrams: test the actual SVG and exported images, including selected views.
Design an extension: discuss its graph contract before adding a new language, renderer, or publisher.
Improve documentation: try the setup on your platform and client, and report the exact versions used.
Read CONTRIBUTING.md, the Code of Conduct, and the roadmap. Public API details may change during the alpha; preserve a copy of important graph snapshots and boundary configurations.
License
C4 Architect is available under the MIT License. You may use, modify, and redistribute it, including commercially, subject to the license terms. Dependency licenses and attribution requirements remain applicable; see NOTICE and third-party notices.
Available Tools
6 toolsanalyze_architectural_boundariesB
Locally parses TypeScript/TSX dependencies with source evidence, inferred or declared C4 mappings, and diagnostics. Save a graph and return a summary to keep the response small.
Inputs: c4Level (required), targetDir (required), configPath, outputPath, +2 more.
compare_architecture_graphsA
Compare two saved graphs at the same abstraction level. Reports full change counts with bounded detail; timestamps and scan-root location do not create changes.
Inputs: afterPath (required), beforePath (required), limit, maxBytes.
get_architecture_summaryB
Read counts and analysis status from a saved, validated architecture graph.
Inputs: graphPath (required).
query_architecture_graphB
Read a bounded neighborhood or search result from a saved graph. Returns truncation flags; source evidence is opt-in.
Inputs: graphPath (required), nodeId, search, maxBytes, +5 more.
render_architecture_graphB
Render a saved validated graph directly to a compact C4 image, Mermaid source, and optional Markdown/SVG/PNG/interactive HTML files. Inferred boundaries are labeled.
Inputs: graphPath (required), title, outputPath.
render_c4_mermaidB
Renders a compact C4 PNG using server-side orthogonal layout, plus Mermaid source. With outputPath saves Markdown, SVG, PNG and interactive HTML with connection highlighting and full-diagram PNG/SVG exports.
Inputs: nodes (required), title (required), c4Level (required), relationships (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Four tools (analyze, get_summary, query, compare) have clearly distinct verbs on the same graph resource, which is fine. However, render_architecture_graph and render_c4_mermaid both produce a compact C4 image plus Mermaid source plus optional Markdown/SVG/PNG/HTML files, making their boundaries nearly indistinguishable and forcing the agent to guess which to call.
All six tools follow a consistent snake_case verb_noun pattern (analyze_*, get_*, render_*, query_*, compare_*). Minor deviation: two of them use 'architecture' as the noun while render_c4_mermaid uses the 'c4_mermaid' domain phrasing, which also breaks the resource-naming symmetry.
Six tools is well-scoped for an architecture-analysis pipeline: analysis, summary, query, compare, and rendering. Every tool maps to a real stage in the workflow, with only the duplicate renderer arguably removable.
The lifecycle is well covered: parse dependencies, persist a graph, read a summary, explore a bounded neighborhood, diff two graphs, and render. Minor gap: no tool to list, delete, or explicitly re-validate/refresh saved graphs, so agents lack discovery and cleanup operations.
Maintenance
Related MCP Connectors
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Related MCP Servers
- FlicenseAqualityDmaintenanceAnalyzes codebases to generate dependency graphs and architectural insights across multiple programming languages, helping developers understand code structure and validate against architectural rules.620-
- AlicenseNot gradedqualityDmaintenanceTransforms TypeScript and JavaScript codebases into a persistent code knowledge graph in SQLite, enabling structural codebase navigation via deterministic graph queries without reading source files.8 npmMIT
- AlicenseAqualityDmaintenanceProvides deep structural analysis of TypeScript and JavaScript code via the TypeScript Compiler API, offering 20 tools for functions, types, call graphs, code quality, dead code detection, and IDE integration.2067 npm1MIT
- AlicenseAqualityNot gradedmaintenanceProvides read-only structural analysis of codebases, surfacing architecture smells with traffic-light ratings and rendering dependency relationships as Mermaid flowcharts.4MIT














