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.
Files changed (52) hide show
  1. package/README.md +96 -425
  2. package/build/assets/downloader.js +96 -0
  3. package/build/assets/index.js +2 -0
  4. package/build/assets/manager.js +31 -0
  5. package/build/config.js +45 -0
  6. package/build/config.test.js +54 -0
  7. package/build/emitter_bus.js +2 -3
  8. package/build/index.js +305 -337
  9. package/build/plugin/mcp-plugin.js +2618 -0
  10. package/build/prefetch-assets.js +11 -0
  11. package/build/real-environment/add-cell-of-shape.test.js +51 -0
  12. package/build/real-environment/add-edge.test.js +86 -0
  13. package/build/real-environment/assertions.js +18 -0
  14. package/build/real-environment/delete-cell-by-id.test.js +45 -0
  15. package/build/real-environment/edge-editing.test.js +70 -0
  16. package/build/real-environment/edit-cell.test.js +64 -0
  17. package/build/real-environment/harness.js +175 -0
  18. package/build/real-environment/import-export.test.js +82 -0
  19. package/build/real-environment/layers-and-selection.test.js +70 -0
  20. package/build/real-environment/logger.js +25 -0
  21. package/build/real-environment/screenshot.js +46 -0
  22. package/build/real-environment/set-cell-parent.test.js +64 -0
  23. package/build/real-environment/shapes.test.js +153 -0
  24. package/build/real-environment/test-helpers.js +10 -0
  25. package/build/real-environment/tools.js +22 -0
  26. package/build/real-environment/types.js +1 -0
  27. package/build/tool.js +46 -0
  28. package/build/tools/add-cell-of-shape.js +42 -0
  29. package/build/tools/add-edge.js +33 -0
  30. package/build/tools/add-rectangle.js +41 -0
  31. package/build/tools/create-layer.js +8 -0
  32. package/build/tools/delete-cell-by-id.js +10 -0
  33. package/build/tools/edit-cell.js +28 -0
  34. package/build/tools/edit-edge.js +30 -0
  35. package/build/tools/export-diagram.js +96 -0
  36. package/build/tools/get-active-layer.js +5 -0
  37. package/build/tools/get-selected-cell.js +5 -0
  38. package/build/tools/get-shape-by-name.js +10 -0
  39. package/build/tools/get-shape-categories.js +5 -0
  40. package/build/tools/get-shapes-in-category.js +10 -0
  41. package/build/tools/import-diagram.js +22 -0
  42. package/build/tools/index.js +49 -0
  43. package/build/tools/list-layers.js +5 -0
  44. package/build/tools/list-paged-model.js +41 -0
  45. package/build/tools/move-cell-to-layer.js +11 -0
  46. package/build/tools/set-active-layer.js +8 -0
  47. package/build/tools/set-cell-data.js +14 -0
  48. package/build/tools/set-cell-parent.js +9 -0
  49. package/build/tools/set-cell-shape.js +13 -0
  50. package/build/tools/shared.js +7 -0
  51. package/build/tools/types.js +1 -0
  52. 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
