drawio-mcp-server 1.5.0 → 1.7.0
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/LICENSE.md +21 -0
- package/README.md +60 -26
- package/build/index.js +35 -3
- package/package.json +22 -16
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ladislav Gazo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
|
|
1
2
|
# Draw.io MCP server
|
|
2
3
|
|
|
3
4
|
Let's do some Vibe Diagramming with the most wide-spread diagramming tool called Draw.io (Diagrams.net).
|
|
4
5
|
|
|
5
|
-
[](https://discord.gg/dM4PWdf42q) [](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml)
|
|
6
|
+
[](https://discord.gg/dM4PWdf42q) [](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml) [](https://mseep.ai/app/5fc2b7fe-8ceb-4683-97bd-6d31e07b5888)
|
|
6
7
|
|
|
7
8
|
## Introduction
|
|
8
9
|
|
|
@@ -246,14 +247,15 @@ To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to
|
|
|
246
247
|
{
|
|
247
248
|
/// The name of your MCP server
|
|
248
249
|
"drawio": {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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": {}
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
```
|
|
@@ -266,14 +268,15 @@ To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to
|
|
|
266
268
|
{
|
|
267
269
|
/// The name of your MCP server
|
|
268
270
|
"drawio": {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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": {}
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
282
|
```
|
|
@@ -283,16 +286,15 @@ To use a custom extension port (e.g., 8080), add `"--extension-port", "8080"` to
|
|
|
283
286
|
|
|
284
287
|
```json
|
|
285
288
|
{
|
|
286
|
-
/// The name of your MCP server
|
|
287
289
|
"drawio": {
|
|
288
|
-
"command":
|
|
289
|
-
|
|
290
|
-
"
|
|
291
|
-
|
|
292
|
-
"
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
290
|
+
"command": "npx",
|
|
291
|
+
"args": [
|
|
292
|
+
"-y",
|
|
293
|
+
"drawio-mcp-server",
|
|
294
|
+
"--extension-port",
|
|
295
|
+
"8080"
|
|
296
|
+
],
|
|
297
|
+
"env": {}
|
|
296
298
|
}
|
|
297
299
|
}
|
|
298
300
|
```
|
|
@@ -482,6 +484,34 @@ The Draw.io MCP server provides the following tools for programmatic diagram int
|
|
|
482
484
|
- `source_id`, `target_id`: Optional IDs of new source/target cells
|
|
483
485
|
- `style`: Optional replacement style string
|
|
484
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
|
|
514
|
+
|
|
485
515
|
## Related Resources
|
|
486
516
|
|
|
487
517
|
[Troubleshooting](./TROUBLESHOOTING.md)
|
|
@@ -503,3 +533,7 @@ The Draw.io MCP server provides the following tools for programmatic diagram int
|
|
|
503
533
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date" />
|
|
504
534
|
</picture>
|
|
505
535
|
</a>
|
|
536
|
+
|
|
537
|
+
## Assessments
|
|
538
|
+
|
|
539
|
+
[](https://mseep.ai/app/lgazo-drawio-mcp-server)
|
package/build/index.js
CHANGED
|
@@ -16,12 +16,13 @@ import { default_tool } from "./tool.js";
|
|
|
16
16
|
import { nanoid_id_generator } from "./nanoid_id_generator.js";
|
|
17
17
|
import { create_logger as create_console_logger } from "./mcp_console_logger.js";
|
|
18
18
|
import { create_logger as create_server_logger, validLogLevels, } from "./mcp_server_logger.js";
|
|
19
|
+
const VERSION = "1.7.0";
|
|
19
20
|
/**
|
|
20
21
|
* Display help message and exit
|
|
21
22
|
*/
|
|
22
23
|
function showHelp() {
|
|
23
24
|
console.log(`
|
|
24
|
-
Draw.io MCP Server
|
|
25
|
+
Draw.io MCP Server (${VERSION})
|
|
25
26
|
|
|
26
27
|
Usage: drawio-mcp-server [options]
|
|
27
28
|
|
|
@@ -66,7 +67,7 @@ const bus_to_ws_forwarder_listener = (event) => {
|
|
|
66
67
|
};
|
|
67
68
|
emitter.on(bus_request_stream, bus_to_ws_forwarder_listener);
|
|
68
69
|
async function start_websocket_server(extensionPort) {
|
|
69
|
-
log.debug(`Draw.io MCP Server starting (WebSocket extension port: ${extensionPort})`);
|
|
70
|
+
log.debug(`Draw.io MCP Server (${VERSION}) starting (WebSocket extension port: ${extensionPort})`);
|
|
70
71
|
const isPortAvailable = await checkPortAvailable(extensionPort);
|
|
71
72
|
if (!isPortAvailable) {
|
|
72
73
|
console.error(`[start_websocket_server] Error: Port ${extensionPort} is already in use. Please stop the process using this port and try again.`);
|
|
@@ -122,7 +123,7 @@ if (logger_type === "mcp_server") {
|
|
|
122
123
|
// Create server instance
|
|
123
124
|
const server = new McpServer({
|
|
124
125
|
name: "drawio-mcp-server",
|
|
125
|
-
version:
|
|
126
|
+
version: VERSION,
|
|
126
127
|
}, {
|
|
127
128
|
capabilities,
|
|
128
129
|
});
|
|
@@ -332,12 +333,43 @@ server.tool(TOOL_list_paged_model, "Retrieves a paginated view of all cells (ver
|
|
|
332
333
|
.enum(["edge", "vertex", "object", "layer", "group"])
|
|
333
334
|
.optional()
|
|
334
335
|
.describe("Filter by cell type: 'edge' for connection lines, 'vertex' for vertices/shapes, 'object' for any cell type, 'layer' for layer cells, 'group' for grouped cells"),
|
|
336
|
+
parent_ids: z
|
|
337
|
+
.array(z.string())
|
|
338
|
+
.optional()
|
|
339
|
+
.describe("Filter cells to only those whose parent is one of the specified parent IDs."),
|
|
340
|
+
layer_ids: z
|
|
341
|
+
.array(z.string())
|
|
342
|
+
.optional()
|
|
343
|
+
.describe("Filter cells to only those whose parent is one of the specified layer IDs. Alias for parent_ids."),
|
|
344
|
+
ids: z
|
|
345
|
+
.array(z.string())
|
|
346
|
+
.optional()
|
|
347
|
+
.describe("Filter cells to only those whose ID is one of the specified IDs."),
|
|
335
348
|
attributes: Attributes.optional().describe('Boolean logic array expressions for filtering cell attributes. Format: ["and" | "or", ...expressions] or ["equal", key, value]. Matches against cell attributes and parsed style properties.'),
|
|
336
349
|
})
|
|
337
350
|
.optional()
|
|
338
351
|
.describe("Optional filter criteria to apply to cells before pagination")
|
|
339
352
|
.default({}),
|
|
340
353
|
}, default_tool(TOOL_list_paged_model, context));
|
|
354
|
+
const TOOL_list_layers = "list-layers";
|
|
355
|
+
server.tool(TOOL_list_layers, "Lists all available layers in the diagram with their IDs and names.", {}, default_tool(TOOL_list_layers, context));
|
|
356
|
+
const TOOL_set_active_layer = "set-active-layer";
|
|
357
|
+
server.tool(TOOL_set_active_layer, "Sets the active layer for creating new elements. All subsequent element creation will happen in this layer.", {
|
|
358
|
+
layer_id: z.string().describe("ID of the layer to set as active"),
|
|
359
|
+
}, default_tool(TOOL_set_active_layer, context));
|
|
360
|
+
const TOOL_move_cell_to_layer = "move-cell-to-layer";
|
|
361
|
+
server.tool(TOOL_move_cell_to_layer, "Moves a cell from its current layer to a target layer.", {
|
|
362
|
+
cell_id: z.string().describe("ID of the cell to move"),
|
|
363
|
+
target_layer_id: z
|
|
364
|
+
.string()
|
|
365
|
+
.describe("ID of the target layer where the cell will be moved"),
|
|
366
|
+
}, default_tool(TOOL_move_cell_to_layer, context));
|
|
367
|
+
const TOOL_get_active_layer = "get-active-layer";
|
|
368
|
+
server.tool(TOOL_get_active_layer, "Gets the currently active layer information.", {}, default_tool(TOOL_get_active_layer, context));
|
|
369
|
+
const TOOL_create_layer = "create-layer";
|
|
370
|
+
server.tool(TOOL_create_layer, "Creates a new layer in the diagram.", {
|
|
371
|
+
name: z.string().describe("Name for the new layer"),
|
|
372
|
+
}, default_tool(TOOL_create_layer, context));
|
|
341
373
|
async function start_stdio_transport() {
|
|
342
374
|
const transport = new StdioServerTransport();
|
|
343
375
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drawio-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Provides Draw.io services to MCP Clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"drawio-mcp-server": "./build/index.js"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"ci": "pnpm install --frozen-lockfile",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"inspect": "HOST=0.0.0.0 pnpx @modelcontextprotocol/inspector --config ./inspector.json --server drawio",
|
|
15
|
+
"prepublishOnly": "pnpm run build",
|
|
16
|
+
"lint": "tsc --noEmit",
|
|
17
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
18
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
19
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
20
|
+
"test:watch": "jest --watch",
|
|
21
|
+
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
22
|
+
"clean": "rimraf build coverage .eslintcache",
|
|
23
|
+
"prebuild": "pnpm run clean"
|
|
24
|
+
},
|
|
10
25
|
"engines": {
|
|
11
26
|
"node": ">=20.0.0"
|
|
12
27
|
},
|
|
@@ -26,6 +41,11 @@
|
|
|
26
41
|
],
|
|
27
42
|
"author": "Ladislav Gazo",
|
|
28
43
|
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/lgazo/drawio-mcp-server"
|
|
47
|
+
},
|
|
48
|
+
"packageManager": "pnpm@10.8.1",
|
|
29
49
|
"dependencies": {
|
|
30
50
|
"@hono/node-server": "1.19.7",
|
|
31
51
|
"@modelcontextprotocol/sdk": "1.25.1",
|
|
@@ -46,19 +66,5 @@
|
|
|
46
66
|
"rimraf": "6.1.2",
|
|
47
67
|
"ts-jest": "29.4.6",
|
|
48
68
|
"typescript": "5.9.3"
|
|
49
|
-
},
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "tsc",
|
|
52
|
-
"ci": "pnpm install --frozen-lockfile",
|
|
53
|
-
"dev": "tsc --watch",
|
|
54
|
-
"inspect": "HOST=0.0.0.0 pnpx @modelcontextprotocol/inspector --config ./inspector.json --server drawio",
|
|
55
|
-
"lint": "tsc --noEmit",
|
|
56
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
57
|
-
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
58
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
59
|
-
"test:watch": "jest --watch",
|
|
60
|
-
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
61
|
-
"clean": "rimraf build coverage .eslintcache",
|
|
62
|
-
"prebuild": "pnpm run clean"
|
|
63
69
|
}
|
|
64
|
-
}
|
|
70
|
+
}
|