drawio-mcp-server 1.8.0 → 2.0.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 (49) hide show
  1. package/README.md +9 -5
  2. package/build/emitter_bus.js +2 -3
  3. package/build/index.js +243 -341
  4. package/build/multi-transport.test.js +160 -0
  5. package/build/plugin/mcp-plugin.js +853 -60
  6. package/build/prefetch-assets.js +11 -0
  7. package/build/real-environment/add-cell-of-shape.test.js +51 -0
  8. package/build/real-environment/add-edge.test.js +86 -0
  9. package/build/real-environment/assertions.js +18 -0
  10. package/build/real-environment/delete-cell-by-id.test.js +45 -0
  11. package/build/real-environment/edge-editing.test.js +70 -0
  12. package/build/real-environment/edit-cell.test.js +64 -0
  13. package/build/real-environment/export-diagram.test.js +473 -0
  14. package/build/real-environment/harness.js +176 -0
  15. package/build/real-environment/import-export.test.js +82 -0
  16. package/build/real-environment/layers-and-selection.test.js +70 -0
  17. package/build/real-environment/logger.js +25 -0
  18. package/build/real-environment/screenshot.js +46 -0
  19. package/build/real-environment/set-cell-parent.test.js +64 -0
  20. package/build/real-environment/shapes.test.js +153 -0
  21. package/build/real-environment/test-helpers.js +10 -0
  22. package/build/real-environment/tools.js +22 -0
  23. package/build/real-environment/types.js +1 -0
  24. package/build/tool.js +46 -0
  25. package/build/tools/add-cell-of-shape.js +42 -0
  26. package/build/tools/add-edge.js +33 -0
  27. package/build/tools/add-rectangle.js +41 -0
  28. package/build/tools/create-layer.js +8 -0
  29. package/build/tools/delete-cell-by-id.js +10 -0
  30. package/build/tools/edit-cell.js +28 -0
  31. package/build/tools/edit-edge.js +30 -0
  32. package/build/tools/export-diagram.js +96 -0
  33. package/build/tools/get-active-layer.js +5 -0
  34. package/build/tools/get-selected-cell.js +5 -0
  35. package/build/tools/get-shape-by-name.js +10 -0
  36. package/build/tools/get-shape-categories.js +5 -0
  37. package/build/tools/get-shapes-in-category.js +10 -0
  38. package/build/tools/import-diagram.js +22 -0
  39. package/build/tools/index.js +49 -0
  40. package/build/tools/list-layers.js +5 -0
  41. package/build/tools/list-paged-model.js +41 -0
  42. package/build/tools/move-cell-to-layer.js +11 -0
  43. package/build/tools/set-active-layer.js +8 -0
  44. package/build/tools/set-cell-data.js +14 -0
  45. package/build/tools/set-cell-parent.js +9 -0
  46. package/build/tools/set-cell-shape.js +13 -0
  47. package/build/tools/shared.js +7 -0
  48. package/build/tools/types.js +1 -0
  49. package/package.json +35 -33
package/README.md CHANGED
@@ -3,16 +3,20 @@
3
3
  Let's do some Vibe Diagramming with the most wide-spread diagramming tool called Draw.io (Diagrams.net).
4
4
 
5
5
  [![Discord channel](https://shields.io/static/v1?logo=discord&message=draw.io%20mcp&label=chat&color=5865F2&logoColor=white)](https://discord.gg/dM4PWdf42q)
6
- [![Build project](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/lgazo/drawio-mcp-server/actions/workflows/ci.yml)
6
+ [![Build project](https://github.com/lgazo/drawio-mcp-server/actions/workflows/server-ci.yml/badge.svg)](https://github.com/lgazo/drawio-mcp-server/actions/workflows/server-ci.yml)
7
7
  [![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/5fc2b7fe-8ceb-4683-97bd-6d31e07b5888)
8
8
  [![Version](https://img.shields.io/npm/v/drawio-mcp-server)](https://npmjs.com/package/drawio-mcp-server)
9
9
 
10
10
  ## Key Highlights
11
11
 
12
+ - Import and export diagrams from/to XML, SVG (with embedded XML), or PNG (with embedded XML) ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
13
+ - Edge geometry control with waypoints and automatic self-connector routing ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
14
+ - Parent-child relationships for nested shapes and grouping ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
15
+ - Unified Server and Extension in the same mono-repo ![v2.0.0](https://img.shields.io/badge/v2.0.0-blue)
12
16
  - Built-in Draw.io editor - no browser extension required ![v1.8.0](https://img.shields.io/badge/v1.8.0-blue)
13
17
  - MCP server that lets AI agents control Draw.io diagrams
14
18
  - Programmatic diagram creation, inspection, and modification via MCP tools
15
- - Layer management for complex diagrams ![v1.7.0](https://img.shields.io/badge/v1.7.0-blue)
19
+ - Layer management for complex diagrams
16
20
  - Works with any MCP client (Claude Desktop, Claude Code, Zed, Codex, etc.)
17
21
 
18
22
  ## Introduction
@@ -32,7 +36,7 @@ Two ways to use:
32
36
  No additional requirements - runs out of the box with `--editor` flag.
33
37
 
34
38
  ### For Browser Extension
35
- - **Browser extension** - [drawio-mcp-extension](https://github.com/lgazo/drawio-mcp-extension)
39
+ - **Browser extension** - [drawio-mcp-extension](./packages/drawio-mcp-extension/README.md)
36
40
  - Draw.io open in your browser
37
41
 
38
42
  ### Optional
@@ -152,7 +156,7 @@ The server runs as part of your MCP host. Detailed configuration for all support
152
156
 
153
157
  ## Alternative: Browser Extension
154
158
 
155
- Instead of the built-in editor, you can use the [browser extension](https://github.com/lgazo/drawio-mcp-extension) to connect to Draw.io running in your browser. This works with or without the `--editor` flag.
159
+ Instead of the built-in editor, you can use the [browser extension](./packages/drawio-mcp-extension/README.md) to connect to Draw.io running in your browser. This works with or without the `--editor` flag.
156
160
 
157
161
  1. Open [Draw.io in your browser](https://app.diagrams.net/)
158
162
  2. Install the Draw.io MCP Browser Extension:
@@ -173,7 +177,7 @@ Configuration without `--editor`:
173
177
  }
174
178
  ```
175
179
 
176
- See the [extension documentation](https://github.com/lgazo/drawio-mcp-extension) for more details.
180
+ See the [extension documentation](./packages/drawio-mcp-extension/README.md) for more details.
177
181
 
178
182
  ## Related Resources
179
183
 
@@ -1,7 +1,6 @@
1
- import { bus_reply_stream, bus_request_stream, } from "./types.js";
1
+ import { bus_reply_stream, bus_request_stream } from "./types.js";
2
2
  export function create_bus(log) {
3
3
  return function (emitter) {
4
- const listeners = [];
5
4
  const bus = {
6
5
  send_to_extension: (request) => {
7
6
  log.debug(`[bus] sending to Extension`, request);
@@ -11,11 +10,11 @@ export function create_bus(log) {
11
10
  const listener = (emitter_data) => {
12
11
  log.debug(`[bus] received from Extension`, emitter_data);
13
12
  if (emitter_data && emitter_data.__event === event_name) {
13
+ emitter.off(bus_reply_stream, listener);
14
14
  reply(emitter_data);
15
15
  }
16
16
  };
17
17
  emitter.on(bus_reply_stream, listener);
18
- listeners.push(reply);
19
18
  },
20
19
  };
21
20
  return bus;