- [![Discord channel](https://shields.io/static/v1?logo=discord&message=draw.io%20mcp&label=chat&color=5865F2&logoColor=white)](https://discord.gg/dM4PWdf42q) [![Build project](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml) [![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/5fc2b7fe-8ceb-4683-97bd-6d31e07b5888)
5
+ [![Discord channel](https://shields.io/static/v1?logo=discord&message=draw.io%20mcp&label=chat&color=5865F2&logoColor=white)](https://discord.gg/dM4PWdf42q)
6
+ [![Build project](https://github.com/lgazo/drawio-mcp-server/actions/workflows/server-ci.yml/badge.svg)](https://github.com/lgazo/drawio-mcp-server/actions/workflows/server-ci.yml)
7
+ [![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/5fc2b7fe-8ceb-4683-97bd-6d31e07b5888)
8
+ [![Version](https://img.shields.io/npm/v/drawio-mcp-server)](https://npmjs.com/package/drawio-mcp-server)
7
9
 
8
- ## Introduction
10
+ ## Key Highlights
9
11
 
10
- The Draw.io MCP server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) implementation that brings powerful diagramming capabilities to AI agentic systems. This integration enables:
12
+ - Import and export diagrams from/to XML, SVG (with embedded XML), or PNG (with embedded XML) ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
13
+ - Edge geometry control with waypoints and automatic self-connector routing ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
14
+ - Parent-child relationships for nested shapes and grouping ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
15
+ - Unified Server and Extension in the same mono-repo ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
16
+ - Built-in Draw.io editor - no browser extension required ![v1.8.0](https://img.shields.io/badge/v1.8.0-blue)
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
- - **Seamless Draw.io Integration**: Connect your MCP-powered applications with Draw.io's rich diagramming functionality
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
- As an MCP-compliant tool, it follows the standard protocol for tool integration, making it compatible with any MCP client. This implementation is particularly valuable for creating AI systems that need to:
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
- The tool supports bidirectional communication, allowing both control of Draw.io instances and extraction of diagram information for further processing by AI agents in your MCP ecosystem.
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
- - **Draw.io MCP Browser Extension** - Enables communication between Draw.io and the MCP server
33
+ - **MCP client** - Claude Desktop, Claude Code, Zed, Codex, OpenCode, or any MCP-compatible host
32
34
 
33
- ### MCP Ecosystem
34
- - **MCP Client** (e.g., [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector)) - For testing and debugging the integration
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
- ### Optional for Development
38
- - **pnpm** - Preferred package manager
39
- - **Chrome DevTools** - For debugging when using `--inspect` flag
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
- Note: The Draw.io desktop app or web version must be accessible to the system where the MCP server runs.
42
+ ### Optional
43
+ - **pnpm** - Preferred package manager (npm works fine too)
42
44
 
43
- ## Configuration
45
+ ## Quick Start
44
46
 
45
- ### WebSocket Port
47
+ ### 1. Configure your MCP host
46
48
 
47
- The server listens on port 3333 by default for WebSocket connections from the browser extension. You can customize this port using the `--extension-port` or `-p` flag.
49
+ Add the server to your MCP client configuration:
48
50
 
49
- **Default behavior** (port 3333):
50
- ```json
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
- The server can expose a streamable HTTP MCP transport on port 3000. Change this using the `--http-port` flag:
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", "--transport", "http", "--http-port", "4000"]
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>Using <code>npm</code></summary>
69
+ <summary>Claude Code</summary>
131
70
 
132
- ```json
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>Using <code>pnpm</code></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
- To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to the args array:
79
+ Add to `~/.config/zed/settings.json`:
166
80
 
167
81
  ```json
168
82
  {
169
- "mcpServers": {
83
+ "context_servers": {
170
84
  "drawio": {
171
85
  "command": "npx",
172
- "args": ["-y", "drawio-mcp-server", "--extension-port", "8080"]
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>Using <code>npm</code></summary>
95
+ <summary>Codex</summary>
188
96
 
189
- ```json
190
- {
191
- "mcpServers": {
192
- "drawio": {
193
- "command": "npx",
194
- "args": [
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>Using <code>pnpm</code></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
- To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to the args array:
109
+ Add to `opencode.json` in your project root or `~/.config/opencode/opencode.json`:
223
110
 
224
- ```json
111
+ ```jsonc
225
112
  {
226
- "mcpServers": {
113
+ "$schema": "https://opencode.ai/config.json",
114
+ "mcp": {
227
115
  "drawio": {
228
- "command": "npx",
229
- "args": ["-y", "drawio-mcp-server", "--extension-port", "8080"]
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
- <details>
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
- ```json
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
- To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to the args array:
129
+ After restarting your MCP host, open: **http://localhost:3000/**
286
130
 
287
- ```json
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
- ### Connecting with Codex
133
+ Example prompts you can try:
303
134
 
304
- Edit the configuration usually located in: ~/.codex/config.toml
135
+ > "Create an event-driven architecture diagram showing a message queue with producers, consumers, and three backend services"
305
136
 
306
- <details>
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
- ```toml
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
- <details>
320
- <summary>Using <code>pnpm</code></summary>
141
+ Your AI assistant can now control the diagram using MCP tools.
321
142
 
322
- ```toml
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
- <details>
335
- <summary>Using <code>npm</code></summary>
145
+ The server provides MCP tools for:
336
146
 
337
- ```toml
338
- [mcp_servers.drawio]
339
- command = "npx"
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
- To connect to a locally running MCP with Streamable HTTP transport:
151
+ See [Tools Reference](./TOOLS.md) for the complete list of available tools.
350
152
 
351
- ```toml
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
- ### Browser Extension Setup
157
+ ## Alternative: Browser Extension
358
158
 
359
- In order to control the Draw.io diagram, you need to install dedicated Browser Extension.
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 from a web store or [use other means](https://github.com/lgazo/drawio-mcp-extension)
363
- <p>
364
- <a href="https://chrome.google.com/webstore/detail/drawio-mcp-extension/okdbbjbbccdhhfaefmcmekalmmdjjide">
365
- <picture>
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
- lightning invoice:
386
-
387
- ![lightning invoice](./lightning_qr.png)
388
-
389
- ```
390
- lnbc1p5f8wvnpp5kk0qt60waplesw3sjxu7tcqwmdp6ysq570dc4ln52krd3u5nzq6sdp82pshjgr5dusyymrfde4jq4mpd3kx2apq24ek2uscqzpuxqr8pqsp5gvr72xcs883qt4hea6v3u7803stcwfnk5c9w0ykqr9a40qqwnpys9qxpqysgqfzlhm0cz5vqy7wqt7rwpmkacukrk59k89ltd5n642wzru2jn88tyd78gr4y3j6u64k2u4sd4qgavlsnccl986velrg3x0pe95sx7p4sqtatttp
391
- ```
392
-
393
- lightning address:
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
- <div align="center">
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
- ## Features
182
+ ## Related Resources
403
183
 
404
- The Draw.io MCP server provides the following tools for programmatic diagram interaction:
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
- ## Related Resources
186
+ [Tools Reference](./TOOLS.md) - Complete MCP tools documentation
516
187
 
517
188
  [Troubleshooting](./TROUBLESHOOTING.md)
518
189