drawio-mcp-server 1.0.3 → 1.1.1
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 +83 -0
- package/build/index.js +29 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -130,6 +130,54 @@ The configuration is usually in: ~/.local/share/oterm/config.json
|
|
|
130
130
|
```
|
|
131
131
|
</details>
|
|
132
132
|
|
|
133
|
+
### Connect with Zed
|
|
134
|
+
|
|
135
|
+
1. Open the Zed Preview application.
|
|
136
|
+
1. Click the Assistant (✨) icon in the bottom right corner.
|
|
137
|
+
1. Click Settings in the top right panel of the Assistant.
|
|
138
|
+
1. In the Context Servers section, click + Add Context Server.
|
|
139
|
+
1. Configure with the following:
|
|
140
|
+
|
|
141
|
+
<details>
|
|
142
|
+
<summary>Using <code>npm</code></summary>
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
/// The name of your MCP server
|
|
147
|
+
"drawio": {
|
|
148
|
+
"command": {
|
|
149
|
+
/// The path to the executable
|
|
150
|
+
"path": "npx",
|
|
151
|
+
/// The arguments to pass to the executable
|
|
152
|
+
"args": ["-y","drawio-mcp-server"],
|
|
153
|
+
/// The environment variables to set for the executable
|
|
154
|
+
"env": {}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
<details>
|
|
162
|
+
<summary>Using <code>pnpm</code></summary>
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
/// The name of your MCP server
|
|
167
|
+
"drawio": {
|
|
168
|
+
"command": {
|
|
169
|
+
/// The path to the executable
|
|
170
|
+
"path": "pnpm",
|
|
171
|
+
/// The arguments to pass to the executable
|
|
172
|
+
"args": ["dlx","drawio-mcp-server"],
|
|
173
|
+
/// The environment variables to set for the executable
|
|
174
|
+
"env": {}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
</details>
|
|
180
|
+
|
|
133
181
|
### Browser Extension Setup
|
|
134
182
|
|
|
135
183
|
In order to control the Draw.io diagram, you need to install dedicated Browser Extension.
|
|
@@ -151,6 +199,28 @@ In order to control the Draw.io diagram, you need to install dedicated Browser E
|
|
|
151
199
|
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" />
|
|
152
200
|
|
|
153
201
|
|
|
202
|
+
## Sponsoring
|
|
203
|
+
|
|
204
|
+
If you enjoy the project or find it useful, consider supporting its continued development.
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
lightning invoice:
|
|
208
|
+
|
|
209
|
+

|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
lnbc1p5f8wvnpp5kk0qt60waplesw3sjxu7tcqwmdp6ysq570dc4ln52krd3u5nzq6sdp82pshjgr5dusyymrfde4jq4mpd3kx2apq24ek2uscqzpuxqr8pqsp5gvr72xcs883qt4hea6v3u7803stcwfnk5c9w0ykqr9a40qqwnpys9qxpqysgqfzlhm0cz5vqy7wqt7rwpmkacukrk59k89ltd5n642wzru2jn88tyd78gr4y3j6u64k2u4sd4qgavlsnccl986velrg3x0pe95sx7p4sqtatttp
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
lightning address:
|
|
216
|
+
```
|
|
217
|
+
ladislav@blink.sv
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
<div align="center">
|
|
221
|
+
<a href="https://liberapay.com/ladislav/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
154
224
|
## Features
|
|
155
225
|
|
|
156
226
|
The Draw.io MCP server provides the following tools for programmatic diagram interaction:
|
|
@@ -176,6 +246,9 @@ The Draw.io MCP server provides the following tools for programmatic diagram int
|
|
|
176
246
|
- `shape_name`: Name of the shape to retrieve
|
|
177
247
|
*Returns*: Shape object including its category and style information
|
|
178
248
|
|
|
249
|
+
- **`list-paged-model`**
|
|
250
|
+
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.
|
|
251
|
+
|
|
179
252
|
### Diagram Modification Tools
|
|
180
253
|
- **`add-rectangle`**
|
|
181
254
|
Creates a new rectangle shape on the active Draw.io page with customizable properties:
|
|
@@ -217,3 +290,13 @@ The Draw.io MCP server provides the following tools for programmatic diagram int
|
|
|
217
290
|
[Architecture](./ARCHITECTURE.md)
|
|
218
291
|
|
|
219
292
|
[Development](./DEVELOPMENT.md)
|
|
293
|
+
|
|
294
|
+
## Star History
|
|
295
|
+
|
|
296
|
+
<a href="https://star-history.com/#lgazo/drawio-mcp-server&Date">
|
|
297
|
+
<picture>
|
|
298
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date&theme=dark" />
|
|
299
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date" />
|
|
300
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date" />
|
|
301
|
+
</picture>
|
|
302
|
+
</a>
|
package/build/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const bus_to_ws_forwarder_listener = (event) => {
|
|
|
36
36
|
};
|
|
37
37
|
emitter.on(bus_request_stream, bus_to_ws_forwarder_listener);
|
|
38
38
|
const ws_handler = {
|
|
39
|
+
maxPayloadLength: 128 * 1024,
|
|
39
40
|
open: (ws) => {
|
|
40
41
|
log.debug(`[ws_handler] A WebSocket client #${conns.length} connected, presumably MCP Extension!`);
|
|
41
42
|
conns.push(ws);
|
|
@@ -50,7 +51,7 @@ const ws_handler = {
|
|
|
50
51
|
emitter.emit(bus_reply_stream, json);
|
|
51
52
|
},
|
|
52
53
|
close: (ws, code, message) => {
|
|
53
|
-
log.debug(
|
|
54
|
+
log.debug(`[ws_handler] WebSocket client closed with code ${code}`);
|
|
54
55
|
//todo remove conn
|
|
55
56
|
},
|
|
56
57
|
};
|
|
@@ -197,6 +198,33 @@ server.tool(TOOL_add_cell_of_shape, "This tool allows you to add new vertex cell
|
|
|
197
198
|
.optional()
|
|
198
199
|
.describe("Semi-colon separated list of Draw.io visual styles, in the form of `key=value`. Example: `whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;`"),
|
|
199
200
|
}, default_tool(TOOL_add_cell_of_shape, context));
|
|
201
|
+
const TOOL_list_paged_model = "list-paged-model";
|
|
202
|
+
server.tool(TOOL_list_paged_model, "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.", {
|
|
203
|
+
page: z
|
|
204
|
+
.number()
|
|
205
|
+
.optional()
|
|
206
|
+
.describe("Zero-based page number for pagination. Page 0 returns the first batch of cells, page 1 returns the next batch, etc. Default is 0.")
|
|
207
|
+
.default(0),
|
|
208
|
+
page_size: z
|
|
209
|
+
.number()
|
|
210
|
+
.optional()
|
|
211
|
+
.describe("Maximum number of cells to return in a single page. Controls response size and performance. Must be between 1 and 1000. Default is 50.")
|
|
212
|
+
.default(50),
|
|
213
|
+
filter: z
|
|
214
|
+
.object({
|
|
215
|
+
cell_type: z
|
|
216
|
+
.enum(["edge", "vertex", "object", "layer", "group"])
|
|
217
|
+
.optional()
|
|
218
|
+
.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"),
|
|
219
|
+
attributes: z
|
|
220
|
+
.array(z.any())
|
|
221
|
+
.optional()
|
|
222
|
+
.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.'),
|
|
223
|
+
})
|
|
224
|
+
.optional()
|
|
225
|
+
.describe("Optional filter criteria to apply to cells before pagination")
|
|
226
|
+
.default({}),
|
|
227
|
+
}, default_tool(TOOL_list_paged_model, context));
|
|
200
228
|
async function main() {
|
|
201
229
|
log.debug("Draw.io MCP Server starting");
|
|
202
230
|
await start_websocket_server();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drawio-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Provides Draw.io services to MCP Clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "tsc",
|
|
48
48
|
"ci": "pnpm install --frozen-lockfile",
|
|
49
49
|
"dev": "tsc --watch",
|
|
50
|
-
"inspect": "pnpx @modelcontextprotocol/inspector node build/index.js",
|
|
50
|
+
"inspect": "HOST=0.0.0.0 pnpx @modelcontextprotocol/inspector node build/index.js",
|
|
51
51
|
"lint": "tsc --noEmit",
|
|
52
52
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
53
53
|
"format:check": "prettier --check \"src/**/*.ts\"",
|