@markasso/mcp 0.4.2 → 0.5.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.
- package/README.md +2 -0
- package/dist/markasso-mcp.js +37 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,8 @@ args = ["-y", "@markasso/mcp@latest"]
|
|
|
55
55
|
|
|
56
56
|
**Local models (e.g. Gemma in LM Studio):** add the same `mcpServers` entry to LM Studio's `mcp.json`. The tools take short keys and named colors and never require coordinates, so small models handle them well.
|
|
57
57
|
|
|
58
|
+
**Drawing live with people:** `live_join` puts the agent in a live session next to you. This needs a [Markasso Cloud](https://markasso.it/cloud) licence: set `MARKASSO_LICENSE` to your key in the server's environment, e.g. `"env": { "MARKASSO_LICENSE": "MKC-…" }` in the entry above. Everything else in this server is free.
|
|
59
|
+
|
|
58
60
|
**Another Markasso instance:** set `MARKASSO_URL` (default `https://markasso.it`) in the server's environment.
|
|
59
61
|
|
|
60
62
|
## Build from source
|
package/dist/markasso-mcp.js
CHANGED
|
@@ -4202,7 +4202,7 @@ function escapeXml(str) {
|
|
|
4202
4202
|
}
|
|
4203
4203
|
//#endregion
|
|
4204
4204
|
//#region package.json
|
|
4205
|
-
var version = "0.
|
|
4205
|
+
var version = "0.5.0";
|
|
4206
4206
|
//#endregion
|
|
4207
4207
|
//#region ../src/core/layout.ts
|
|
4208
4208
|
/** Orders vertices without recursion, preserving input order when unconstrained. */
|
|
@@ -5164,6 +5164,20 @@ function withApplyStyleTargets(scene, command) {
|
|
|
5164
5164
|
*/
|
|
5165
5165
|
var History = class {
|
|
5166
5166
|
onCommand;
|
|
5167
|
+
readOnly = false;
|
|
5168
|
+
/** Replace a document snapshot without retaining undo entries from another board. */
|
|
5169
|
+
replaceScene(elements, viewport) {
|
|
5170
|
+
this.past = [];
|
|
5171
|
+
this.future = [];
|
|
5172
|
+
this.drag = null;
|
|
5173
|
+
this._present = {
|
|
5174
|
+
...createScene(),
|
|
5175
|
+
elements,
|
|
5176
|
+
viewport,
|
|
5177
|
+
appState: this._present.appState
|
|
5178
|
+
};
|
|
5179
|
+
this.notify();
|
|
5180
|
+
}
|
|
5167
5181
|
past = [];
|
|
5168
5182
|
_present;
|
|
5169
5183
|
future = [];
|
|
@@ -5179,6 +5193,7 @@ var History = class {
|
|
|
5179
5193
|
/** Call at the start of a drag (move/resize/rotate). Every command until
|
|
5180
5194
|
* endDrag folds into one undo step, so the drag undoes in a single Ctrl+Z. */
|
|
5181
5195
|
beginDrag() {
|
|
5196
|
+
if (this.readOnly) return;
|
|
5182
5197
|
if (this.drag) return;
|
|
5183
5198
|
this.drag = {
|
|
5184
5199
|
change: emptyChange(),
|
|
@@ -5227,6 +5242,7 @@ var History = class {
|
|
|
5227
5242
|
* people's actions must not pollute your undo history) and does NOT
|
|
5228
5243
|
* re-broadcast it via onCommand (avoids echo loops). */
|
|
5229
5244
|
applyRemote(command) {
|
|
5245
|
+
if (this.readOnly) return;
|
|
5230
5246
|
const next = reducer(this._present, command, true);
|
|
5231
5247
|
if (next === this._present) return;
|
|
5232
5248
|
this._present = next;
|
|
@@ -5235,6 +5251,7 @@ var History = class {
|
|
|
5235
5251
|
/** Reset the scene to a fresh board, then replay a list of commands (used when
|
|
5236
5252
|
* joining a live room: the room's log is authoritative). Does not touch undo. */
|
|
5237
5253
|
resetForLiveReplay(commands, keepViewport = true) {
|
|
5254
|
+
if (this.readOnly) return;
|
|
5238
5255
|
const viewport = this._present.viewport;
|
|
5239
5256
|
this.past = [];
|
|
5240
5257
|
this.future = [];
|
|
@@ -5247,6 +5264,7 @@ var History = class {
|
|
|
5247
5264
|
for (const command of commands) this.applyRemote(command);
|
|
5248
5265
|
}
|
|
5249
5266
|
dispatch(command) {
|
|
5267
|
+
if (this.readOnly && (!isEphemeralCommand(command.type) || command.type === "SET_JUST_CREATED_TEXT")) return;
|
|
5250
5268
|
const resolved = withApplyStyleTargets(this._present, command);
|
|
5251
5269
|
const next = reducer(this._present, resolved);
|
|
5252
5270
|
if (next === this._present) return;
|
|
@@ -5269,6 +5287,7 @@ var History = class {
|
|
|
5269
5287
|
this.notify();
|
|
5270
5288
|
}
|
|
5271
5289
|
undo() {
|
|
5290
|
+
if (this.readOnly) return;
|
|
5272
5291
|
if (this.drag) {
|
|
5273
5292
|
this.cancelDrag();
|
|
5274
5293
|
return;
|
|
@@ -5279,6 +5298,7 @@ var History = class {
|
|
|
5279
5298
|
this.revert(entry.change, "undo", entry.appStateBefore);
|
|
5280
5299
|
}
|
|
5281
5300
|
redo() {
|
|
5301
|
+
if (this.readOnly) return;
|
|
5282
5302
|
if (this.drag) {
|
|
5283
5303
|
this.cancelDrag();
|
|
5284
5304
|
return;
|
|
@@ -5289,10 +5309,10 @@ var History = class {
|
|
|
5289
5309
|
this.revert(entry.change, "redo", entry.appStateAfter);
|
|
5290
5310
|
}
|
|
5291
5311
|
canUndo() {
|
|
5292
|
-
return this.past.length > 0;
|
|
5312
|
+
return !this.readOnly && this.past.length > 0;
|
|
5293
5313
|
}
|
|
5294
5314
|
canRedo() {
|
|
5295
|
-
return this.future.length > 0;
|
|
5315
|
+
return !this.readOnly && this.future.length > 0;
|
|
5296
5316
|
}
|
|
5297
5317
|
subscribe(listener) {
|
|
5298
5318
|
this.listeners.push(listener);
|
|
@@ -6288,6 +6308,9 @@ async function saveMarkassoFile(path, elements) {
|
|
|
6288
6308
|
var ROOM_ID = /^[a-zA-Z0-9_-]{3,64}$/;
|
|
6289
6309
|
var AGENT_COLOR = "#c77dff";
|
|
6290
6310
|
var JOIN_TIMEOUT_MS = 1e4;
|
|
6311
|
+
/** Close code the room uses for an agent without a valid licence. */
|
|
6312
|
+
var CLOSE_LICENCE_REQUIRED = 4402;
|
|
6313
|
+
var LICENCE_MESSAGE = "Drawing live with an AI agent needs a Markasso Cloud licence. Get one at https://markasso.it/cloud, then set MARKASSO_LICENSE in this MCP server's environment.";
|
|
6291
6314
|
var LiveError = class extends Error {
|
|
6292
6315
|
name = "LiveError";
|
|
6293
6316
|
};
|
|
@@ -6361,6 +6384,11 @@ var LiveLink = class LiveLink {
|
|
|
6361
6384
|
reject(new LiveError("Timed out joining the live room."));
|
|
6362
6385
|
}, JOIN_TIMEOUT_MS);
|
|
6363
6386
|
socket.addEventListener("open", () => {
|
|
6387
|
+
const license = process.env.MARKASSO_LICENSE?.trim();
|
|
6388
|
+
if (license) this.send({
|
|
6389
|
+
type: "auth",
|
|
6390
|
+
license
|
|
6391
|
+
});
|
|
6364
6392
|
this.send({
|
|
6365
6393
|
type: "presence",
|
|
6366
6394
|
name: this.name,
|
|
@@ -6408,10 +6436,14 @@ var LiveLink = class LiveLink {
|
|
|
6408
6436
|
} else if (msg.type === "apply") {
|
|
6409
6437
|
if (isSessionCommand(msg.command)) history.applyRemote(msg.command);
|
|
6410
6438
|
} else if (msg.type === "presence") this.peers = msg.peers;
|
|
6439
|
+
else if (msg.type === "error" && !this.open) {
|
|
6440
|
+
clearTimeout(timer);
|
|
6441
|
+
reject(new LiveError(msg.error === "licence required" ? LICENCE_MESSAGE : `The live room refused to join: ${msg.error}.`));
|
|
6442
|
+
}
|
|
6411
6443
|
});
|
|
6412
|
-
socket.addEventListener("close", () => {
|
|
6444
|
+
socket.addEventListener("close", (event) => {
|
|
6413
6445
|
clearTimeout(timer);
|
|
6414
|
-
if (!this.open) reject(new LiveError("The live room closed the connection."));
|
|
6446
|
+
if (!this.open) reject(new LiveError(event.code === CLOSE_LICENCE_REQUIRED ? LICENCE_MESSAGE : "The live room closed the connection."));
|
|
6415
6447
|
this.open = false;
|
|
6416
6448
|
history.setOnCommand(void 0);
|
|
6417
6449
|
});
|