@excaliwow/mcp 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +16 -15
  2. package/dist/bin.js +55 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@ client (Claude Desktop, Claude Code, etc.) can launch it with `npx`.
9
9
 
10
10
  First mint a Personal Access Token at https://excaliwow.com/app/settings
11
11
  (Settings → Developer / API tokens) with **`read` + `write`** capabilities —
12
- enough for five of the seven tools. Add **`delete`** only if you want the agent
12
+ enough for six of the eight tools. Add **`delete`** only if you want the agent
13
13
  to trash and restore diagrams (see [Security notes](#security-notes)). Pass it as
14
14
  `EXCALIWOW_TOKEN`.
15
15
 
@@ -37,7 +37,7 @@ token to your account:
37
37
  "mcpServers": {
38
38
  "excaliwow": {
39
39
  "command": "npx",
40
- "args": ["-y", "@excaliwow/mcp@0.3.0"],
40
+ "args": ["-y", "@excaliwow/mcp@0.4.0"],
41
41
  "env": {
42
42
  "EXCALIWOW_TOKEN": "excw_pat_…"
43
43
  }
@@ -53,7 +53,7 @@ you've reviewed a new release.
53
53
 
54
54
  ## Troubleshooting
55
55
 
56
- **`npx -y @excaliwow/mcp@0.3.0` fails with `ENOENT … /@excaliwow/mcp@0.3.0/package.json`.**
56
+ **`npx -y @excaliwow/mcp@0.4.0` fails with `ENOENT … /@excaliwow/mcp@0.4.0/package.json`.**
57
57
  On some npm/Node versions, `npx` misreads a scoped package + `@version` spec as a
58
58
  local directory. It's an upstream npm bug (it reproduces with other scoped
59
59
  packages, e.g. `@modelcontextprotocol/server-filesystem@1.0.0`), not an Excaliwow one. Either
@@ -62,7 +62,7 @@ above does), or pin safely by installing once and pointing the client at the
62
62
  binary:
63
63
 
64
64
  ```sh
65
- npm i -g @excaliwow/mcp@0.3.0
65
+ npm i -g @excaliwow/mcp@0.4.0
66
66
  ```
67
67
 
68
68
  ```json
@@ -100,17 +100,18 @@ npx -y @excaliwow/mcp --health
100
100
 
101
101
  ## Tools
102
102
 
103
- Seven tools, scoped to safe agent use:
103
+ Eight tools, scoped to safe agent use:
104
104
 
105
- | Tool | Capability | What it does |
106
- | ------------------ | ---------- | --------------------------------------------------------------------------- |
107
- | `generate_diagram` | `write` | Create a diagram from the high-level node/edge DSL; returns the editor URL. |
108
- | `read_diagram` | `read` | Compact summary (title + per-type element counts) **plus** a rendered PNG. |
109
- | `list_diagrams` | `read` | Page through your diagrams (`filter: active \| trash`). |
110
- | `move_diagram` | `write` | Move a diagram to a folder (or to root). |
111
- | `edit_diagram` | `write` | Additively merge a DSL fragment (add nodes/edges, update node style/label). |
112
- | `trash_diagram` | `delete` | Soft-delete a diagram to trash. **Reversible** (see `restore_diagram`). |
113
- | `restore_diagram` | `delete` | Restore a trashed diagram, reopening it at its original id and URL. |
105
+ | Tool | Capability | What it does |
106
+ | -------------------- | ---------- | ----------------------------------------------------------------------------- |
107
+ | `generate_diagram` | `write` | Create a diagram from the high-level node/edge DSL; returns the editor URL. |
108
+ | `read_diagram` | `read` | Compact summary (title + per-type element counts) **plus** a rendered PNG. |
109
+ | `list_diagrams` | `read` | Page through your diagrams (`filter: active \| trash`). |
110
+ | `move_diagram` | `write` | Move a diagram to a folder (or to root). |
111
+ | `edit_diagram` | `write` | Additively merge a DSL fragment (add nodes/edges, update node style/label). |
112
+ | `regenerate_diagram` | `write` | Replace a diagram's contents in place from a fresh spec (re-layout, same id). |
113
+ | `trash_diagram` | `delete` | Soft-delete a diagram to trash. **Reversible** (see `restore_diagram`). |
114
+ | `restore_diagram` | `delete` | Restore a trashed diagram, reopening it at its original id and URL. |
114
115
 
115
116
  `read_diagram` returns a summary + image, **never** the raw scene JSON, to keep
116
117
  context small. `trash_diagram` / `restore_diagram` are a **reversible** pair
@@ -142,7 +143,7 @@ project`) puts the token into git history. Use a user- or local-scoped config
142
143
  (`--scope local`), or reference an environment variable instead of pasting the
143
144
  literal token.
144
145
  - **Mint with `read` + `write` (add `delete` only if you want trash/restore).**
145
- Five of the seven tools need just `read` + `write`; a `read` + `write` PAT can
146
+ Six of the eight tools need just `read` + `write`; a `read` + `write` PAT can
146
147
  neither expose your diagrams publicly nor delete them, even if the agent is
147
148
  misled (`trash_diagram` / `restore_diagram` simply return `insufficient_scope`
148
149
  and do nothing). Add the `delete` capability only if you want the agent to be
package/dist/bin.js CHANGED
@@ -223,6 +223,18 @@ function restoreDiagram(ctx, id) {
223
223
  fetchImpl: ctx.fetchImpl
224
224
  });
