@markasso/mcp 0.4.0 → 0.4.2

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 CHANGED
@@ -91,7 +91,7 @@ Bump `version` in `mcp/package.json`, add the entry to `mcp/CHANGELOG.md`, merge
91
91
  | `diagram_export_svg` | Export an SVG image |
92
92
  | `diagram_export_png` | Render a PNG the agent can look at (optionally saved to a file) |
93
93
  | `diagram_share` | Publish and return a markasso.it link, with its expiry date |
94
- | `live_join` / `live_leave` | Draw on a live board in real time (link from Share → Share live session) |
94
+ | `live_join` / `live_leave` | Draw on a live board in real time (link from ⋯ More tools → Start live session) |
95
95
 
96
96
  Vendor icon packs (AWS, Azure, Google Cloud) are not available to agents: they can't be redistributed, and in the app they are imported by each user into their own browser.
97
97
 
@@ -103,7 +103,7 @@ Vendor icon packs (AWS, Azure, Google Cloud) are not available to agents: they c
103
103
 
104
104
  ## Live mode
105
105
 
106
- 1. In Markasso, open **Share → Share live session** and copy the live link.
106
+ 1. In Markasso, choose **⋯ More tools → Start live session**: the live link is copied to the clipboard. Or, once the session is running, choose **⋯ More tools → Invite AI agent** to copy a ready-made prompt with the link.
107
107
  2. Ask the agent to `live_join` it. If the room already has content, it becomes the agent's current diagram; if it is empty, the agent's diagram is published to it.
108
108
  3. Every change the agent makes is applied for everyone in the room; changes made by people show up when the agent calls `diagram_read`.
109
109
 
@@ -4202,7 +4202,7 @@ function escapeXml(str) {
4202
4202
  }
4203
4203
  //#endregion
4204
4204
  //#region package.json
4205
- var version = "0.4.0";
4205
+ var version = "0.4.2";
4206
4206
  //#endregion
4207
4207
  //#region ../src/core/layout.ts
4208
4208
  /** Orders vertices without recursion, preserving input order when unconstrained. */
@@ -5686,6 +5686,33 @@ var Diagram = class {
5686
5686
  return this.history.present.elements;
5687
5687
  }
5688
5688
  /**
5689
+ * Elements to write out (file, share link). Bound connectors keep the
5690
+ * x/y/x2/y2 they had when connected, since the app resolves their ends
5691
+ * from the shapes at draw time; here they are set to where they are drawn
5692
+ * now, so a saved board stays consistent for readers that use the stored
5693
+ * coordinates. The live scene and its undo stack are left untouched.
5694
+ */
5695
+ snapshot() {
5696
+ const all = this.elements;
5697
+ return all.map((el) => {
5698
+ if (!isConnector(el) || !el.startElementId && !el.endElementId) return el;
5699
+ if (el.type === "line" && el.cx !== void 0 && el.cy !== void 0) return {
5700
+ ...el,
5701
+ ...resolveArrowEndpoints(el, all)
5702
+ };
5703
+ const route = resolveConnectorRoute(el, all);
5704
+ const [x, y] = route[0];
5705
+ const [x2, y2] = route[route.length - 1];
5706
+ return {
5707
+ ...el,
5708
+ x,
5709
+ y,
5710
+ x2,
5711
+ y2
5712
+ };
5713
+ });
5714
+ }
5715
+ /**
5689
5716
  * Key of every node: the agent's own key when it created the node, else
5690
5717
  * a slug of its label (or "<type>-<id prefix>"), deduplicated. Stable for
5691
5718
  * a given scene, so a model can re-read and keep addressing nodes.
@@ -6684,7 +6711,7 @@ server.registerTool("diagram_save", {
6684
6711
  description: "Save the diagram as a .markasso file (open it in the app with File > Open).",
6685
6712
  inputSchema: { path: z.string().min(1).describe("Absolute path ending in .markasso") }
6686
6713
  }, guarded(async ({ path }) => {
6687
- await saveMarkassoFile(path, diagram.elements);
6714
+ await saveMarkassoFile(path, diagram.snapshot());
6688
6715
  return `Saved ${diagram.elements.length} elements to ${path}.`;
6689
6716
  }));
6690
6717
  server.registerTool("diagram_export_svg", {
@@ -6741,14 +6768,14 @@ server.registerTool("diagram_share", {
6741
6768
  annotations: { openWorldHint: true }
6742
6769
  }, guarded(async () => {
6743
6770
  if (diagram.elements.length === 0) return "The diagram is empty: nothing to share.";
6744
- const { url, expiresAt } = await createShareLink(diagram.elements);
6771
+ const { url, expiresAt } = await createShareLink(diagram.snapshot());
6745
6772
  return `Open in Markasso: ${url}\nThe link expires ${expiresAt ? `on ${expiresAt.toISOString().slice(0, 10)}` : "after a while"}; save a .markasso file to keep the diagram.`;
6746
6773
  }));
6747
6774
  server.registerTool("live_join", {
6748
6775
  title: "Join live board",
6749
6776
  description: "Join a Markasso live session (link with ?live=...) and draw on that board in real time. If the room has content it becomes the current diagram; if it is empty, the current diagram is published to it.",
6750
6777
  inputSchema: {
6751
- link: z.string().min(1).describe("Live session link from Markasso (Share > Live)"),
6778
+ link: z.string().min(1).describe("Live session link from Markasso (⋯ More tools > Start live session, or the prompt from Invite AI agent)"),
6752
6779
  name: z.string().min(1).max(40).optional().describe("Name shown to people in the room (default \"AI agent\")")
6753
6780
  },
6754
6781
  annotations: { openWorldHint: true }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markasso/mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "MCP server that lets AI agents create, read and edit Markasso diagrams, offline or live on a shared board",
5
5
  "type": "module",
6
6
  "repository": {