slatebox-mcp 0.1.0 → 0.3.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Slatebox LLC and Slatebox contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,171 @@
1
- # Slatebox MCP
1
+ # Slatebox exec: MCP server and CLI
2
2
 
3
- Authenticated MCP tools for reading and editing the slates you can access in Slatebox.
3
+ **Slatebox: the free, open-source team canvas.** Mind maps, diagrams, project plans and presentations, drawn by your assistant and edited live with your team. An open-source alternative to whiteboard tools such as Miro. MIT licensed. The canvas is free. On Slatebox Cloud, AI comes with Slatebox Pro; a self-hosted Slatebox can use its own AI key.
4
4
 
5
- Create a token under **Profile → Developer**, then configure an MCP client to run:
5
+ *Not affiliated with or endorsed by Miro. Miro is a trademark of its owner.*
6
+
7
+ **Connect without installing anything:** add `https://app.slatebox.com/mcp` as a remote MCP server (a custom connector) in your assistant. It signs you in to Slatebox and asks which permissions to give it. Your own Slatebox serves the same endpoint at `/mcp`. Install this package when you want the server or the `slatebox` command on your own machine. [Setup for Claude, ChatGPT and other clients](https://docs.slatebox.com/developers/slateboxapi/mcp/)
8
+
9
+ Agents create and edit Slatebox slates (mind maps, flowcharts, diagrams, project plans, slides and boards) by running a short script, or by calling one tool per task. This package gives them two ways to do it:
10
+
11
+ - `slatebox-mcp`, an MCP server. **`exec`** runs a JavaScript or TypeScript script, and **`describe`** explains the typed client the script uses. Beside them it lists one typed tool per client method, such as `create_slate`, `import_mermaid`, `get_slate`, `edit_slate` and `export_mermaid`, four prompts (mind map, flowchart, project plan, presentation) and resources (the client's types and guide, and any slate as JSON or Mermaid).
12
+ - `slatebox`, a command that runs the same scripts from a terminal.
13
+
14
+ Inside a script, the global `slatebox` is a typed client with one method for each thing your token may do, such as `slatebox.slates.get({ shareId })` and `slatebox.slates.applyOperations({ shareId, plan })`. The client is generated from the Slatebox action registry, so new Slatebox actions appear in it without a new tool.
15
+
16
+ Every call a script makes is checked as if you made it yourself: token permissions, sharing, revisions, workshop rules, preview or save, rate limits and the audit record all apply.
17
+
18
+ The typed tools are generated from the same client: each one is an `exec` script of exactly one call (`get_slate({shareId})` runs `return await slatebox.slates.get(...)`), so it meets exactly the checks a script meets, and a held change is confirmed the same way (call the tool again with `confirm` and the `idempotencyKey`). `exec` is always listed. To list only `exec` and `describe`, start the server with `--typed-tools off` or set `SLATEBOX_MCP_TYPED_TOOLS=off`; the hosted `/mcp` endpoint reads the same variable.
19
+
20
+ ## Where your script runs: no sandbox
21
+
22
+ **This package runs scripts on your own machine, in its own process, with your rights. There is no sandbox.** A script can do anything a program you start can do: read your files, use your network and read the process memory, which holds your token. Approve an agent's `exec` call as you would approve a shell command it wants to run.
23
+
24
+ The script runs in a child process of its own, so that a stuck script can be killed after 30 seconds, its output is read as logs and never reaches the MCP stream, and a crash ends only that process. The child starts with an empty environment. None of this is a security boundary: the child has your rights.
25
+
26
+ **What the rules cover on your machine.** The rules above (holding deletes, large text rewrites, changes to other people's notes and wider sharing for your confirmation; the call, note and operation caps; keeping token management out of reach; the run record) apply to every call the script makes through `slatebox`. They are enforced by your Slatebox, not by this package. Because there is no sandbox, a script can also step outside `slatebox`: it can read your token from this process and call the Slatebox API directly, or do anything else your account allows. Such calls are checked as ordinary API calls (token permissions, sharing, rate limits), and your Slatebox still holds a direct call by an agent token that deletes notes or workshop cards, changes someone else's notes, rewrites many notes' text or widens access, until it is sent again with the `Slatebox-Confirm` header; the run record does not list them. On a Slatebox server (`--remote`, `POST /api/v1/exec`, the hosted `/mcp` endpoint, the in-app conversation) a script has no way out of `slatebox`, so every rule holds for everything it does.
27
+
28
+ The confirmation rule for wider sharing looks at one script at a time: it holds a script that reads a slate and then writes to a slate more people can see. Text that an agent carries from one script to the next is not tracked.
29
+
30
+ If you want a script to run on your Slatebox instead, in its sealed runner with no network, no files and no secrets, use `slatebox exec --remote`, the HTTP route `POST /api/v1/exec`, or your instance's hosted MCP endpoint at `/mcp`.
31
+
32
+ ## Install
33
+
34
+ Use Node.js 22.13 or later. Download the archive and checksum from the Slatebox docs. The archive includes the JavaScript source of both commands, the generated client files and the MIT license.
35
+
36
+ ```sh
37
+ curl -fLO https://docs.slatebox.com/assets/downloads/slatebox-mcp-0.3.2.tgz
38
+ curl -fLO https://docs.slatebox.com/assets/downloads/slatebox-mcp-0.3.2.tgz.sha256
39
+ shasum -a 256 -c slatebox-mcp-0.3.2.tgz.sha256
40
+ npm install --global ./slatebox-mcp-0.3.2.tgz
41
+ slatebox help
42
+ ```
43
+
44
+ On Linux you can also verify the checksum with `sha256sum -c slatebox-mcp-0.3.2.tgz.sha256`. npm installs the public MCP SDK.
45
+
46
+ Open **Profile → Developer access** in your Slatebox account and create a token. Supply it in the `SLATEBOX_API_TOKEN` environment variable. Set `SLATEBOX_BASE_URL`, or pass `--base-url`, to your own instance's origin when self-hosting. The default is `https://app.slatebox.com`, Slatebox Cloud, which serves the API at `/api/v1` and the hosted MCP endpoint at `/mcp`.
47
+
48
+ ## Use an MCP client
49
+
50
+ Choose a local stdio server in your MCP client, set its command to the installed `slatebox-mcp` executable and pass `SLATEBOX_API_TOKEN` through the client's secret or environment settings. If the client runs outside your shell, supply the full path printed by `command -v slatebox-mcp`.
51
+
52
+ ```json
53
+ { "mcpServers": { "slatebox": { "command": "slatebox-mcp", "env": { "SLATEBOX_API_TOKEN": "…", "SLATEBOX_BASE_URL": "https://slatebox.example.com" } } } }
54
+ ```
55
+
56
+ For a client that connects by URL, start `slatebox-mcp --http`. It listens at `http://127.0.0.1:3917/mcp` (change the port with `--port`). It listens on 127.0.0.1 only, refuses requests whose `Host` or `Origin` is not loopback, and answers only requests that send the token it was started with as `Authorization: Bearer <token>`. Without these rules, any program or web page that could reach the port could run code as you.
57
+
58
+ The agent calls `describe` to learn the client, then `exec` with:
59
+
60
+ | Field | Meaning |
61
+ |---|---|
62
+ | `intent` | One sentence a person can approve: what the script does |
63
+ | `code` | A JavaScript or TypeScript function body. Top-level `await` and `return` work; return a small JSON value |
64
+ | `mode` | `save` (the default) or `preview`, which previews every write and saves nothing: each write is sent as a preview, and a write that cannot be previewed is refused |
65
+ | `confirm` | The confirmation id from a `confirmation_required` result, once the person agreed |
66
+ | `idempotencyKey` | Reuse it to retry or confirm the same script: its saved calls replay instead of repeating |
67
+
68
+ For example:
69
+
70
+ ```js
71
+ const shareId = "the-share-id";
72
+ const { revision } = await slatebox.slates.get({ shareId });
73
+ return await slatebox.slates.applyOperations({ shareId, expectedRevision: revision, mode: "preview", plan: {
74
+ message: "Added a review step",
75
+ operations: [{ kind: "add_nodes", count: 1, text: "Review", placement: { direction: "right" } }],
76
+ } });
77
+ ```
78
+
79
+ Every edit names the revision it was made on: pass the `revision` that `slates.get` returned as `expectedRevision` with a canvas plan (a workshop or map edit puts `workshop.revision` in its operation instead). Without it the call is refused with `invalid_request`; with it, the edit is refused with `slate_changed` only when a note or setting it changes was changed after that revision.
80
+
81
+ The result has a `status` of `completed`, `failed` or `confirmation_required`, the returned `result`, the script's `logs`, every call it made with its outcome in `calls`, any `error` with its line, and `usage`. A method that fails throws `SlateboxError` with `code`, `status` and `details`.
82
+
83
+ ## Edit a workshop
84
+
85
+ A workshop takes the edits people make, by the rules they meet on the canvas. Send one `workshop_edits` operation with 1 to 50 edits; they apply in order, all or none. Name a card or lane by its id (`{ id }`) or by what people call it ("the Proposal stage"). `workshop.edits` in `slates.get` lists the edits that board takes.
86
+
87
+ ```js
88
+ const shareId = "the-share-id";
89
+ const { workshop } = await slatebox.slates.get({ shareId });
90
+ const saved = await slatebox.slates.applyOperations({ shareId, plan: {
91
+ message: "Added a card and moved Gamma on",
92
+ operations: [{ kind: "workshop_edits", expectedRevision: workshop.revision, edits: [
93
+ { kind: "add_card", lane: "Later", label: "Delta" },
94
+ { kind: "move_card", card: "Gamma", lane: "Later" },
95
+ ] }],
96
+ } });
97
+ ```
98
+
99
+ A refused edit throws `edit_refused` with the sentence a person would see (`details.reason`), which edit it was (`details.editIndex`), the lanes a card may go to (`details.legalLaneIds`) and the board as it stands; nothing is saved. Adding, moving and renaming save at once. An edit that removes a card, a lane, a dependency or an outcome is held for the person to agree, like deleting notes.
100
+
101
+ A saved workshop edit answers with a `receiptId`. `{ kind: "undo_workshop_edit", receiptId, expectedRevision }` puts the board back as it was before that edit, only while nothing has changed since; otherwise it is refused with `slate_changed` and the board as it stands.
102
+
103
+ ## Show people what your agent is doing
104
+
105
+ Everyone who can open a slate sees your run as a named pointer: "Ada's agent", or "Ada's agent · Your client" when your MCP client reports its name. The pointer moves to what each save changes. Show them your plan, and tick it as you go:
106
+
107
+ ```js
108
+ await slatebox.presence.plan({ shareId, steps: ["Read the interview notes", "Draft a brief", "Map the new signup flow"] });
109
+ // ... read and save ...
110
+ await slatebox.presence.step({ shareId, index: 0, status: "done" }); // the next step starts
111
+ ```
112
+
113
+ A plan has 1 to 8 steps of up to 80 plain characters. A run sets its plan at most 3 times and ticks steps at most 40 times. When the run ends, the step under way is done (or marked stopped if the run failed), and the pointer fades a few seconds later. A preview run shows nothing.
114
+
115
+ ## Confirm before save
116
+
117
+ Your Slatebox holds a save, and the run ends with `confirmation_required`, when a script deletes notes or workshop cards, rewrites more than 10 notes' text in all (counted over the whole script, on every slate it writes to), changes notes someone else wrote, or makes content visible to more people. Calls before the held one have saved. The result lists the reasons. To save, run the same code again with `confirm` set to the confirmation id and the same `idempotencyKey`. A confirmation expires after 10 minutes and works once.
118
+
119
+ This is a check with a record, not an approval system: an agent you allow to run `exec` without asking can also confirm without asking.
120
+
121
+ ## Use the terminal
6
122
 
7
123
  ```sh
8
- SLATEBOX_API_TOKEN=sbx_... npx slatebox-mcp --base-url https://test.slatebox.com
124
+ slatebox exec script.js
125
+ slatebox exec - < script.ts
126
+ slatebox exec -e 'return (await slatebox.slates.get({ shareId: "the-share-id" })).nodeCount'
127
+ slatebox exec script.js --preview
128
+ slatebox exec script.js --remote
129
+ slatebox describe
130
+ slatebox describe --method slates.applyOperations
131
+ ```
132
+
133
+ Before a local run sends anything, it asks your Slatebox (`GET /api/v1/instance`) whether it runs exec scripts. One that does not is sent nothing, and the run fails with `exec_unavailable`: such an instance would take the calls as ordinary API calls, with no preview and no confirmation.
134
+
135
+ Without `--json`, the command writes one summary line to standard error and the returned value as JSON to standard output. With `--json` it writes the whole result. When a save is held, a terminal asks `Save anyway? [y/N]`; elsewhere the command prints the exact command that confirms and exits 6.
136
+
137
+ | Exit code | Meaning |
138
+ |---|---|
139
+ | 0 | The script completed |
140
+ | 1 | Any other failure |
141
+ | 2 | Usage: the command or its options are not valid |
142
+ | 3 | Sign-in: the token is missing, expired or revoked (`--remote`) |
143
+ | 4 | Access: the route or slate is not available to this token (`--remote`) |
144
+ | 5 | Refused: a conflict or a refusal of the whole run (`--remote`) |
145
+ | 6 | Confirmation required |
146
+ | 7 | The script failed |
147
+
148
+ ## Use the client in your own code
149
+
150
+ ```js
151
+ import { createClient } from "slatebox-mcp/client";
152
+ const slatebox = createClient({ baseUrl: "https://slatebox.example.com", token: process.env.SLATEBOX_API_TOKEN });
153
+ const slate = await slatebox.slates.get({ shareId: "the-share-id" });
9
154
  ```
10
155
 
11
- For production, omit `--base-url` or set `SLATEBOX_BASE_URL=https://app.slatebox.com`.
12
- The token is sent only as a Bearer token to the configured Slatebox origin.
156
+ Outside a script, each call is an ordinary API call. Pass `{ idempotencyKey }` as a second argument to retry a save safely. The types are in `generated/slatebox.d.ts`.
157
+
158
+ ## Mermaid
159
+
160
+ Any slate you can read comes out as Mermaid, and Mermaid goes in as real notes and lines:
161
+
162
+ ```js
163
+ const { mermaid, markdown } = await slatebox.slates.exportMermaid({ shareId }); // format: auto, flowchart, mindmap or gantt
164
+ await slatebox.slates.importMermaid({ shareId, mermaid: "flowchart LR\n idea --> plan" }); // leave out shareId for a new slate
165
+ ```
166
+
167
+ A flowchart, mind map or Gantt chart is drawn; another kind of diagram is refused with `mermaid_unsupported`. A public slate's Mermaid is also plain text at `/slates/<shareId>.mmd` (and `.md`), with no token, for a README or a doc.
168
+
169
+ ## Limits
13
170
 
14
- Tools include `get_slate`, `apply_slate_operations`, `add_nodes`, `update_nodes`,
15
- `delete_nodes`, `connect_nodes`, `disconnect_nodes`, `update_connections`,
16
- `arrange_nodes`, and `update_slate`. Mutating tools accept `dry_run` and
17
- `idempotency_key`. The server validates the same operation plan used by Slatebox
18
- chat before saving changes.
171
+ A script may make 64 calls and run for 30 seconds. Its result is cut at 40,000 characters of JSON and its logs at 16 KiB. Call `describe` for the full list your instance publishes.