225
225
  }
226
+ function regenerateDiagram(ctx, id, args) {
227
+ const body = { spec: args.spec };
228
+ if (args.title !== void 0) body.title = args.title;
229
+ return request({
230
+ method: "POST",
231
+ path: `${PREFIX}/diagrams/${encodeURIComponent(id)}/regenerate`,
232
+ token: ctx.token,
233
+ baseUrl: ctx.baseUrl,
234
+ body,
235
+ fetchImpl: ctx.fetchImpl
236
+ });
237
+ }
226
238
 
227
239
  // src/server.ts
228
240
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -445,7 +457,7 @@ var EditFragmentZ = z.object({
445
457
  });
446
458
 
447
459
  // src/version.ts
448
- var VERSION = "0.3.0";
460
+ var VERSION = "0.4.0";
449
461
 
450
462
  // src/server.ts
451
463
  function textResult(text) {
@@ -677,6 +689,48 @@ preview fidelity: ${png.quality} \u2014 faithful renderer unavailable; layout/fo
677
689
  }
678
690
  }
679
691
  );
692
+ server2.registerTool(
693
+ "regenerate_diagram",
694
+ {
695
+ title: "Regenerate a diagram (replace in place)",
696
+ description: [
697
+ "REPLACE an existing diagram's entire contents from a fresh DiagramSpec: the spec is",
698
+ "re-laid-out server-side and swapped in, keeping the SAME id and url. Use this to ITERATE",
699
+ "on one diagram (fix layout, restructure) instead of generate_diagram, which mints a NEW",
700
+ "id+url each time and orphans the old one. Unlike edit_diagram (which only appends/patches),",
701
+ "this discards the old scene entirely. Comments anchored to a shape the new layout no longer",
702
+ "contains are detached (returned as orphanedComments); comments on shapes whose node id you",
703
+ "reuse stay attached. Pass an optional title to rename in the same call. Returns the id, the",
704
+ "new element count (replaced), orphanedComments, and the editor url.",
705
+ "",
706
+ COMPACT_GRAMMAR,
707
+ "",
708
+ "See the `" + DSL_REFERENCE_URI + "` resource for the full DSL reference."
709
+ ].join("\n"),
710
+ inputSchema: {
711
+ id: z2.string(),
712
+ title: z2.string().nullish(),
713
+ spec: DiagramSpecZ
714
+ }
715
+ },
716
+ async ({ id, title, spec }) => {
717
+ try {
718
+ const ctx = buildCtx(deps);
719
+ const result = await regenerateDiagram(ctx, id, { spec, title: title ?? void 0 });
720
+ return textResult(
721
+ JSON.stringify({
722
+ id: result.id,
723
+ replaced: result.replaced,
724
+ orphanedComments: result.orphanedComments,
725
+ ...result.title !== void 0 ? { title: result.title } : {},
726
+ url: editorUrl(ctx, result.id)
727
+ })
728
+ );
729
+ } catch (err) {
730
+ return toErrorResult(err);
731
+ }
732
+ }
733
+ );
680
734
  server2.registerResource(
681
735
  "dsl-reference",
682
736
  DSL_REFERENCE_URI,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excaliwow/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Excaliwow Model Context Protocol (MCP) server — lets AI agents create, read, render, and edit Excaliwow diagrams over the public REST API, via stdio.",
5
5
  "private": false,
6
6
  "publishConfig": {