AI and agents
Diagram MCP server for Claude Code
Draughtsman is a self-hosted diagram server with an MCP interface. Claude Code can create a diagram, patch it, check it and render it, and the person with the diagram open sees the change. This page is the short route; the full reference is Agents and MCP.
Start the server
git clone https://github.com/overpassapps/draughtsman.git && cd draughtsman
docker compose up -d --build
docker compose logs draughtsman | grep "setup code"
Open http://localhost:5180, enter the setup code and create the administrator. The port is published to loopback only.
Add it to Claude Code
In the web app open Tokens, create a token (the dst_... secret is shown once; tick Read-only if the agent should only look), then:
claude mcp add --transport http draughtsman http://127.0.0.1:5180/mcp \
--header "Authorization: Bearer dst_..."
On the same machine you can skip the token and the port: claude mcp add draughtsman -e DRAUGHTSMAN_DATA=/path/to/data -- /path/to/draughtsman mcp --stdio. Use the packaged draughtsman binary for that, not dotnet run, which prints a line to standard output and breaks the stream.
What Claude Code can do
| Tool | Use |
|---|---|
list_documents | Find diagrams by title |
read_document | Read as DSL, JSON, a one-line-per-element outline, or Mermaid |
create_document | Create from DSL, Mermaid, SQL DDL, draw.io, Visio or JSON, with optional layout |
patch_document | Edit through named operations; a bad operation writes nothing |
render_document | Get SVG back (PDF needs the optional Chromium component) |
diff_documents | Compare two versions field by field |
critique_document | Structural findings with element ids |
get_schema | Learn the kinds and shape libraries for a diagram type |
A typical prompt
"Read the Orders diagram, add a Redis cache between the API and the database, run the critique, and tell me what changed." Claude Code reads the outline, sends a patch of addNode and addEdge operations, calls critique_document, then diff_documents. Before the agent's edit, the server stores a checkpoint, so History can restore the earlier version.
The archive includes SKILL.md, written for an agent: the DSL rules agents most often get wrong, the real argument names, and the failures you will meet. Put it where Claude Code reads skills.
Limits
- No delete, rename or restore tool over MCP, and no PNG render.
- A token carries its owner's role. A read-only token can list, read, render, diff and critique, but not create or patch.
- 300 MCP calls per user per minute by default.
- Behind a reverse proxy, turn buffering off for
/mcp. - Version 0.1.0. No single sign-on, per-document permissions or real-time co-editing; see the FAQ.
Other diagram MCP servers
draw.io publishes an MCP server that creates draw.io XML or Mermaid diagrams and can be hosted or self-run (jgraph/drawio-mcp). Excalidraw publishes one for hand-drawn diagrams (excalidraw/excalidraw-mcp). If you want those editors, use those servers; see the comparison for how they differ from Draughtsman.