HTTP proxy for the draw.io MCP server with temporary shortened diagram links
277
Runs the official @drawio/mcp server behind an HTTP proxy so that chat clients such as OpenWebUI can connect to it. The proxy also shortens the diagram links, because chat models damage long URLs when they write them into replies.
@drawio/mcp communicates only over stdio. Its tools (open_drawio_xml, open_drawio_mermaid, open_drawio_csv) return an app.diagrams.net editor URL with the entire diagram encoded in the URL fragment. These URLs are usually 1000 to 1800 characters long.
This causes two problems in a chat client:
What this service does:
supergateway translates between HTTP and the stdio server.No diagram content is sent to any external server. The diagram stays in the URL fragment, and the full URL travels only between this service and the user's browser.

| Method | Path | Purpose | Auth |
|---|---|---|---|
| POST/GET | /mcp | MCP Streamable HTTP endpoint | optional bearer token |
| GET | /d/<id> | Redirect (302) to the full draw.io editor URL for that short id | none |
| GET | /healthz | Liveness check, returns ok | none |
/d/<id> and /healthz are intentionally unauthenticated: browsers cannot attach an Authorization header when following a link, and the ids are unguessable random values.
From Docker Hub:
docker run -d --name drawio-mcp -p 8000:8000 \
-e DRAWIO_MCP_PUBLIC_BASE_URL=http://localhost:8000 \
edgaras0x4e/drawio-mcp-http
Or build from source:
docker build -t drawio-mcp-http .
docker run -d --name drawio-mcp -p 8000:8000 \
-e DRAWIO_MCP_PUBLIC_BASE_URL=http://localhost:8000 \
drawio-mcp-http
Then point an MCP client at http://localhost:8000/mcp.
Minimal docker-compose.yml:
services:
drawio-mcp:
image: edgaras0x4e/drawio-mcp-http
ports:
- "8000:8000"
environment:
DRAWIO_MCP_PUBLIC_BASE_URL: http://localhost:8000
The
docker-compose.ymlin this repository additionally joins an external Docker network (docker_tools_default) so it can be reached by name from a co-located client container. Remove thatnetworks:block, or replace it with your own, for a standalone setup.
All configuration is via environment variables. None are required except in the situations noted.
| Variable | Default | Description |
|---|---|---|
DRAWIO_MCP_PUBLIC_BASE_URL | http://localhost:8000 | Base of the short links. Must be reachable from the user's browser, not from the MCP client. Set this to the public/base URL the browser uses to reach /d/<id>. |
DRAWIO_MCP_BEARER_TOKEN | empty (auth disabled) | If set, /mcp requires Authorization: Bearer <token>. Compared in constant time. Recommended when the endpoint is publicly reachable. |
DRAWIO_MCP_PREFERRED_DIAGRAM_TYPE | mermaid | mermaid, xml, or csv. A line is appended to every open_drawio_* tool description steering the model toward that type. Set to an empty string to disable the steering. |
DRAWIO_MCP_INSTRUCTION_TEMPLATE | see below | Text that replaces a successful diagram tool result. {url} expands to the short link (every occurrence). |
DRAWIO_MCP_SHORTLINK_TTL_DAYS | 7 | Age after which unused short links are deleted by an hourly sweep. |
DRAWIO_MCP_LINKS_DB | /tmp/links.db | Path to the sqlite file that stores short links. |
Default DRAWIO_MCP_INSTRUCTION_TEMPLATE:
Draw.io Editor URL:
{url}
Assistant instruction: your visible reply must contain exactly this markdown line, with the URL copied character-for-character. Never decode, re-encode, shorten, split, or retype any part of the URL:
[Temporary Draw.io Link]({url})
Example for OpenWebUI (Admin Panel, Integrations, Add Connection):
MCP Streamable HTTP<DRAWIO_MCP_PUBLIC_BASE_URL>/mcp (for example http://localhost:8000/mcp)None, or Bearer with the token if DRAWIO_MCP_BEARER_TOKEN is setAsk the model for a diagram. It calls one of the drawio tools, and its reply contains the short Temporary Draw.io Link. Clicking it opens the diagram in the draw.io editor.
Short links are stored in a sqlite database at DRAWIO_MCP_LINKS_DB. Identical diagrams reuse the same id (deduplication). Entries older than DRAWIO_MCP_SHORTLINK_TTL_DAYS are swept hourly.
The database is container-internal and not intended to be mounted: links are temporary by design. They survive an in-place container restart, but are lost when the container is recreated (image update, replica reschedule).
DRAWIO_MCP_BEARER_TOKEN whenever /mcp is reachable from an untrusted network.DRAWIO_MCP_PUBLIC_BASE_URL must resolve for end users' browsers. If the service sits behind a reverse proxy or gateway, set it to the externally visible base URL and route /d/* through to this service.You need Node.js 22 or newer. Install the two packages globally, then start the server:
npm install -g @drawio/[email protected] [email protected]
node server.js
@drawio/mcp by jgraph, the upstream draw.io MCP server.supergateway, the stdio to HTTP bridge.MIT
Content type
Image
Digest
sha256:f850724c9…
Size
72.1 MB
Last updated
3 days ago
docker pull edgaras0x4e/drawio-mcp-http