C4Loom
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., "@C4Loom Generate C1–C4 diagrams for my e-commerce system with web, API, and database containers."
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.
C4Loom
Weave architecture into diagrams.
A local-first MCP server that generates real C1-C4 diagrams, not just diagram text.
Quick start · Diagram gallery · Connect your agent · MCP tools · Contributing
Why C4Loom?
Writing a Structurizr workspace is only part of the job. C4Loom takes the next step: it validates an explicit architecture model, runs actual rendering engines, and returns editable sources, transparent images, and an offline viewer through the Model Context Protocol.
Your agent supplies the architectural facts. C4Loom turns those facts into inspectable artifacts, with a unique run directory and SHA-256 hashes.
Capability | What you get |
All four C4 levels | System context, containers, components, and explicit code detail. |
Native Structurizr rendering | C1-C3 rendered with Structurizr's own browser visualization. |
Real code diagrams | C4 rendered by PlantUML/Smetana and linked to its component as an image view. |
Transparent exports | SVG and PNG with transparent outer canvases and checked PNG alpha. |
Editable outputs | Architecture JSON, Structurizr DSL/JSON, and PlantUML source. |
Traceable runs | Artifact hashes, engine fingerprints, events, and image verification receipts. |
Local-first operation | No hosted renderer, embedded LLM, API key, Docker, or Graphviz required. |
Optional official validation | Connect the official Structurizr MCP as an additional structural validator. |
Related MCP server: Excalidraw Architect MCP
Diagram gallery
These diagrams are generated from the executable C4Loom self-architecture example. They describe this tool, not a fictional application.
C1 · System context | C2 · Containers |
|
|
C3 · MCP server components

C4 · Architecture compiler modules

