@drawio/mcp 1.1.2 → 1.1.4

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 (3) hide show
  1. package/README.md +3 -4
  2. package/package.json +2 -2
  3. package/src/index.js +30 -62
package/README.md CHANGED
@@ -12,7 +12,6 @@ This package is part of the [drawio-mcp](https://github.com/jgraph/drawio-mcp) r
12
12
  - **Open XML diagrams**: Load native draw.io/mxGraph XML format
13
13
  - **Import CSV data**: Convert tabular data to diagrams (org charts, flowcharts, etc.)
14
14
  - **Render Mermaid.js**: Transform Mermaid syntax into editable draw.io diagrams
15
- - **URL support**: Fetch content from URLs automatically
16
15
  - **Customizable display**: Lightbox mode, dark mode, and more
17
16
 
18
17
  ## Installation
@@ -75,7 +74,7 @@ Opens the draw.io editor with XML content.
75
74
 
76
75
  | Parameter | Type | Required | Description |
77
76
  |-----------|------|----------|-------------|
78
- | `content` | string | Yes | Draw.io XML or URL to XML |
77
+ | `content` | string | Yes | Draw.io XML content |
79
78
  | `lightbox` | boolean | No | Read-only view mode (default: false) |
80
79
  | `dark` | string | No | "auto", "true", or "false" (default: "auto") |
81
80
 
@@ -85,7 +84,7 @@ Opens the draw.io editor with CSV data converted to a diagram.
85
84
 
86
85
  | Parameter | Type | Required | Description |
87
86
  |-----------|------|----------|-------------|
88
- | `content` | string | Yes | CSV content or URL to CSV |
87
+ | `content` | string | Yes | CSV content |
89
88
  | `lightbox` | boolean | No | Read-only view mode (default: false) |
90
89
  | `dark` | string | No | "auto", "true", or "false" (default: "auto") |
91
90
 
@@ -95,7 +94,7 @@ Opens the draw.io editor with a Mermaid.js diagram.
95
94
 
96
95
  | Parameter | Type | Required | Description |
97
96
  |-----------|------|----------|-------------|
98
- | `content` | string | Yes | Mermaid syntax or URL |
97
+ | `content` | string | Yes | Mermaid.js syntax |
99
98
  | `lightbox` | boolean | No | Read-only view mode (default: false) |
100
99
  | `dark` | string | No | "auto", "true", or "false" (default: "auto") |
101
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawio/mcp",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Official draw.io MCP server for LLMs - Open diagrams in draw.io editor",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -36,7 +36,7 @@
36
36
  "node": ">=18.0.0"
37
37
  },
38
38
  "dependencies": {
39
- "@modelcontextprotocol/sdk": "1.11.2",
39
+ "@modelcontextprotocol/sdk": "^1.27.1",
40
40
  "pako": "^2.1.0"
41
41
  },
