sample-architecture-diagram-mcp-server
AGENTS.md11 starsChanged 5 months agoMIT-0View on GitHub
Guidance for AI agents driving this MCP server. The primary consumer is an agent that turns a described architecture into a diagram. - generate_html_diagram — the default. Self-contained interactive HTML (open in a browser or attach to an email). Use for almost everything. - auto_generate_diagram — when the user explicitly wants an editable .drawio file laid out automatically. (The HTML also exports .drawio from a button, so prefer generate_html_diagram unless a file is required.) - generate_diagram — only when you…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- aws-architecture-diagramSkill
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 55
Name services canonically: Use the official AWS name (e.g.
- Distinctive: line 97
If the user's ask is about an order of operations (a vend/provisioning flow, an auth handshake, a CI/CD pipeline, a saga), the architecture …
- Very specific: line 118
Add tabs[] yourself only when you need more than the two default tabs (e.g.
- Distinctive: line 121
Keep the two views CONSISTENT: every sequence participant should exist as a node (or group) in the architecture, using the same wording.
- Very specific: line 134
Use a typed tab for what the architecture canvas is not: a migration plan (gantt), a data model (er), a cross-team process (swimlane), a …
- Very specific: line 156
Keep process/step detail in connections[].label and adr, not as extra floating text — the canvas stays clean (AWS diagram guideline).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for AI agents driving this MCP server. The primary consumer is an agent that turns a described architecture into a diagram.
Pick the right tool
generate_html_diagram— the default. Self-contained interactive HTML (open in a browser or attach to an email). Use for almost everything.auto_generate_diagram— when the user explicitly wants an editable.drawiofile laid out automatically. (The HTML also exports.drawiofrom a button, so prefergenerate_html_diagramunless a file is required.)generate_diagram— only when you need manual x/y control.export_diagram— rasterize an existing.drawioto PNG/SVG/PDF (needs the draw.io CLI installed).render_diagram_media— turn an interactive diagram HTML (fromgenerate_html_diagram/diagram_render) into a PNG figure, an animated GIF, and/or an animated SVG, for embedding where JS can't run (blog/WordPress, PDF, email, slide). Two GIF modes:flow(dots looping along the edges) andwalkthrough(one animated segment perstepsbeat, concatenated into a looping tour). The SVG is vector + still animated (flow-dot SMIL kept) — sharp/tiny, but the AWS Blog/WordPress blocks SVG upload, so use SVG for your OWN site and GIF for WordPress. Needs Playwright (npx playwright install chromium) and, for GIF, a full ffmpeg. For a seamless flow loop, pass the SAME seconds value asflowPeriodtogenerate_html_diagramand asperiodtorender_diagram_media.resolve_icon— check/lookup the icon filename for a service name.list_service_configs— a service's IaC config fields.export_iac_json— hand the diagram's architecture off to the official AWS IaC MCP (resources + dependencies + per-nodeconfig.iac).export_diagram_json— extract the diagram's elements as neutral JSON (title,services[],connections[],groups[], per-nodeconfig). Every generated diagram also writes this as a sidecar.jsonnext to the HTML.- Pricing / cost: this server does NOT price. Hand the diagram off — the
sidecar
.json(orexport_diagram_json) — to a cost app such asaws-cost-app-mcp(a separate MCP), which resolves calculator keys and prices via calculator.aws (no AWS credentials).
Making a diagram into media (GIF / PNG / SVG)
generate_html_diagram(..., flowPeriod: 4)for a flow GIF, or addsteps(withstepZoom: true) for a walkthrough GIF.render_diagram_media({ htmlPath, gifPath, mode: 'flow'|'walkthrough', period: 4 }). AddpngPathand/orsvgPathfor more formats in one call.flow→ one seamless loop of the animated data flow.walkthrough→ a tour that holdsbeatDurationon each beat (with its zoom/highlight/card) and loops back to the first.- Pick the format by destination:
- AWS Blog / WordPress → GIF (animated) or PNG (static). SVG upload is blocked there.
- Your own site / embed → SVG — vector, tiny, and still animated.
Authoring a good generate_html_diagram call
- Name services canonically. Use the official AWS name (e.g.
"Amazon Simple Storage Service"or"Amazon S3"). The icon is auto-resolved from the name — do NOT guess aniconfilename. If unsure a name resolves, callresolve_icon. - Set
category(compute/storage/database/networking/security/integration/ analytics/ai/management/general) — it drives the node color. - Add
roleto every service — one line on what it does. This is what makes the diagram documentation, not just boxes. - Type the connections (
network/iam/event/data) so relationships read correctly (auth vs. async vs. data flow). - Place things:
- Single VPC → just set
subnet: "public" | "private"per service. - Anything else (multi-VPC, multi-account, AZs, on-prem) → declare
groups(withparentfor nesting) and point each service at one viaparentId. - Third-party / on-prem actors →
external: true.
- Single VPC → just set
- Capture the WHY — add
adr(context/decision/consequences) andwellArchitectedpillar notes when the user gave rationale. These flow into the IaC handoff so generated infra honors the intent. - Do NOT ask this server to generate IaC. The IaC button emits a spec for
the official
awslabs.aws-iac-mcp-server; hand off to that. Add a
captionwhen the file will be read without you. The diagram'stitle/subtitleonly live in the small floating dock, so a diagram opened cold — an email attachment, a wiki link, a PDF page — starts as boxes with no framing.captionrenders a header band above the canvas:"caption": { "eyebrow": "Arquitetura alvo", // small uppercase label, AWS orange "title": "Portal do Cidadão — camada pública", "text": "One paragraph: what this shows and for whom.", "meta": ["Versão: v2", "Data: 28/09/2026", "Ambiente: produção"] }A plain string (or a
{ en, pt }map) is shorthand for justtext. Eachmetaentry written as"Label: value"renders as a labelled stat; anything else renders as a bare value. In a tabbed document the band sits above the tab rail, so it frames every view. Omitcaptionfor the classic bare canvas (a slide, or a diagram whose surrounding page already has the title).
When the flow matters: add a sequence tab
If the user's ask is about an order of operations (a vend/provisioning flow, an
auth handshake, a CI/CD pipeline, a saga), the architecture alone under-serves it.
Pass sequence to generate_html_diagram (or diagram_add_sequence on a draft)
and the SAME file gains a tab rail: Architecture + the animated UML sequence player.
It is the SAME schema and renderer as the standalone generate_sequence_diagram
output — author it once, embed it either way.
participants[]:{ id, label, sub?, service?, icon?, actor?, stereotype? }— giveservice(canonical AWS name) and the icon resolves itself; useicon: 'tech-icons/<x>.svg'for non-AWS lifelines;actor: truefor a human.events[]in order, each with a requiredidand an explicitkind:{ kind: 'message', id, from, to, label, arrow?, tone?, badge?, … }—arrow: 'sync'|'async'|'reply'(reply = dashed return),badge: 'gate'for a blocking check, plusactivate/deactivate/create/destroy/found/lost.{ kind: 'note', id, over: [a, b], label }for a band of explanation.
fragments[]is a SEPARATE array anchored by event id — never inline begin/else/end events:{ kind: 'alt'|'opt'|'loop'|'par'|'break'|'critical'|'ref'| 'neg'|'assert', label, startId, endId, dividers?: [{ beforeId, label }] }.groups[]boxes participant columns:{ label, participants: [ids], tone? }.- Narrate the important beats:
title,flow,desc(inline markdown),code+codeLabel, andproof(free text or{repo, path, ref, lines}→ clickable link). - Add
tabs[]yourself only when you need more than the two default tabs (e.g. akind: 'doc'tab withsections[]for runbook/decision prose). Tab labels default per kind, so{ id, kind }is enough. - Keep the two views CONSISTENT: every sequence participant should exist as a node (or group) in the architecture, using the same wording.
Typed diagrams in the same document
A kind: 'typed' tab carries one typed diagram: { id, kind: 'typed', label?,
diagram: { kind, title?, … } } with diagram.kind one of er, gantt,
swimlane, tree, timeline, kanban, journey, quadrant, venn,
layers, fishbone, wardley, flywheel, class, workflow. Each kind's
fields follow its spec in packages/diagram-core/src/typed/<kind>.js (the same
specs a downstream app validates with); an invalid body fails the render with
the spec's messages, so fix it and render again.
- Use a typed tab for what the architecture canvas is not: a migration plan
(
gantt), a data model (er), a cross-team process (swimlane), a decision tree (workflow— decisions, branches that converge, narratedsteps). - A
workflowtab is the same documentgenerate_workflow_diagramtakes (nodes, edges, steps); node icons resolve fromservice.
Group variants
aws-cloud, region, vpc, public-subnet, private-subnet,
availability-zone, account, organization, auto-scaling-group, group
(generic logical), corporate-data-center, on-premises.
Gotchas
- Icons are not bundled. If a render result warns that the icon set is missing
(or a diagram comes out as letters), call
setup_icons— it finds the icon package zip (Icon-package_<date>.zip) in~/Downloadson its own and installs into the shared~/.aws-architecture-icons, so it is needed once per machine, not once per install. If it finds no zip it returns the download link: relay that to the user, then call it again. - Layouts:
TB(default),LR,RADIAL. Radial is for flat hub-and-spoke and ignores groups. - Keep process/step detail in
connections[].labelandadr, not as extra floating text — the canvas stays clean (AWS diagram guideline).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

