The MCP server
The diagramming MCP server lets Claude Code — and other MCP-capable agents — read and write your .diagram files directly, in real time. When the agent edits the file, the canvas updates instantly. You can watch the diagram take shape and jump in to adjust at any point.
Unlike cloud-based diagram tools where an agent mutates a remote workspace via API, here the agent co-edits the same source file in your repo. Every change is a text edit on the .diagram file — reviewable, revertible, branchable like any code change.
Add the MCP server to Claude Code
Install the MCP server using the Claude Code CLI. Run this command from your terminal — it registers the server globally for all your Claude Code sessions.
- Register the MCP serverRun this once. It adds
diagrammingto your Claude Code MCP configuration. - Or: configure manually in
claude_mcp_settings.jsonIf you prefer manual configuration, add the following to your Claude Code MCP settings file: - Generate an agent tokenAgent tokens authorise Claude Code to access a specific diagram. Generate one from the diagram's Agent tokens panel.Generate a token in the appOpen any diagram in diagramming, then open the Agent tokens panel from the diagram settings. Choose a permission level (read-only or read & write) and an expiry up to 14 days. This creates a scoped token valid for that diagram. Paste it as
YOUR_AGENT_TOKENabove.
Tools the agent gets
Once connected, Claude Code has access to the following MCP tools scoped to the diagram and session you authorised:
.diagram text for the active session. The agent calls this to understand the current state before making edits..diagram text; the server validates the syntax and propagates the update to all connected canvas clients in real time. Human collaborators see the change appear live.Token scope & expiry
If you open the same diagram on a different branch, you'll need a new token for that branch. This is intentional — it matches the branch-per-token model, so you can give Claude Code access to a feature/refactor branch without touching main.
write-diagram, an "Agent is editing…" banner appears at the top of the canvas and the agent's violet cursor moves across nodes in real time. You can edit simultaneously — conflicts are merged automatically.Example prompts to try
Once the MCP server is wired up, here are some prompts to start with in Claude Code: