@drawio/mcp 1.1.2 → 1.1.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 (3) hide show
  1. package/README.md +3 -4
  2. package/package.json +2 -2
  3. package/src/index.js +18 -61
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.3",
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,42 +99,13 @@ 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
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.",
@@ -149,8 +118,7 @@ const tools =
149
118
  {
150
119
  type: "string",
151
120
  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.",
121
+ "The draw.io XML content in mxGraphModel format.",
154
122
  },
155
123
  lightbox:
156
124
  {
@@ -170,7 +138,7 @@ const tools =
170
138
  {
171
139
  name: "open_drawio_csv",
172
140
  description:
173
- "Opens the draw.io editor with a diagram generated from CSV data or a URL to CSV data. " +
141
+ "Opens the draw.io editor with a diagram generated from CSV data. " +
174
142
  "The CSV format should follow draw.io's CSV import specification which allows " +
175
143
  "creating org charts, flowcharts, and other diagrams from tabular data.",
176
144
  inputSchema:
@@ -182,9 +150,7 @@ const tools =
182
150
  {
183
151
  type: "string",
184
152
  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.",
153
+ "The CSV content following draw.io's CSV import format.",
188
154
  },
189
155
  lightbox:
190
156
  {
@@ -204,7 +170,7 @@ const tools =
204
170
  {
205
171
  name: "open_drawio_mermaid",
206
172
  description:
207
- "Opens the draw.io editor with a diagram generated from Mermaid.js syntax or a URL to Mermaid content. " +
173
+ "Opens the draw.io editor with a diagram generated from Mermaid.js syntax. " +
208
174
  "Supports flowcharts, sequence diagrams, class diagrams, state diagrams, " +
209
175
  "entity relationship diagrams, and more using Mermaid.js syntax.",
210
176
  inputSchema:
@@ -216,8 +182,7 @@ const tools =
216
182
  {
217
183
  type: "string",
218
184
  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. " +
185
+ "The Mermaid.js diagram definition. " +
221
186
  "Example: 'graph TD; A-->B; B-->C;'",
222
187
  },
223
188
  lightbox:
@@ -286,15 +251,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) =>
286
251
  };
287
252
  }
288
253
 
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
- }
254
+ content = inputContent;
298
255
 
299
256
  switch (name)
300
257
  {