{
  "markdown": "<p align=\"center\">\n  <img src=\"docs/assets/readme-hero.svg\" alt=\"DrawArch transforms a reference architecture image into a native editable Draw.io diagram\" width=\"100%\" />\n</p>\n\n<h1 align=\"center\">DrawArch MCP</h1>\n\n<p align=\"center\">\n  <strong>Turn architecture prompts and reference images into portable, natively editable Draw.io files.</strong>\n  <br />\n  Your MCP host does the visual reasoning. DrawArch does the deterministic rendering, asset embedding, validation, and delivery.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/Ajey95/drawarch-mcp/actions/workflows/ci.yml\"><img alt=\"CI status\" src=\"https://github.com/Ajey95/drawarch-mcp/actions/workflows/ci.yml/badge.svg\" /></a>\n  <a href=\"https://github.com/Ajey95/drawarch-mcp/releases/tag/v0.2.0\"><img alt=\"GitHub release\" src=\"https://img.shields.io/github/v/release/Ajey95/drawarch-mcp?display_name=tag&sort=semver&color=7c3aed\" /></a>\n  <a href=\"https://www.npmjs.com/package/drawarch-mcp\"><img alt=\"npm version\" src=\"https://img.shields.io/npm/v/drawarch-mcp?color=cb3837&logo=npm\" /></a>\n  <a href=\"https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.Ajey95%2Fdrawarch\"><img alt=\"Official MCP Registry\" src=\"https://img.shields.io/badge/MCP%20Registry-active-22c55e\" /></a>\n  <a href=\"https://github.com/Ajey95/drawarch-mcp/pkgs/container/drawarch-mcp\"><img alt=\"GHCR container\" src=\"https://img.shields.io/badge/GHCR-drawarch--mcp-2563eb?logo=github\" /></a>\n  <img alt=\"Node.js 20 or newer\" src=\"https://img.shields.io/badge/Node.js-20%2B-339933?logo=nodedotjs&logoColor=white\" />\n  <img alt=\"MCP stdio and Streamable HTTP\" src=\"https://img.shields.io/badge/MCP-stdio%20%7C%20HTTP-06b6d4\" />\n  <a href=\"LICENSE\"><img alt=\"MIT license\" src=\"https://img.shields.io/badge/license-MIT-22c55e\" /></a>\n</p>\n\n<a href=\"https://m8ven.ai/mcp/ajey95-drawarch-mcp-1m89eu\">\n  <img src=\"https://m8ven.ai/badge/mcp/ajey95-drawarch-mcp-1m89eu\" alt=\"M8ven Score\">\n</a> \n<p align=\"center\">\n  <a href=\"#quick-start\"><strong>Quick start</strong></a> ·\n  <a href=\"#reference-image-recreation\"><strong>See the workflow</strong></a> ·\n  <a href=\"docs/ARCHITECTURE.md\"><strong>Architecture</strong></a> ·\n  <a href=\"CONTRIBUTING.md\"><strong>Contribute</strong></a>\n</p>\n\n---\n\n## See what stays editable\n\n<p align=\"center\">\n  <img src=\"docs/assets/reference-recreation-demo.svg\" alt=\"A DrawArch-generated SafeSense system architecture open as independently editable Draw.io objects with layers and validation\" width=\"100%\" />\n</p>\n\nThis is not a screenshot pasted into a diagram. Containers, labels, icons, shapes, connector endpoints, ports, and waypoints remain separate native `mxCell` objects. Assets are embedded inside the `.drawio` file, so the result remains portable and editable offline.\n\n> [!IMPORTANT]\n> DrawArch does not call another LLM and does not require a second LLM API key. ChatGPT, Claude, Codex, Cursor, or another vision-capable MCP host analyzes the request or image and supplies the scene graph.\n\n## What DrawArch gives you\n\n| | Capability | What it means |\n|---|---|---|\n| 🧩 | Native editability | Move, restyle, relabel, reconnect, or delete individual objects in diagrams.net. |\n| 🎯 | Reference recreation | Rebuild an attached architecture image with absolute geometry, layers, z-order, ports, and waypoints. |\n| 🌐 | Real-world assets | Use bundled icons, Iconify-compatible icons, user images, or approved HTTPS image sources. |\n| 📦 | Portable artifacts | The generated `.drawio` is returned directly through MCP with all image assets embedded. |\n| 🔐 | Approval-aware rendering | Immutable plan revisions and revision-bound approval tokens prevent stale or unreviewed renders. |\n| ✅ | Validation built in | Check Draw.io structure, references, asset safety, and structural coverage before accepting output. |\n\n## Reference-image recreation\n\nAttach an architecture image to your MCP host and ask:\n\n> Recreate this image with DrawArch. Preserve its layout, labels, icons, grouping, and connector routing. Keep every visible object editable and use real icons where appropriate.\n\nThe host and DrawArch then follow a reviewable four-step loop:\n\n1. **Prepare** — the host vision model calls `prepare_reference_recreation` with a typed absolute scene graph.\n2. **Review and approve** — the user or host policy reviews layout and online asset sources; approval is bound to that exact revision.\n3. **Create** — `create_reference_drawio` safely resolves and embeds assets, renders native cells, validates the file, and returns the `.drawio` resource.\n4. **Compare and revise** — `compare_reference_recreation` measures structural coverage; the host adjusts the plan and repeats when needed.\n\n```mermaid\nflowchart LR\n    A[Prompt or<br/>reference image] --> B[Vision-capable<br/>MCP host]\n    B -->|typed scene graph| C{DrawArch MCP}\n    C --> D[Plan revision<br/>& approval]\n    D --> E[Safe asset<br/>resolver]\n    E --> F[Native Draw.io<br/>renderer]\n    F --> G[Validation &<br/>comparison]\n    G -->|portable resource| H[Editable<br/>.drawio file]\n    G -. revise .-> B\n```\n\nIn plain terms: your existing AI analyzes the image; DrawArch turns that analysis into a controlled, validated, editable file. The complete contract is demonstrated in [`examples/reference-recreation.json`](examples/reference-recreation.json).\n\n## Why not just generate an image?\n\n| Requirement | DrawArch | Flat image generation |\n|---|:---:|:---:|\n| Edit individual components | ✅ | ❌ |\n| Reattach and reroute connectors | ✅ | ❌ |\n| Preserve explicit IDs and hierarchy | ✅ | ❌ |\n| Work offline after generation | ✅ | Usually |\n| Validate structure automatically | ✅ | ❌ |\n| Recreate with real embedded icons | ✅ | Inconsistent |\n| Iterate through a reviewable plan | ✅ | ❌ |\n| Guarantee pixel-identical output | No — host-guided iteration | No |\n\nDrawArch optimizes for **high-fidelity, editable reconstruction**, not an opaque pixel replica. The host vision model can inspect the result, update geometry or styling, and render another immutable revision.\n\n## Quick start\n\nRequires [Node.js 20+](https://nodejs.org/) or Docker.\n\n### Run from npm\n\n```bash\nnpx -y drawarch-mcp@0.2.0\n```\n\nDrawArch uses stdio by default. Diagnostics go to stderr, preserving stdout for MCP messages.\n\n### Add it to a local MCP host\n\n```json\n{\n  \"mcpServers\": {\n    \"drawarch\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"drawarch-mcp@0.2.0\"],\n      \"env\": {\n        \"DRAWARCH_OUTPUT_DIR\": \"/absolute/path/to/diagrams\",\n        \"DRAWARCH_ONLINE_ASSETS\": \"false\"\n      }\n    }\n  }\n}\n```\n\nOn Windows hosts that do not resolve `npx` directly, set `command` to `npx.cmd`. You can also use the [source checkout](#run-from-source) and configure an absolute `dist/src/index.js` path.\n\n### Run from source\n\n```bash\ngit clone https://github.com/Ajey95/drawarch-mcp.git\ncd drawarch-mcp\nnpm ci\nnpm test\nnpm run build\n```\n\nThen configure your host:\n\n```json\n{\n  \"mcpServers\": {\n    \"drawarch\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/drawarch-mcp/dist/src/index.js\"],\n      \"env\": {\n        \"DRAWARCH_OUTPUT_DIR\": \"/absolute/path/to/diagrams\"\n      }\n    }\n  }\n}\n```\n\n### Run the published container\n\n```bash\ndocker run --rm -p 3000:3000 \\\n  -e DRAWARCH_API_KEY=replace-with-a-long-random-secret \\\n  -e DRAWARCH_APPROVAL_SECRET=replace-with-another-random-secret \\\n  -e DRAWARCH_ALLOWED_HOSTS=localhost,127.0.0.1 \\\n  -e DRAWARCH_ALLOWED_ORIGINS=localhost,127.0.0.1 \\\n  -v drawarch-data:/data \\\n  ghcr.io/ajey95/drawarch-mcp:0.2.0\n```\n\nThe container runs Streamable HTTP on `http://localhost:3000/mcp`. Its public health probe is `GET /health`; MCP and file downloads require the configured bearer token.\n\n## Local and remote hosts\n\n| Host type | Recommended transport | Notes |\n|---|---|---|\n| Claude Desktop / Claude Code | stdio or remote HTTP | Local stdio is simplest; remote connectors can use `/mcp`. |\n| Codex / Cursor / VS Code | stdio or remote HTTP | Use local stdio for per-developer output or a shared authenticated service. |\n| ChatGPT | remote Streamable HTTP | ChatGPT cannot spawn the local stdio process; deploy the container behind HTTPS first. |\n| CI and team services | Streamable HTTP | Set bearer auth, stable approval secret, exact host/origin allowlists, TLS, and a persistent output volume. |\n\nDrawArch currently provides the deployable server and public container, not a managed hosted endpoint. Operators supply the HTTPS domain and infrastructure.\n\n## MCP tools\n\n### Architecture generation\n\n| Tool | Purpose |\n|---|---|\n| `list_themes` | List six built-in visual themes. |\n| `list_assets` | Search the bundled real-world icon catalog. |\n| `resolve_asset` | Resolve a bundled or opt-in online SVG with provenance. |\n| `create_drawio` | Generate a deterministic themed architecture diagram. |\n| `validate_drawio` | Validate a generated architecture file. |\n\n### Reference recreation\n\n| Tool | Purpose |\n|---|---|\n| `prepare_reference_recreation` | Store an absolute editable scene graph and optionally approve its sources. |\n| `update_reference_plan` | Create an immutable next revision and invalidate earlier approvals. |\n| `get_reference_plan` | Read the latest scene-graph revision for review. |\n| `create_reference_drawio` | Render an approved plan and return the portable `.drawio` artifact. |\n| `validate_reference_drawio` | Validate native structure, references, and embedded-image safety. |\n| `compare_reference_recreation` | Score structural coverage and report missing editable elements. |\n\n## Asset and security model\n\nReference plans support four asset modes:\n\n| Mode | Source | Server opt-in required? |\n|---|---|:---:|\n| `bundled` | Original MIT-licensed DrawArch SVG catalog | No |\n| `online` | Iconify-compatible icon query | Yes |\n| `data` | User-provided SVG, PNG, JPEG, or WebP data URI | No |\n| `remote` | Explicit approved HTTPS image URL | Yes |\n\nRemote image handling rejects URL credentials, non-HTTPS protocols, custom ports, private or reserved DNS answers, unsafe redirects, excessive byte/pixel sizes, and active SVG content. Raster images are decoded and re-encoded before embedding. Online assets retain provider and license metadata; users remain responsible for verifying third-party license terms.\n\nHTTP deployments additionally support bearer authentication, host validation, origin validation, safe output paths, atomic writes, and revision-bound HMAC approval tokens. See [`SECURITY.md`](SECURITY.md) for deployment guidance and vulnerability reporting.\n\n<details>\n<summary><strong>Environment variables</strong></summary>\n\n| Variable | Default | Meaning |\n|---|---|---|\n| `DRAWARCH_TRANSPORT` | `stdio` | Select `stdio` or `http`. |\n| `DRAWARCH_OUTPUT_DIR` | `.drawarch-output` | Restricted output and plan-storage directory. |\n| `DRAWARCH_ONLINE_ASSETS` | `false` | Enable opt-in online and remote image sources. |\n| `DRAWARCH_ICONIFY_BASE_URL` | Iconify API | HTTPS Iconify-compatible provider base URL. |\n| `HOST` | `127.0.0.1` | HTTP bind host. |\n| `PORT` | `3000` | HTTP listener port. |\n| `DRAWARCH_API_KEY` | unset | Bearer token for `/mcp` and `/files`; required for internet exposure. |\n| `DRAWARCH_APPROVAL_SECRET` | random per process | HMAC secret for approvals; set a stable secret for shared deployments. |\n| `DRAWARCH_ALLOWED_HOSTS` | local hosts | Comma-separated accepted Host values. |\n| `DRAWARCH_ALLOWED_ORIGINS` | local origins | Comma-separated accepted Origin hosts. |\n| `DRAWARCH_PUBLIC_BASE_URL` | listener URL | Public base URL reported by the server. |\n\n</details>\n\n## Development\n\n```bash\nnpm ci\nnpm test                    # 83 tests at the 0.2.0 release\nnpm run build\nnpm run sample\nnpm audit --audit-level=high\nnpm pack --dry-run\n```\n\nThe CI matrix verifies Node 20 and 22 on Windows and Linux and builds the production Docker image. Read [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for component boundaries and security flow.\n\n## Project status\n\n| Channel | Status |\n|---|---|\n| Source | [Public on GitHub](https://github.com/Ajey95/drawarch-mcp) |\n| Release | [`v0.2.0`](https://github.com/Ajey95/drawarch-mcp/releases/tag/v0.2.0) |\n| Container | [`ghcr.io/ajey95/drawarch-mcp:0.2.0`](https://github.com/Ajey95/drawarch-mcp/pkgs/container/drawarch-mcp) |\n| npm | [`drawarch-mcp@0.2.0`](https://www.npmjs.com/package/drawarch-mcp/v/0.2.0) |\n| Official MCP Registry | [`io.github.Ajey95/drawarch@0.2.0`](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.Ajey95%2Fdrawarch) |\n| Managed remote service | Not currently offered |\n\n## Roadmap\n\n- Expand the curated architecture asset catalog and provider metadata.\n- Add preview rendering for tighter host-guided visual comparison loops.\n- Add pixel-aware comparison as a complement to structural scoring.\n- Add installation recipes for more MCP hosts and community catalogs.\n- Provide repeatable deployment recipes for common container platforms.\n\nIdeas and focused pull requests are welcome. Please open an [issue](https://github.com/Ajey95/drawarch-mcp/issues) before starting a large behavior or contract change.\n\n## Contributing\n\nRead [`CONTRIBUTING.md`](CONTRIBUTING.md), follow the [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), and keep generated outputs, credentials, and unlicensed third-party assets out of commits.\n\nFor security concerns, follow the private reporting process in [`SECURITY.md`](SECURITY.md) rather than opening a public issue.\n\n## License\n\nDrawArch source code and bundled assets are available under the [MIT License](LICENSE). Third-party assets keep their original provider licenses and attribution.\n\n---\n\n<p align=\"center\">\n  Built for architecture work that should remain understandable, portable, and yours to edit.\n</p>\n",
  "bytes": 13685,
  "sha": "d02a9e5d06926197c713de2a18ce324c576ac536fb7bdc9ee7bb352f86e2066c",
  "repo_slug": "ajey95/drawarch-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_ajey95_drawarch_d10bd4bc/readme"
}