drawio-mcp-server 1.7.0 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -425
- package/build/assets/downloader.js +96 -0
- package/build/assets/index.js +2 -0
- package/build/assets/manager.js +31 -0
- package/build/config.js +45 -0
- package/build/config.test.js +54 -0
- package/build/emitter_bus.js +2 -3
- package/build/index.js +305 -337
- package/build/plugin/mcp-plugin.js +2618 -0
- package/build/prefetch-assets.js +11 -0
- package/build/real-environment/add-cell-of-shape.test.js +51 -0
- package/build/real-environment/add-edge.test.js +86 -0
- package/build/real-environment/assertions.js +18 -0
- package/build/real-environment/delete-cell-by-id.test.js +45 -0
- package/build/real-environment/edge-editing.test.js +70 -0
- package/build/real-environment/edit-cell.test.js +64 -0
- package/build/real-environment/harness.js +175 -0
- package/build/real-environment/import-export.test.js +82 -0
- package/build/real-environment/layers-and-selection.test.js +70 -0
- package/build/real-environment/logger.js +25 -0
- package/build/real-environment/screenshot.js +46 -0
- package/build/real-environment/set-cell-parent.test.js +64 -0
- package/build/real-environment/shapes.test.js +153 -0
- package/build/real-environment/test-helpers.js +10 -0
- package/build/real-environment/tools.js +22 -0
- package/build/real-environment/types.js +1 -0
- package/build/tool.js +46 -0
- package/build/tools/add-cell-of-shape.js +42 -0
- package/build/tools/add-edge.js +33 -0
- package/build/tools/add-rectangle.js +41 -0
- package/build/tools/create-layer.js +8 -0
- package/build/tools/delete-cell-by-id.js +10 -0
- package/build/tools/edit-cell.js +28 -0
- package/build/tools/edit-edge.js +30 -0
- package/build/tools/export-diagram.js +96 -0
- package/build/tools/get-active-layer.js +5 -0
- package/build/tools/get-selected-cell.js +5 -0
- package/build/tools/get-shape-by-name.js +10 -0
- package/build/tools/get-shape-categories.js +5 -0
- package/build/tools/get-shapes-in-category.js +10 -0
- package/build/tools/import-diagram.js +22 -0
- package/build/tools/index.js +49 -0
- package/build/tools/list-layers.js +5 -0
- package/build/tools/list-paged-model.js +41 -0
- package/build/tools/move-cell-to-layer.js +11 -0
- package/build/tools/set-active-layer.js +8 -0
- package/build/tools/set-cell-data.js +14 -0
- package/build/tools/set-cell-parent.js +9 -0
- package/build/tools/set-cell-shape.js +13 -0
- package/build/tools/shared.js +7 -0
- package/build/tools/types.js +1 -0
- package/package.json +29 -22
package/README.md
CHANGED
|
@@ -1,518 +1,189 @@
|
|
|
1
|
-
|
|
2
1
|
# Draw.io MCP server
|
|
3
2
|
|
|
4
3
|
Let's do some Vibe Diagramming with the most wide-spread diagramming tool called Draw.io (Diagrams.net).
|
|
5
4
|
|
|
6
|
-
[](https://discord.gg/dM4PWdf42q)
|
|
5
|
+
[](https://discord.gg/dM4PWdf42q)
|
|
6
|
+
[](https://github.com/lgazo/drawio-mcp-server/actions/workflows/server-ci.yml)
|
|
7
|
+
[](https://mseep.ai/app/5fc2b7fe-8ceb-4683-97bd-6d31e07b5888)
|
|
8
|
+
[](https://npmjs.com/package/drawio-mcp-server)
|
|
7
9
|
|
|
8
|
-
##
|
|
10
|
+
## Key Highlights
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
- Import and export diagrams from/to XML, SVG (with embedded XML), or PNG (with embedded XML) 
|
|
13
|
+
- Edge geometry control with waypoints and automatic self-connector routing 
|
|
14
|
+
- Parent-child relationships for nested shapes and grouping 
|
|
15
|
+
- Unified Server and Extension in the same mono-repo 
|
|
16
|
+
- Built-in Draw.io editor - no browser extension required 
|
|
17
|
+
- MCP server that lets AI agents control Draw.io diagrams
|
|
18
|
+
- Programmatic diagram creation, inspection, and modification via MCP tools
|
|
19
|
+
- Layer management for complex diagrams
|
|
20
|
+
- Works with any MCP client (Claude Desktop, Claude Code, Zed, Codex, etc.)
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
- **Programmatic Diagram Control**: Create, modify, and manage diagram content through MCP commands
|
|
14
|
-
- **Intelligent Diagram Analysis**: Retrieve detailed information about diagrams and their components for processing by AI agents
|
|
15
|
-
- **Agentic System Development**: Build sophisticated AI workflows that incorporate visual modeling and diagram automation
|
|
22
|
+
## Introduction
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
- Generate architectural diagrams
|
|
19
|
-
- Visualize complex relationships
|
|
20
|
-
- Annotate technical documentation
|
|
21
|
-
- Create flowcharts and process maps programmatically
|
|
24
|
+
The Draw.io MCP server brings Draw.io diagramming capabilities to AI agents. It provides MCP tools that can create, read, update, and delete diagram elements - letting AI assistants build architectural diagrams, flowcharts, and visual documentation automatically.
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
Two ways to use:
|
|
27
|
+
1. **Built-in editor** - Server hosts Draw.io directly, accessible in your browser
|
|
28
|
+
2. **Browser extension** - Connect to Draw.io running in your browser via extension
|
|
24
29
|
|
|
25
30
|
## Requirements
|
|
26
31
|
|
|
27
|
-
To use the Draw.io MCP server, you'll need:
|
|
28
|
-
|
|
29
|
-
### Core Components
|
|
30
32
|
- **Node.js** (v20 or higher) - Runtime environment for the MCP server
|
|
31
|
-
- **
|
|
33
|
+
- **MCP client** - Claude Desktop, Claude Code, Zed, Codex, OpenCode, or any MCP-compatible host
|
|
32
34
|
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
- **LLM with Tools Support** - Any language model capable of handling MCP tool calls (e.g., GPT-4, Claude 3, etc.)
|
|
35
|
+
### For Built-in Editor
|
|
36
|
+
No additional requirements - runs out of the box with `--editor` flag.
|
|
36
37
|
|
|
37
|
-
###
|
|
38
|
-
- **
|
|
39
|
-
-
|
|
38
|
+
### For Browser Extension
|
|
39
|
+
- **Browser extension** - [drawio-mcp-extension](./packages/drawio-mcp-extension/README.md)
|
|
40
|
+
- Draw.io open in your browser
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
### Optional
|
|
43
|
+
- **pnpm** - Preferred package manager (npm works fine too)
|
|
42
44
|
|
|
43
|
-
##
|
|
45
|
+
## Quick Start
|
|
44
46
|
|
|
45
|
-
###
|
|
47
|
+
### 1. Configure your MCP host
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
Add the server to your MCP client configuration:
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
"mcpServers": {
|
|
53
|
-
"drawio": {
|
|
54
|
-
"command": "npx",
|
|
55
|
-
"args": ["-y", "drawio-mcp-server"]
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Custom port** (e.g., port 8080):
|
|
62
|
-
```json
|
|
63
|
-
{
|
|
64
|
-
"mcpServers": {
|
|
65
|
-
"drawio": {
|
|
66
|
-
"command": "npx",
|
|
67
|
-
"args": ["-y", "drawio-mcp-server", "--extension-port", "8080"]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**Note**: When using a custom port, ensure the browser extension is configured to connect to the same port.
|
|
74
|
-
|
|
75
|
-
### HTTP Transport Port
|
|
51
|
+
<details>
|
|
52
|
+
<summary>Claude Desktop</summary>
|
|
76
53
|
|
|
77
|
-
|
|
54
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
78
55
|
|
|
79
56
|
```json
|
|
80
57
|
{
|
|
81
58
|
"mcpServers": {
|
|
82
59
|
"drawio": {
|
|
83
60
|
"command": "npx",
|
|
84
|
-
"args": ["-y", "drawio-mcp-server", "--
|
|
61
|
+
"args": ["-y", "drawio-mcp-server", "--editor"]
|
|
85
62
|
}
|
|
86
63
|
}
|
|
87
64
|
}
|
|
88
65
|
```
|
|
89
|
-
|
|
90
|
-
### Transport Selection
|
|
91
|
-
|
|
92
|
-
By default only the stdio transport starts. Limit or combine transports with the `--transport` flag:
|
|
93
|
-
|
|
94
|
-
- `--transport stdio` – start only stdio (CLI-friendly)
|
|
95
|
-
- `--transport http` – start only the HTTP transport (for remote clients)
|
|
96
|
-
- `--transport stdio,http` – start both transports
|
|
97
|
-
|
|
98
|
-
### Running the streamable HTTP transport
|
|
99
|
-
|
|
100
|
-
Use the streamable HTTP transport when you need to reach the MCP server over the network (for example from a remote agent runtime). The Draw.io browser extension is still required, and you must opt in to the HTTP transport.
|
|
101
|
-
|
|
102
|
-
1. Start the server with HTTP enabled (optionally alongside stdio):
|
|
103
|
-
|
|
104
|
-
```sh
|
|
105
|
-
npx -y drawio-mcp-server --transport http --http-port 3000
|
|
106
|
-
# or both: npx -y drawio-mcp-server --transport stdio,http --http-port 4000
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
2. Verify the health endpoint:
|
|
110
|
-
|
|
111
|
-
```sh
|
|
112
|
-
curl http://localhost:3000/health
|
|
113
|
-
# { "status": "ok" }
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
3. Point your MCP client to the `/mcp` endpoint (`http://localhost:3000/mcp` by default). CORS is enabled for all origins so you can call it from a browser-based client as well.
|
|
117
|
-
|
|
118
|
-
## Installation
|
|
119
|
-
|
|
120
|
-
### Connecting with Claude Desktop
|
|
121
|
-
|
|
122
|
-
1. Install [Claude Desktop](https://claude.ai/download)
|
|
123
|
-
2. Open or create the configuration file:
|
|
124
|
-
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
125
|
-
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
126
|
-
|
|
127
|
-
3. Update it to include this server:
|
|
66
|
+
</details>
|
|
128
67
|
|
|
129
68
|
<details>
|
|
130
|
-
<summary>
|
|
69
|
+
<summary>Claude Code</summary>
|
|
131
70
|
|
|
132
|
-
```
|
|
133
|
-
{
|
|
134
|
-
"mcpServers":{
|
|
135
|
-
"drawio":{
|
|
136
|
-
"command":"npx",
|
|
137
|
-
"args":[
|
|
138
|
-
"-y",
|
|
139
|
-
"drawio-mcp-server"
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
71
|
+
```sh
|
|
72
|
+
claude mcp add-json drawio '{"type":"stdio","command":"npx","args":["-y","drawio-mcp-server","--editor"]}'
|
|
144
73
|
```
|
|
145
74
|
</details>
|
|
146
75
|
|
|
147
76
|
<details>
|
|
148
|
-
<summary>
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"mcpServers":{
|
|
153
|
-
"drawio":{
|
|
154
|
-
"command":"pnpm",
|
|
155
|
-
"args":[
|
|
156
|
-
"dlx",
|
|
157
|
-
"drawio-mcp-server"
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
</details>
|
|
77
|
+
<summary>Zed</summary>
|
|
164
78
|
|
|
165
|
-
|
|
79
|
+
Add to `~/.config/zed/settings.json`:
|
|
166
80
|
|
|
167
81
|
```json
|
|
168
82
|
{
|
|
169
|
-
"
|
|
83
|
+
"context_servers": {
|
|
170
84
|
"drawio": {
|
|
171
85
|
"command": "npx",
|
|
172
|
-
"args": ["-y", "drawio-mcp-server", "--
|
|
86
|
+
"args": ["-y", "drawio-mcp-server", "--editor"],
|
|
87
|
+
"env": {}
|
|
173
88
|
}
|
|
174
89
|
}
|
|
175
90
|
}
|
|
176
91
|
```
|
|
177
|
-
|
|
178
|
-
4. Restart Claude Desktop
|
|
179
|
-
|
|
180
|
-
### Connecting with oterm
|
|
181
|
-
|
|
182
|
-
This is an alternative MCP client in case you like terminal and you plan to connect to your own Ollama instance.
|
|
183
|
-
|
|
184
|
-
The configuration is usually in: ~/.local/share/oterm/config.json
|
|
92
|
+
</details>
|
|
185
93
|
|
|
186
94
|
<details>
|
|
187
|
-
<summary>
|
|
95
|
+
<summary>Codex</summary>
|
|
188
96
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"-y",
|
|
196
|
-
"drawio-mcp-server"
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
97
|
+
Edit `~/.codex/config.toml`:
|
|
98
|
+
|
|
99
|
+
```toml
|
|
100
|
+
[mcp_servers.drawio]
|
|
101
|
+
command = "npx"
|
|
102
|
+
args = ["-y", "drawio-mcp-server", "--editor"]
|
|
201
103
|
```
|
|
202
104
|
</details>
|
|
203
105
|
|
|
204
106
|
<details>
|
|
205
|
-
<summary>
|
|
206
|
-
|
|
207
|
-
```json
|
|
208
|
-
{
|
|
209
|
-
"mcpServers": {
|
|
210
|
-
"drawio": {
|
|
211
|
-
"command": "pnpm",
|
|
212
|
-
"args": [
|
|
213
|
-
"dlx",
|
|
214
|
-
"drawio-mcp-server"
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
</details>
|
|
107
|
+
<summary>OpenCode</summary>
|
|
221
108
|
|
|
222
|
-
|
|
109
|
+
Add to `opencode.json` in your project root or `~/.config/opencode/opencode.json`:
|
|
223
110
|
|
|
224
|
-
```
|
|
111
|
+
```jsonc
|
|
225
112
|
{
|
|
226
|
-
"
|
|
113
|
+
"$schema": "https://opencode.ai/config.json",
|
|
114
|
+
"mcp": {
|
|
227
115
|
"drawio": {
|
|
228
|
-
"
|
|
229
|
-
"
|
|
116
|
+
"type": "local",
|
|
117
|
+
"command": ["npx", "-y", "drawio-mcp-server", "--editor"],
|
|
118
|
+
"enabled": true
|
|
230
119
|
}
|
|
231
120
|
}
|
|
232
121
|
}
|
|
233
122
|
```
|
|
234
|
-
|
|
235
|
-
### Connect with Zed
|
|
236
|
-
|
|
237
|
-
1. Open the Zed Preview application.
|
|
238
|
-
1. Click the Assistant (✨) icon in the bottom right corner.
|
|
239
|
-
1. Click Settings in the top right panel of the Assistant.
|
|
240
|
-
1. In the Context Servers section, click + Add Context Server.
|
|
241
|
-
1. Configure with the following:
|
|
242
|
-
|
|
243
|
-
<details>
|
|
244
|
-
<summary>Using <code>npm</code></summary>
|
|
245
|
-
|
|
246
|
-
```json
|
|
247
|
-
{
|
|
248
|
-
/// The name of your MCP server
|
|
249
|
-
"drawio": {
|
|
250
|
-
/// The path to the executable
|
|
251
|
-
"command": "npx",
|
|
252
|
-
/// The arguments to pass to the executable
|
|
253
|
-
"args": [
|
|
254
|
-
"-y",
|
|
255
|
-
"drawio-mcp-server"
|
|
256
|
-
],
|
|
257
|
-
/// The environment variables to set for the executable
|
|
258
|
-
"env": {}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
123
|
</details>
|
|
263
124
|
|
|
264
|
-
|
|
265
|
-
<summary>Using <code>pnpm</code></summary>
|
|
125
|
+
For other MCP clients and detailed configuration (including pnpm options), see [Configuration](./CONFIG.md).
|
|
266
126
|
|
|
267
|
-
|
|
268
|
-
{
|
|
269
|
-
/// The name of your MCP server
|
|
270
|
-
"drawio": {
|
|
271
|
-
/// The path to the executable
|
|
272
|
-
"command": "pnpm",
|
|
273
|
-
/// The arguments to pass to the executable
|
|
274
|
-
"args": [
|
|
275
|
-
"dlx",
|
|
276
|
-
"drawio-mcp-server"
|
|
277
|
-
],
|
|
278
|
-
/// The environment variables to set for the executable
|
|
279
|
-
"env": {}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
</details>
|
|
127
|
+
### 2. Open the editor
|
|
284
128
|
|
|
285
|
-
|
|
129
|
+
After restarting your MCP host, open: **http://localhost:3000/**
|
|
286
130
|
|
|
287
|
-
|
|
288
|
-
{
|
|
289
|
-
"drawio": {
|
|
290
|
-
"command": "npx",
|
|
291
|
-
"args": [
|
|
292
|
-
"-y",
|
|
293
|
-
"drawio-mcp-server",
|
|
294
|
-
"--extension-port",
|
|
295
|
-
"8080"
|
|
296
|
-
],
|
|
297
|
-
"env": {}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
```
|
|
131
|
+
### 3. Start diagramming
|
|
301
132
|
|
|
302
|
-
|
|
133
|
+
Example prompts you can try:
|
|
303
134
|
|
|
304
|
-
|
|
135
|
+
> "Create an event-driven architecture diagram showing a message queue with producers, consumers, and three backend services"
|
|
305
136
|
|
|
306
|
-
|
|
307
|
-
<summary>Using <code>npm</code></summary>
|
|
137
|
+
> "Draw a CRUD API diagram with a database, API gateway, and four microservices with their endpoints"
|
|
308
138
|
|
|
309
|
-
|
|
310
|
-
[mcp_servers.drawio]
|
|
311
|
-
command = "npx"
|
|
312
|
-
args = [
|
|
313
|
-
"-y",
|
|
314
|
-
"drawio-mcp-server"
|
|
315
|
-
]
|
|
316
|
-
```
|
|
317
|
-
</details>
|
|
139
|
+
> "Add a new layer called 'Background' and move all decorative elements to it, then create a new layer for annotations"
|
|
318
140
|
|
|
319
|
-
|
|
320
|
-
<summary>Using <code>pnpm</code></summary>
|
|
141
|
+
Your AI assistant can now control the diagram using MCP tools.
|
|
321
142
|
|
|
322
|
-
|
|
323
|
-
[mcp_servers.drawio]
|
|
324
|
-
command = "pnpm"
|
|
325
|
-
args = [
|
|
326
|
-
"dlx",
|
|
327
|
-
"drawio-mcp-server"
|
|
328
|
-
]
|
|
329
|
-
```
|
|
330
|
-
</details>
|
|
331
|
-
|
|
332
|
-
To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to the args array:
|
|
143
|
+
## Features
|
|
333
144
|
|
|
334
|
-
|
|
335
|
-
<summary>Using <code>npm</code></summary>
|
|
145
|
+
The server provides MCP tools for:
|
|
336
146
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
args = [
|
|
341
|
-
"-y",
|
|
342
|
-
"drawio-mcp-server",
|
|
343
|
-
"--extension-port",
|
|
344
|
-
"8080"
|
|
345
|
-
]
|
|
346
|
-
```
|
|
347
|
-
</details>
|
|
147
|
+
- **Diagram inspection** - read shapes, layers, and cell properties
|
|
148
|
+
- **Diagram modification** - add/edit/delete shapes, edges, and labels
|
|
149
|
+
- **Layer management** - create, switch, and organize layers
|
|
348
150
|
|
|
349
|
-
|
|
151
|
+
See [Tools Reference](./TOOLS.md) for the complete list of available tools.
|
|
350
152
|
|
|
351
|
-
|
|
352
|
-
[mcp_servers.drawio]
|
|
353
|
-
url = "http://localhost:3000/mcp"
|
|
354
|
-
```
|
|
153
|
+
## Installation
|
|
355
154
|
|
|
155
|
+
The server runs as part of your MCP host. Detailed configuration for all supported clients (Claude Desktop, Claude Code, Zed, Codex, oterm) including npm and pnpm options is available in [Configuration](./CONFIG.md).
|
|
356
156
|
|
|
357
|
-
|
|
157
|
+
## Alternative: Browser Extension
|
|
358
158
|
|
|
359
|
-
|
|
159
|
+
Instead of the built-in editor, you can use the [browser extension](./packages/drawio-mcp-extension/README.md) to connect to Draw.io running in your browser. This works with or without the `--editor` flag.
|
|
360
160
|
|
|
361
161
|
1. Open [Draw.io in your browser](https://app.diagrams.net/)
|
|
362
|
-
2. Install the Draw.io MCP Browser Extension
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
<source srcset="https://i.imgur.com/XBIE9pk.png" media="(prefers-color-scheme: dark)" />
|
|
367
|
-
<img height="58" src="https://i.imgur.com/oGxig2F.png" alt="Chrome Web Store" /></picture
|
|
368
|
-
></a>
|
|
369
|
-
<a href="https://addons.mozilla.org/en-US/firefox/addon/drawio-mcp-extension/">
|
|
370
|
-
<picture>
|
|
371
|
-
<source srcset="https://i.imgur.com/ZluoP7T.png" media="(prefers-color-scheme: dark)" />
|
|
372
|
-
<img height="58" src="https://i.imgur.com/4PobQqE.png" alt="Firefox add-ons" /></picture
|
|
373
|
-
></a>
|
|
374
|
-
</p>
|
|
375
|
-
3. Ensure it is connected, the Extension icon should indicate green signal overlay <img alt="Extension connected" src="https://raw.githubusercontent.com/lgazo/drawio-mcp-extension/refs/heads/main/public/icon/logo_connected_32.png" />
|
|
376
|
-
|
|
377
|
-
**Important**: If you configured the MCP server to use a custom port (not 3333), you must configure the browser extension to use the same port. See the extension documentation for port configuration instructions.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
## Sponsoring
|
|
381
|
-
|
|
382
|
-
If you enjoy the project or find it useful, consider supporting its continued development.
|
|
162
|
+
2. Install the Draw.io MCP Browser Extension:
|
|
163
|
+
- [Chrome Web Store](https://chrome.google.com/webstore/detail/drawio-mcp-extension/okdbbjbbccdhhfaefmcmekalmmdjjide)
|
|
164
|
+
- [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/drawio-mcp-extension/)
|
|
165
|
+
3. Ensure the extension is connected (green signal overlay on icon)
|
|
383
166
|
|
|
167
|
+
Configuration without `--editor`:
|
|
384
168
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
```
|
|
395
|
-
ladislav@blink.sv
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"mcpServers": {
|
|
172
|
+
"drawio": {
|
|
173
|
+
"command": "npx",
|
|
174
|
+
"args": ["-y", "drawio-mcp-server"]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
396
178
|
```
|
|
397
179
|
|
|
398
|
-
|
|
399
|
-
<a href="https://liberapay.com/ladislav/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
|
|
400
|
-
</div>
|
|
180
|
+
See the [extension documentation](./packages/drawio-mcp-extension/README.md) for more details.
|
|
401
181
|
|
|
402
|
-
##
|
|
182
|
+
## Related Resources
|
|
403
183
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
### Diagram Inspection Tools
|
|
407
|
-
- **`get-selected-cell`**
|
|
408
|
-
Retrieves the currently selected cell in Draw.io with all its attributes
|
|
409
|
-
*Returns*: JSON object containing cell properties (ID, geometry, style, value, etc.)
|
|
410
|
-
|
|
411
|
-
- **`get-shape-categories`**
|
|
412
|
-
Retrieves available shape categories from the diagram's library
|
|
413
|
-
*Returns*: Array of category objects with their IDs and names
|
|
414
|
-
|
|
415
|
-
- **`get-shapes-in-category`**
|
|
416
|
-
Retrieves all shapes in a specified category from the diagram's library
|
|
417
|
-
*Parameters*:
|
|
418
|
-
- `category_id`: Identifier of the category to retrieve shapes from
|
|
419
|
-
*Returns*: Array of shape objects with their properties and styles
|
|
420
|
-
|
|
421
|
-
- **`get-shape-by-name`**
|
|
422
|
-
Retrieves a specific shape by its name from all available shapes
|
|
423
|
-
*Parameters*:
|
|
424
|
-
- `shape_name`: Name of the shape to retrieve
|
|
425
|
-
*Returns*: Shape object including its category and style information
|
|
426
|
-
|
|
427
|
-
- **`list-paged-model`**
|
|
428
|
-
Retrieves a paginated view of all cells (vertices and edges) in the current Draw.io diagram. This tool provides access to the complete model data with essential fields only, sanitized to remove circular dependencies and excessive data. It allows to filter based on multiple criteria and attribute boolean logic. Useful for programmatic inspection of diagram structure without overwhelming response sizes.
|
|
429
|
-
|
|
430
|
-
### Diagram Modification Tools
|
|
431
|
-
- **`add-rectangle`**
|
|
432
|
-
Creates a new rectangle shape on the active Draw.io page with customizable properties:
|
|
433
|
-
- Position (`x`, `y` coordinates)
|
|
434
|
-
- Dimensions (`width`, `height`)
|
|
435
|
-
- Text content
|
|
436
|
-
- Visual style (fill color, stroke, etc. using Draw.io style syntax)
|
|
437
|
-
|
|
438
|
-
- **`add-edge`**
|
|
439
|
-
Creates a connection between two cells (vertexes)
|
|
440
|
-
*Parameters*:
|
|
441
|
-
- `source_id`: ID of the source cell
|
|
442
|
-
- `target_id`: ID of the target cell
|
|
443
|
-
- `text`: Optional text label for the edge
|
|
444
|
-
- `style`: Optional style properties for the edge
|
|
445
|
-
|
|
446
|
-
- **`delete-cell-by-id`**
|
|
447
|
-
Removes a specified cell from the diagram
|
|
448
|
-
*Parameters*:
|
|
449
|
-
- `cell_id`: ID of the cell to delete
|
|
450
|
-
|
|
451
|
-
- **`add-cell-of-shape`**
|
|
452
|
-
Adds a new cell of a specific shape type from the diagram's library
|
|
453
|
-
*Parameters*:
|
|
454
|
-
- `shape_name`: Name of the shape to create
|
|
455
|
-
- `x`, `y`: Position coordinates (optional)
|
|
456
|
-
- `width`, `height`: Dimensions (optional)
|
|
457
|
-
- `text`: Optional text content
|
|
458
|
-
- `style`: Optional additional style properties
|
|
459
|
-
|
|
460
|
-
- **`set-cell-shape`**
|
|
461
|
-
Applies a library shape's style to an existing cell
|
|
462
|
-
*Parameters*:
|
|
463
|
-
- `cell_id`: ID of the cell whose appearance should change
|
|
464
|
-
- `shape_name`: Name of the library shape whose style should be applied
|
|
465
|
-
|
|
466
|
-
- **`set-cell-data`**
|
|
467
|
-
Stores or updates a custom attribute on a cell
|
|
468
|
-
*Parameters*:
|
|
469
|
-
- `cell_id`: ID of the cell to update
|
|
470
|
-
- `key`: Attribute name to set
|
|
471
|
-
- `value`: Attribute value (stored as a string internally)
|
|
472
|
-
|
|
473
|
-
- **`edit-cell`**
|
|
474
|
-
Updates an existing vertex/shape cell in place by ID
|
|
475
|
-
*Parameters*:
|
|
476
|
-
- `cell_id`: ID of the cell whose properties should change (required)
|
|
477
|
-
- `text`, `x`, `y`, `width`, `height`, `style`: Optional fields to update on the cell; omitted properties stay as-is
|
|
478
|
-
|
|
479
|
-
- **`edit-edge`**
|
|
480
|
-
Updates an existing edge connection between cells by ID
|
|
481
|
-
*Parameters*:
|
|
482
|
-
- `cell_id`: ID of the edge cell to update (required)
|
|
483
|
-
- `text`: Optional edge label text
|
|
484
|
-
- `source_id`, `target_id`: Optional IDs of new source/target cells
|
|
485
|
-
- `style`: Optional replacement style string
|
|
486
|
-
|
|
487
|
-
### Layer Management Tools
|
|
488
|
-
- **`list-layers`**
|
|
489
|
-
Lists all available layers in the diagram with their IDs and names
|
|
490
|
-
*Returns*: Array of layer objects with properties (ID, name, visibility, locked status)
|
|
491
|
-
|
|
492
|
-
- **`set-active-layer`**
|
|
493
|
-
Sets the active layer for creating new elements. All subsequent element creation will happen in this layer
|
|
494
|
-
*Parameters*:
|
|
495
|
-
- `layer_id`: ID of the layer to set as active
|
|
496
|
-
*Returns*: Information about the newly active layer
|
|
497
|
-
|
|
498
|
-
- **`move-cell-to-layer`**
|
|
499
|
-
Moves a cell from its current layer to a target layer
|
|
500
|
-
*Parameters*:
|
|
501
|
-
- `cell_id`: ID of the cell to move
|
|
502
|
-
- `target_layer_id`: ID of the target layer where the cell will be moved
|
|
503
|
-
*Returns*: Confirmation of the move operation
|
|
504
|
-
|
|
505
|
-
- **`get-active-layer`**
|
|
506
|
-
Gets the currently active layer information
|
|
507
|
-
*Returns*: Information about the current active layer (ID and name)
|
|
508
|
-
|
|
509
|
-
- **`create-layer`**
|
|
510
|
-
Creates a new layer in the diagram
|
|
511
|
-
*Parameters*:
|
|
512
|
-
- `name`: Name for the new layer
|
|
513
|
-
*Returns*: Information about the newly created layer
|
|
184
|
+
[Configuration](./CONFIG.md) - CLI flags and advanced options
|
|
514
185
|
|
|
515
|
-
|
|
186
|
+
[Tools Reference](./TOOLS.md) - Complete MCP tools documentation
|
|
516
187
|
|
|
517
188
|
[Troubleshooting](./TROUBLESHOOTING.md)
|
|
518
189
|
|