Docs / Run it

AI agents

Let Claude, Cursor or Codex draw diagrams and fix their layout problems.

MCP server

open-diagram can run as an MCP server: a small program that AI apps start on your computer, so the AI can draw diagrams as one of its own actions. Nothing is hosted and nothing leaves your computer. It accepts JSON and Mermaid only, never Python, and writes files only inside one output folder.

The commands below use uv, which fetches open-diagram and the Python it needs (3.10 or later) the first time.

Claude Code

claude mcp add open-diagram -- uvx --python 3.12 --from "open-diagram[mcp]" open-diagram-mcp

Claude Desktop (claude_desktop_config.json) or Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "open-diagram": {
      "command": "uvx",
      "args": ["--python", "3.12", "--from", "open-diagram[mcp]", "open-diagram-mcp",
               "--out", "/Users/you/Documents/open-diagram"]
    }
  }
}

Without uv: pip install "open-diagram[mcp]", then use open-diagram-mcp as the command. uv keeps a copy of what it downloaded; to pick up a new release, add --refresh once after uvx.

ActionWhat the AI gets
format_guideA JSON example to copy, every key, Mermaid support, and how to fix each kind of problem
checkThe layout problems, without writing files, so it can fix and retry quickly
drawWrites the SVG and PNG, and returns the problems, the file paths, the plain-words description and the picture itself
describeWhat the picture says, in plain words
templateThe list of templates, or one template as JSON to start from

Icons come only from the built-in icons and from folders you name with --icons (or the OPEN_DIAGRAM_ICONS environment variable), never from a path the AI writes. Files go to --out, else the OPEN_DIAGRAM_OUT environment variable, else an open-diagram folder where the app starts the server (or in your home folder if that one cannot be written).

Agent skill

The folder skills/open-diagram/ is an Agent Skill: instructions an agent loads when it needs them. For Claude Code, copy it into your skills folder:

cp -r skills/open-diagram ~/.claude/skills/

Then ask for a picture in plain words, for example: "Draw a systems map of our checkout, warehouse and reporting, with what is live and what is planned." The skill tells the agent to plan the columns, write the script, run it, fix each named problem, and look at the PNG before it answers.

Agents changing the library itself should start with AGENTS.md.

Cloud service icons

The cloud-icons/ folder has one file each for AWS, Azure and Google Cloud. Each file lists service keys, such as s3 or lambda, with the web address of that service's SVG icon. AWS also includes mwaa, glue and athena for ETL diagrams. Every address points to one fixed version of the icon file, so later changes to the icon collection do not change your diagrams. A third party, theSVG, hosts the files; once downloaded, they work offline.

The cloud-icons skill tells an agent how to pick icons, download them, and pass each file to Resource(icon=...) or Tile(icon=...). The finished SVG and PNG contain the icons themselves, so you can share them without the icon links. JSON and the MCP server take icons by name ("icon": "aws/s3") from the built-in icons or from a folder you add with --icons; Mermaid does not take icons. For Claude Code, copy the skill into your skills folder:

cp -r skills/cloud-icons ~/.claude/skills/

The icon lists stay in your copy of this repo. If you run the skill's example from another folder, set its ICON_DIR to the cloud-icons/ folder in your copy.

The icons belong to Amazon, Microsoft and Google, and keep their own terms; this project's MIT license does not cover them. The skill links each provider's terms and says how to credit the icons when you share a diagram.