Quick start
Prerequisites
Node.js 22+ and npm.
Java 21+, available as
javaor configured throughC4_JAVA.Git, and internet access for the initial dependency and engine downloads.
Enough disk space for the engines, Chromium, dependencies, and generated runs.
Install and generate
git clone https://github.com/h0w4r/c4loom.git
cd c4loom
npm ci
npm run setup
npx playwright install chromium
npm run demoOn Linux, install browser system libraries with
npx playwright install --with-deps chromium when needed.
The demo connects through a real MCP stdio client, generates all four levels,
and prints the output directory, manifest, and viewer paths. Open the resulting
viewer/index.html in a browser to navigate the model.
The repository is public, but the npm package is intentionally marked
private: install from Git; no published npm package is required.
Connect your agent
Any MCP client supporting stdio
Use absolute paths appropriate to your machine:
{
"mcpServers": {
"c4loom": {
"command": "node",
"args": ["/absolute/path/to/c4loom/src/server.mjs"],
"env": {
"C4_OUTPUT_ROOT": "/absolute/path/to/diagram-output"
}
}
}
}On Windows, use forward-slash paths such as C:/tools/c4loom/src/server.mjs.
The enclosing configuration format varies by client; the command, arguments,
and environment above are the stdio connection settings.
The server reserves stdout for MCP JSON-RPC and writes progress to stderr.
If node or java is unavailable in the client's environment, specify its
absolute executable path.
Codex project configuration
npm run configure -- --project /absolute/path/to/your/projectThis adds a c4loom entry to that project's .codex/config.toml, without
changing global settings or replacing existing server entries. If the entry
already exists, the command stops without changing it.
With no --project argument, it registers in the C4Loom checkout itself.
The target project must be trusted by Codex. Reload MCP connections or start
a new session if the client was already open.
Example request to your agent
Use C4Loom to generate the four C4 levels for this repository. Inspect the implementation first, build an explicit architecture model, and do not invent components or code members. Return the PNG/SVG paths and the offline viewer.
The agent must map verified architectural facts into the tool's model schema. C4Loom does not reverse-engineer a repository by itself.
MCP tools
Tool | Input | Result |
|
| Real C1-C4 diagrams, editable sources, viewer, and manifest. |
|
| Real C1-C3 images from an existing workspace. |
| Absolute artifact | A PNG image or supported text artifact inside the output root. |
| No arguments | Engine hash verification and configured runtime information. |
levels defaults to [1, 2, 3, 4]. A full request requires declared containers,
components, and at least one explicit code view. For a model without code detail,
request only the supported lower levels instead of inventing it.
check_runtime verifies engine files; it does not prove that Java, Chromium,
the MCP client, and image generation work together. Run the demo or E2E suite
to test the complete path.
Architecture model
Field | Meaning |
| Workspace identity and purpose. |
| Identifier of the system to detail. |
| People with |
| Systems and their containers. |
| Components within each container. |
| Explicit |
| Code views attached to components in the focal system. |
| Classes, interfaces, modules, procedures, or records. |
| Dependencies, associations, composition, or inheritance. |
See the complete working model and the schema and compiler. Identifiers must start with an ASCII letter and contain only ASCII letters, numbers, or underscores. References must point to declared elements. Names and descriptions preserve the supplied language; generated C4 terminology defaults to English.
What each run produces
output/<project>/<run-id>/
├── architecture.json
├── workspace.dsl
├── workspace.json
├── manifest.json
├── diagrams/
│ ├── C1_context.svg / .png / .image.json
│ ├── C2_containers.svg / .png / .image.json
│ ├── C3_<container>.svg / .png / .image.json
│ └── C4_<view>.puml / .svg / .png / .image.json
└── viewer/
└── index.html + local viewer assetsEach generation gets a new UUID directory. The manifest records engine versions, requested views, rendering events, artifact sizes, and SHA-256 hashes. Image receipts record dimensions, visible pixels, and corner alpha. Run directories also preserve engine logs for diagnosis.
Transparency applies to the outer canvas. Diagram nodes, component boundaries, and other intentional visual elements may retain their own fills.
How it works
Validate the explicit architecture contract and element references.
Compile Structurizr DSL and code-view PlantUML.
Render C4 locally with PlantUML's Smetana layout engine.
Parse and export the complete workspace with the official Structurizr engine.
Render C1-C3 using the native Structurizr browser export API in Chromium.
Verify and persist transparent images, editable sources, viewer, and manifest.
The C4 code view is a PlantUML-rendered image associated with a Structurizr component. It is not presented as a native Structurizr UML renderer.
Local-first by default
Rendering uses local engines and browser assets. By default, architecture models are not sent to an external validation or rendering service. Initial installation downloads dependencies, Chromium, and pinned engine artifacts.
Imported DSL is deliberately restricted: no executable ! directives,
workspace inheritance, external URLs, themes, icons, or image resources.
Artifact reads are confined to the configured output root, including checks
against escaping links and junctions. Run C4Loom with trusted local clients;
these checks are not a general-purpose hostile-code sandbox.
Optional official Structurizr MCP
Set C4_OFFICIAL_MCP_URL to add the official server's validate tool to the
pipeline. The validator must return OK; rejection or connection failure stops
the run rather than silently skipping a configured dependency.
Loopback endpoints work without extra opt-in. Non-loopback endpoints also
require C4_ALLOW_REMOTE_OFFICIAL=1. Enabling one sends the structural DSL
to that service.
This supplementary validation excludes local C4 image references because the official MCP parser restricts filesystem access. The local Structurizr parser still validates the complete workspace, and PlantUML renders the code detail. The manifest records the validation scope explicitly.
Configuration
Variable | Default / purpose |
|
|
|
|
|
|
| Playwright-managed Chromium; optional executable override. |
| Optional externally managed Node package directory. |
|
|
|
|
|
|
| Unset; optional official MCP endpoint. |
| Unset; set to |
The Codex registration helper explicitly sets the target project's output root
to .local/c4loom, separate from the direct server default above.
Pinned engines
Engine | Version | Download source |
Structurizr |
| Official Structurizr distribution. |
PlantUML MIT |
| Maven Central |
npm run setup verifies pinned SHA-256 digests before reuse. The PlantUML
digest was checked against Maven Central. The Structurizr pin records the
reviewed official HTTPS download; it is not a vendor signature. Engine binaries
and node_modules are not committed.
Testing
npm test
npm run test:e2eThe E2E suite uses the real MCP SDK over stdio and actual engines. It checks invalid-input rejection, a real Structurizr parser failure, recovery in the same session, C1-C4 generation, artifact hash read-back, PNG retrieval through MCP, an outside-root read rejection, and navigation across all four native viewer views. PNG transparency checks run during generation.
Local test evidence is written to .evidence/ and ignored by Git. CI runs unit
and real rendering tests on Windows and Linux; the badge reports the actual
workflow status rather than a hardcoded passing label.
Troubleshooting
Symptom | What to check |
Missing engines | Run |
Java launch/version error | Install Java 21+ and check |
Chromium executable missing | Run |
Browser libraries missing on Linux | Run |
Missing code view | Declare |
MCP tools not visible | Check absolute paths, project trust, and reconnect the client. |
Official validation fails | Check the endpoint and enabled DSL tools; inspect the run diagnosis. |
Failed runs keep available diagnostics in their output directory. Long engine work is monitored for activity rather than cancelled solely for elapsed time.
Project layout
src/model.mjs Model schema, validation, DSL and PlantUML compilation
src/pipeline.mjs Generation, optional validation, manifests, artifact reads
src/render.mjs Native Structurizr export, code rendering, transparent PNG
src/runtime.mjs Engine integrity, path boundaries, process supervision
src/server.mjs Four MCP tools over stdio
scripts/ Setup, project registration, demo, and real E2E clients
examples/ Executable self-architecture model
test/ Contract tests
docs/assets/ Brand assets and real generated diagram examplesContributing and license
Contributions are welcome. See CONTRIBUTING.md for setup, validation expectations, and pull request guidance.
Original C4Loom code is MIT licensed. Third-party engines and dependencies retain their own licenses; see THIRD_PARTY_NOTICES.md.
Built on Structurizr, PlantUML, and the MCP TypeScript SDK. Learn more about the C4 model and the official Structurizr MCP.
C4Loom is an independent project, not an official Structurizr product.
Available Tools
4 toolscheck_runtimeCheck local enginesARead-only
Verify Structurizr and PlantUML hashes. This check does not replace a real generation.
Inputs: no named parameters.
generate_c4Generar diagrams C4B
Generate Structurizr DSL/JSON and real C1 context, C2 container, C3 component and C4 code diagrams from an explicit architecture model. Returns transparent SVG/PNG, a viewer and a hashed manifest.
Inputs: model (required), project (required), levels.
read_artifactRead a generated artifactBRead-only
Return PNG images, editable sources or manifests, restricted to the output root.
Inputs: path (required).
render_structurizrRender Structurizr DSLA
Render real C1-C3 images from self-contained DSL. Use generate_c4 with codeViews for C4. Rejects executable directives and external references.
Inputs: dsl (required), project (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
generate_c4 and render_structurizr both produce C1-C4 diagrams, which is the one real overlap, but the descriptions explicitly delineate them (explicit architecture model vs. self-contained DSL, and render_structurizr points to generate_c4 with codeViews for C4). read_artifact and check_runtime are clearly distinct utility operations.
All four tools follow a consistent verb_noun snake_case pattern (generate_c4, render_structurizr, read_artifact, check_runtime). No mixing of conventions or vague standalone verbs.
Four tools is a tight, well-scoped surface for a diagram generation server, with generation, rendering, artifact retrieval, and runtime verification each earning a slot. It is on the lean side but nothing feels redundant.
The core loop (generate, render, read output, verify runtime) is covered, but read_artifact requires knowing an exact path and there is no list/gallery tool to discover existing artifacts, nor any cleanup or model-validation operation. Agents hitting an unknown output filename have a dead end.
Related MCP Connectors
Software diagrams for developers, teams and agents — give your AI agents diagramming superpowers.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Design domain models and generate deterministic multi-stack code, driven by your coding agent.
Draw architecture diagrams, UML, planning boards and clickable wireframes from your AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to generate auto-laid-out, hand-drawn-style Excalidraw diagrams across 25 diagram types from natural-language structure descriptions, with SVG/PNG export and natural-language revision. Runs fully offline without API keys and can persist the described system as a queryable architecture knowledge graph.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to turn natural-language descriptions of systems, flows, and data into 25 types of hand-drawn Excalidraw diagrams with automatic layout and architecture-aware styling, then revise them conversationally and export to SVG or PNG. It can also persist a system as a version-controlled, queryable architecture knowledge graph, running fully offline without API keys.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to turn system architecture into auto-laid-out, editable Excalidraw diagrams across 25 diagram types — architecture, sequence, flowcharts, state machines, ER models, swimlanes, Gantt, and charts — with architecture-aware styling, SVG/PNG export, and natural-language revision. It can also persist the system as a version-controlled, queryable knowledge graph, running fully offline without API keys.-
- FlicenseNot gradedqualityAmaintenanceEnables users to turn architecture into a queryable knowledge graph and produce editable, hand-drawn, auto-laid-out diagrams across 25 types, with natural-language revisions and SVG/PNG export. It runs fully offline without API keys.-