42
42
  "files": [
package/src/index.js CHANGED
@@ -4,7 +4,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
6
6
  import pako from "pako";
7
- import { exec } from "child_process";
7
+ import { spawn } from "child_process";
8
8
 
9
9
  const DRAWIO_BASE_URL = "https://app.diagrams.net/";
10
10
 
@@ -13,29 +13,27 @@ const DRAWIO_BASE_URL = "https://app.diagrams.net/";
13
13
  */
14
14
  function openBrowser(url)
15
15
  {
16
- const platform = process.platform;
17
- let command;
16
+ let child;
18
17
 
19
- if (platform === "win32")
18
+ if (process.platform === "win32")
20
19
  {
21
- command = `start "" "${url}"`;
20
+ child = spawn("cmd", ["/c", "start", "", url], { shell: false, stdio: "ignore" });
22
21
  }
23
- else if (platform === "darwin")
22
+ else if (process.platform === "darwin")
24
23
  {
25
- command = `open "${url}"`;
24
+ child = spawn("open", [url], { shell: false, stdio: "ignore" });
26
25
  }
27
26
  else
28
27
  {
29
- command = `xdg-open "${url}"`;
28
+ child = spawn("xdg-open", [url], { shell: false, stdio: "ignore" });
30
29
  }
31
30
 
32
- exec(command, (error) =>
31
+ child.on("error", function(error)
33
32
  {
34
- if (error)
35
- {
36
- console.error(`Failed to open browser: ${error.message}`);
37
- }
33
+ console.error(`Failed to open browser: ${error.message}`);
38
34
  });
35
+
36
+ child.unref();
39
37
  }
40
38
 
41
39
  /**
@@ -101,45 +99,27 @@ function generateDrawioUrl(data, type, options = {})
101
99
  return DRAWIO_BASE_URL + (paramsStr ? "?" + paramsStr : "") + createHash;
102
100
  }
103
101
 
104
- /**
105
- * Fetches content from a URL
106
- */
107
- async function fetchContent(url)
108
- {
109
- const response = await fetch(url);
110
- if (!response.ok)
111
- {
112
- throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
113
- }
114
- return response.text();
115
- }
116
-
117
- /**
118
- * Determines if the input is a URL
119
- */
120
- function isUrl(input)
121
- {
122
- try
123
- {
124
- new URL(input);
125
- return true;
126
- }
127
- catch
128
- {
129
- return false;
130
- }
131
- }
132
-
133
102
  // Define the tools
134
103
  const tools =
135
104
  [
136
105
  {
137
106
  name: "open_drawio_xml",
138
107
  description:
139
- "Opens the draw.io editor with a diagram from XML content or a URL to XML content. " +
108
+ "Opens the draw.io editor with a diagram from XML content. " +
140
109
  "Use this to view, edit, or create diagrams in draw.io format. " +
141
110
  "The XML should be valid draw.io/mxGraph XML format. " +
142
- "IMPORTANT: Do NOT use double hyphens (--) inside XML comments, as this is invalid XML and will break the parser. Use single hyphens or rephrase instead.",
111
+ "IMPORTANT: Do NOT use double hyphens (--) inside XML comments, as this is invalid XML and will break the parser. Use single hyphens or rephrase instead. " +
112
+ "EDGE ROUTING: Use edgeStyle=orthogonalEdgeStyle for right-angle connectors. " +
113
+ "Space nodes at least 60px apart to avoid overlapping edges. " +
114
+ "Use exitX/exitY/entryX/entryY (0-1) to control which side of a node an edge connects to, spreading connections across different sides. " +
115
+ "Add explicit waypoints via <Array as=\"points\"><mxPoint x=\"...\" y=\"...\"/></Array> inside mxGeometry when edges would overlap. " +
116
+ "CONTAINERS: For architecture diagrams and any diagram with nested elements, use proper parent-child containment (set parent=\"containerId\" on children, use relative coordinates). " +
117
+ "Container types: (1) group style (style=\"group;\") for invisible containers with no connections - includes pointerEvents=0 so child connections are not captured by the container; " +
118
+ "(2) swimlane style (style=\"swimlane;startSize=30;\") for labeled containers with a title bar - use when the container needs visual borders/headers or when the container itself has connections; " +
119
+ "(3) any shape can be a container by adding container=1 to its style, but also add pointerEvents=0 unless the container itself needs to be connectable. " +
120
+ "Always use pointerEvents=0 on container styles that should not capture connections being rewired between children. " +
121
+ "LAYOUT: Align nodes to a grid (multiples of 10). Use consistent spacing (e.g., 200px horizontal, 120px vertical between nodes). " +
122
+ "See https://www.drawio.com/doc/faq/drawio-style-reference.html for the complete style reference.",
143
123
  inputSchema:
144
124
  {
145
125
  type: "object",
@@ -149,8 +129,7 @@ const tools =
149
129
  {
150
130
  type: "string",
151
131
  description:
152
- "The draw.io XML content or a URL pointing to XML content. " +
153
- "If a URL is provided, the content will be fetched automatically.",
132
+ "The draw.io XML content in mxGraphModel format.",
154
133
  },
155
134
  lightbox:
156
135
  {
@@ -170,7 +149,7 @@ const tools =
170
149
  {
171
150
  name: "open_drawio_csv",
172
151
  description:
173
- "Opens the draw.io editor with a diagram generated from CSV data or a URL to CSV data. " +
152
+ "Opens the draw.io editor with a diagram generated from CSV data. " +
174
153
  "The CSV format should follow draw.io's CSV import specification which allows " +
175
154
  "creating org charts, flowcharts, and other diagrams from tabular data.",
176
155
  inputSchema:
@@ -182,9 +161,7 @@ const tools =
182
161
  {
183
162
  type: "string",
184
163
  description:
185
- "The CSV content or a URL pointing to CSV content. " +
186
- "If a URL is provided, the content will be fetched automatically. " +
187
- "The CSV should follow draw.io's CSV import format.",
164
+ "The CSV content following draw.io's CSV import format.",
188
165
  },
189
166
  lightbox:
190
167
  {
@@ -204,7 +181,7 @@ const tools =
204
181
  {
205
182
  name: "open_drawio_mermaid",
206
183
  description:
207
- "Opens the draw.io editor with a diagram generated from Mermaid.js syntax or a URL to Mermaid content. " +
184
+ "Opens the draw.io editor with a diagram generated from Mermaid.js syntax. " +
208
185
  "Supports flowcharts, sequence diagrams, class diagrams, state diagrams, " +
209
186
  "entity relationship diagrams, and more using Mermaid.js syntax.",
210
187
  inputSchema:
@@ -216,8 +193,7 @@ const tools =
216
193
  {
217
194
  type: "string",
218
195
  description:
219
- "The Mermaid.js diagram definition or a URL pointing to Mermaid content. " +
220
- "If a URL is provided, the content will be fetched automatically. " +
196
+ "The Mermaid.js diagram definition. " +
221
197
  "Example: 'graph TD; A-->B; B-->C;'",
222
198
  },
223
199
  lightbox:
@@ -286,15 +262,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) =>
286
262
  };
287
263
  }
288
264
 
289
- // Fetch content if it's a URL
290
- if (isUrl(inputContent))
291
- {
292
- content = await fetchContent(inputContent);
293
- }
294
- else
295
- {
296
- content = inputContent;
297
- }
265
+ content = inputContent;
298
266
 
299
267
  switch (name)
300
268
  {