drawio-mcp-server 1.0.3 → 1.1.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/README.md +58 -0
- package/build/index.js +28 -1
- package/package.json +1 -1
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.
|
|
@@ -217,3 +265,13 @@ The Draw.io MCP server provides the following tools for programmatic diagram int
|
|
|
217
265
|
[Architecture](./ARCHITECTURE.md)
|
|
218
266
|
|
|
219
267
|
[Development](./DEVELOPMENT.md)
|
|
268
|
+
|
|
269
|
+
## Star History
|
|
270
|
+
|
|
271
|
+
<a href="https://star-history.com/#lgazo/drawio-mcp-server&Date">
|
|
272
|
+
<picture>
|
|
273
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date&theme=dark" />
|
|
274
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date" />
|
|
275
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=lgazo/drawio-mcp-server&type=Date" />
|
|
276
|
+
</picture>
|
|
277
|
+
</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,32 @@ 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_tool(TOOL_list_paged_model, context));
|
|
200
227
|
async function main() {
|
|
201
228
|
log.debug("Draw.io MCP Server starting");
|
|
202
229
|
await start_websocket_server();
|