sayshape-mcp 0.7.0 → 0.8.1

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
@@ -22,22 +22,53 @@ you: "Compare the three phone plans I pasted"
22
22
 
23
23
  In chat apps that stream tool input, the interface builds line by line while the model is still writing it. When the person presses a button with `on=emit:name`, the view sends a message into the conversation naming the action, its value and the interface's current values. The model can then reply or show an updated interface. That's the only way anything leaves an interface: specs can't run code, open links or make requests.
24
24
 
25
- Interfaces match the chat app they're in. The view follows its light or dark mode, and when the app shares its design tokens (MCP Apps hosts pass them as CSS variables) it takes the app's background, text, border and status colors, its fonts and its corner radii. Interfaces use SayShape's Teal theme unless the server is started with another (`--theme`); the theme follows the host's mode and applies to charts through the accent and series color tokens. The model's spec cannot set arbitrary CSS.
25
+ Interfaces match the chat app they're in. The view follows its light or dark mode, and when the app shares its design tokens (MCP Apps hosts pass them as CSS variables) it takes the app's background, text, border and status colors, its fonts and its corner radii. Interfaces use SayShape's System theme unless the server is started with another (`--theme`); the theme follows the host's mode and applies to charts through the accent and series color tokens. The model's spec cannot set arbitrary CSS.
26
26
 
27
27
  Above each interface, at the right, the view can show a slim toolbar:
28
28
 
29
29
  - **Save image** (a download icon), in chat apps that let views download files (MCP Apps' `downloadFile` capability). It saves the interface as it looks now, after anything the person changed, as a sharp PNG (twice the screen's resolution, on the theme's background, without hover or messages) named after the interface's title, ready to paste into an email, a chat or a slide. Nothing is sent to the model.
30
30
  - **Copy text** (a copy icon). With nothing selected, this copies the whole interface as it is now: headings and text as lines, fields as "Label: value", checkboxes as [x] or [ ], and tables and chart data as tab-separated rows that paste straight into Excel or Google Sheets as cells. Buttons are left out and passwords are never copied. Ctrl+C (Cmd+C on a Mac) does the same unless the person is typing in a field. The server asks the chat app for clipboard access; where it isn't given, the view says so. Nothing is sent to the model.
31
31
  - **Save as PDF, Save as PowerPoint and Present**, while a slide deck is showing. See [Slide decks](#slide-decks).
32
- - **A theme selector** for SayShape's Teal, Purple, Blue and Neutral presets, when the server is started with `--theme-picker`. Useful for demos; for a company, set its theme with `--theme` instead.
32
+ - **A theme selector** for SayShape's Teal, Purple, Blue, Neutral, Studio and System presets, when the server is started with `--theme-picker`. Useful for demos; for a company, set its theme with `--theme` instead.
33
33
 
34
- When none is on, there's no toolbar at all. Whoever installs the server chooses, with flags in the chat app's `args`:
34
+ When none is on, there's no toolbar at all. Whoever installs the server chooses, in the settings file or with flags.
35
+
36
+ ### Settings
37
+
38
+ To see what SayShape offers and how it's set, in a terminal:
39
+
40
+ ```bash
41
+ npx -y sayshape-mcp config
42
+ ```
43
+
44
+ It lists every setting in groups (Look, Features, Images, Buttons), with its value and where the value comes from (the default or your settings file), and the file's path. Change one with `config set`, and put it back with `config unset`:
45
+
46
+ ```bash
47
+ npx -y sayshape-mcp config set theme blue
48
+ npx -y sayshape-mcp config set scene on
49
+ npx -y sayshape-mcp config set colors "#e4572e,#2e86ab"
50
+ npx -y sayshape-mcp config unset scene
51
+ ```
52
+
53
+ In a terminal, `config` alone then offers a short numbered edit. `config path` prints where the file is (`~/.config/sayshape/config.json`, or `%APPDATA%\sayshape\config.json` on Windows; `SAYSHAPE_CONFIG` points to another one) and `config reset` deletes it. The server reads the file when it starts, so restart your AI apps after a change.
54
+
55
+ The file is JSON. Its keys are the view flags below without `--`: `theme`, `accent`, `colors`, `model-colors`, `theme-picker`, `chat-look`, `scene`, `behavior`, `layout-first`, `select-text`, `select-touch`, `image-hosts`, `logo`, `save-image`, `copy-text`. On/off settings take `true` or `false` (`"save-image": false` is `--no-save-image`), lists take an array or one comma-separated string, and `"image-hosts": false` allows no images:
56
+
57
+ ```json
58
+ { "theme": "blue", "scene": true, "save-image": false, "colors": ["#e4572e", "#2e86ab"] }
59
+ ```
60
+
61
+ Flags in an app's `args` win over the file (a whole setting at a time: `--accent` replaces the file's `colors`), and `--no-config` ignores it. Server flags (`--http`, `--data`, `--widget-dir` and the rest) belong in the app's setup and aren't in the file. A setting the server can't use (an unknown key, the wrong type, a value its flag would refuse) is skipped with one line on stderr saying how to fix it; the rest still apply and the server still starts. `config set` checks a value the same way before writing, writes atomically, keeps the file's other keys, and never changes a file that isn't valid JSON.
62
+
63
+ ### Flags
64
+
65
+ The same choices as flags in the chat app's `args`, plus the server's own:
35
66
 
36
67
  | Flag | Effect |
37
68
  |---|---|
38
69
  | `--theme-picker` | Show the theme selector (off by default) |
39
- | `--theme teal\|purple\|blue\|neutral\|studio` | The theme interfaces use (default `teal`). `studio` is the Studio look: Inter, rounder corners and an indigo-to-violet accent |
40
- | `--accent "#e4572e"` | A brand color (hex, `#rrggbb` or `#rgb`) for buttons, highlights and charts' first series, laid over the theme. The same as `--colors` with one color: the other five chart series are worked out from it. Text in it must stay readable (4.5:1), and no color manages that on both white and near-black, so it's darkened in light mode or lightened in dark mode where needed; the server says at startup what each mode uses. Without `--accent` or `--colors`, a few known chat apps (Claude, ChatGPT, VS Code, Gemini, Grok) get their own brand color as the accent, unless the person picks a theme in the selector or `--theme` is not the default |
70
+ | `--theme teal\|purple\|blue\|neutral\|studio\|system` | The theme interfaces use (default `system`). `teal` is SayShape's earlier default. `studio` is the Studio look: Inter, rounder corners and an indigo-to-violet accent. `system` is a clean, native-feeling look: a vivid blue and bright system colors, pill buttons, native-style switches and segmented controls, inset grouped lists and continuous corners. In a chat app the app's own background, text colors, font and corner sizes still apply over it |
71
+ | `--accent "#e4572e"` | A brand color (hex, `#rrggbb` or `#rgb`) for buttons, highlights and charts' first series, laid over the theme. The same as `--colors` with one color: the other five chart series are worked out from it. Text in it must stay readable (4.5:1), and no color manages that on both white and near-black, so it's darkened in light mode or lightened in dark mode where needed; the server says at startup what each mode uses. With `--theme teal` and no `--accent` or `--colors`, a few known chat apps (Claude, ChatGPT, VS Code, Gemini, Grok) get their own brand color as the accent, unless the person picks a theme in the selector; every other theme, the default System included, keeps its own accent |
41
72
  | `--colors "#e4572e,#2e86ab,#f2c14e"` | Up to six brand colors, hex, in one quoted argument separated by commas, most important first. The first does what `--accent` does (buttons, highlights, the first chart series); the rest are the next chart series in that order, each made readable (3:1); the series the list does not cover are worked out from the first color, kept quieter so it stays the strongest, and away from the colors used for good and bad. A color too like an earlier one is replaced by a worked-out one. Only the accent and the chart series change: surface, text, lines and the good, warn and bad colors still follow the chat app. A bad entry, an empty one or more than six stops the server at startup and names the problem. Use either `--colors` or `--accent`, not both |
42
73
  | `--no-model-colors` | Take away `show_interface`'s `colors` argument. Without this flag, a model sends `colors` (a list of hex colors, most important first) only when the person, or its instructions, named colors to use; they're drawn over everything above (the server's `--colors`, a theme the person picked, the chat app's color), entries that aren't hex colors are ignored, and the result reminds the model to send the same colors on later calls in the conversation, since nothing is stored. With the flag, the tool is exactly what it was before the argument existed and the view ignores colors sent anyway. Chat apps that can't draw views draw the page in them (see below) and get the same reminder; `--widget-dir` files don't use the argument yet |
43
74
  | `--no-save-image` | Hide Save image (shown by default where the chat app can download) |
@@ -47,10 +78,8 @@ When none is on, there's no toolbar at all. Whoever installs the server chooses,
47
78
  | `--no-chat-look` | Draw interfaces as before the chat look: the theme's background painted behind them, and the view's own fixed sizes. Without it, the chat app's own background shows through (when the app says whether it's light or dark; otherwise the theme's is painted as before), and the engine draws with its chat density (`context: "chat"`): figures about 26 px, card padding about 15 px, 36 px controls, list rows on one line where they fit, tighter gaps and a 12 px gutter. A spec's own `look density=` still wins |
48
79
  | `--scene` | **Experimental.** Turn on scenes: pictures and animations the model paints from shapes, with parts people can press and soft shadows, glow and shine for depth (off by default). Leave it out to turn them off again. |
49
80
  | `--behavior` | **Experimental.** Turn on behavior: things that change by themselves on a timer (a countdown, a simulation) and, together with `--scene`, shapes people drag (off by default). Rules only change the interface's own values; they still can't run code. Chat apps that can't draw views don't get it. |
50
- | `--adaptive-guides` | Accepted and does nothing: this is the default. `show_interface`'s description carries a small map of SayShape in place of the quick start, with the report syntax, so a data report needs no docs call; `sayshape_docs` returns one guide for every capability and element named together (`topics: ["forms", "calculations"]`, `elements: ["slider"]`). The view and `--widget-dir` files draw reports and behavior; the CDN page for text-only clients is offered neither, and its `sayshape_docs` lists only what it can draw. See [adaptive guides](../docs/capabilities.md). |
51
81
  | `--layout-first` | Tell models to write the layout first and the data last: elements, then `state` lines with long lists at the very end (small values a control starts from, like a selected tab, may still go first). The view draws from the first element while the spec streams in, with placeholders for data that hasn't arrived, instead of waiting for a long list to be written. Changes only the guide text in `show_interface`'s description and `sayshape_docs`; off by default, and then the text is exactly what it was. See [the model guide](../docs/model.md#layout-first-while-streaming). |
52
82
  | `--logo https://cdn.example.com/logo.png` | An https image drawn small in the corner of every slide of a deck. Its host is allowed like `--image-hosts`, so the logo loads. See [Slide decks](#slide-decks). |
53
- | `--slides` | Does nothing. Slide decks need no flag; this is accepted so setups written for an earlier version still start. |
54
83
  | `--image-hosts cdn.example.com,*.img.example.com` | The only hosts `image` elements may load from, comma-separated; `*.example.com` allows its subdomains. Left out, images load from the common sites models know addresses on (`COMMON_IMAGE_HOSTS`). See [Images](#images). |
55
84
  | `--no-image-hosts` | Allow no images from anywhere. Not with `--image-hosts` |
56
85
  | `--widget-dir <folder>` | For chat apps that can't draw MCP Apps views but can show a widget made from a file: write each interface there as one self-contained file (stdio only; refused with `--http`). Off by default. See [Chat apps that show widgets from files](#chat-apps-that-show-widgets-from-files). |
@@ -73,8 +102,8 @@ Then ask for something that moves or can be pressed: *"Draw a traffic light I ca
73
102
 
74
103
  `deck` and `slide` are ordinary elements: the quick start in `show_interface`'s description lists them ("a presentation or slide deck, one idea per slide: `deck bind=page`", and "a deck at the top level, not inside a card; a slide per idea"), and `sayshape_docs` gives their props and an example like any other element. Ask for *"A short deck for our Q3 business review"* and the model writes a deck of 16:9 slides that the view shows one at a time, with arrows, dots, Left and Right, and a swipe. The language is described in [the language reference](../docs/language.md#slide-decks).
75
104
 
76
- - **No flag.** Earlier versions needed `--slides`. It is still accepted and does nothing, so existing setups keep starting.
77
- - **`--logo <https url>`** draws a small logo in the bottom left corner of every slide. The address must be https with a plain host; the host is added to `--image-hosts` (and to the view's content security policy), so it loads. It works on its own, without `--slides`.
105
+ - **No flag.** Slide decks are always on.
106
+ - **`--logo <https url>`** draws a small logo in the bottom left corner of every slide. The address must be https with a plain host; the host is added to `--image-hosts` (and to the view's content security policy), so it loads. It works on its own.
78
107
  - **Files.** While a deck is showing, and where the chat app lets views download files (and not with `--no-save-image`), the download button saves a **PDF** and a second button saves a **PowerPoint file**, one page per slide (up to 60). Each page is a picture of the slide as the engine draws it, after anything the person changed, so the file looks exactly like the chat and can't be edited. Nothing is sent to the model.
79
108
  - **Present.** Where the chat app has a full-screen mode, a Present button shows the deck at the largest size that fits, and puts it back.
80
109
  - **Text-only clients get a sentence, not a page.** Their page loads an engine pinned at least two weeks behind releases (`PAGE_ENGINE_VERSION`, see [releasing](../docs/releasing.md#the-engine-version-the-text-only-page-loads)), which has no slides yet. So `show_interface` checks the deck as usual and answers with one plain sentence: the deck is written correctly, but this app can't show slide decks yet, and the person needs a chat app that draws SayShape views. A server started with `--widget-dir` is the exception: its file carries this server's own engine, so a deck draws there.
@@ -93,9 +122,9 @@ Each image is requested from its host by the person's browser, so that host sees
93
122
 
94
123
  Coding agents and other text-only clients (Claude Code, Codex, Antigravity and others) call `show_interface` but can't show MCP Apps views. When a client connects without announcing MCP Apps support (the `io.modelcontextprotocol/ui` capability), and the spec has nothing to fix, `show_interface`'s text result carries a small, complete HTML page instead, with two sentences telling the model what to do with it: publish it as a page if it has a tool for that, or save it as an `.html` file and give the person its path to open in a browser. The server itself writes no files. For these clients the result is text alone, with no structured part: the structured part is for the view, and some clients (Claude Code is one) give their model the structured part in place of the text, which would lose the page. Clients that draw views get exactly what they got before.
95
124
 
96
- The page is a few kilobytes plus the spec: a canvas, the engine loaded from jsDelivr (`sayshape@<version>/dist/sayshape.global.js`, and the map's own script when the spec has a map), and the spec embedded as JSON with `<` escaped, so nothing in it can end the script. It follows light and dark mode, and a `data-theme="light"` or `"dark"` on its root element; its background is the engine theme's own; and it fits a phone with no sideways scrolling.
125
+ The page is a few kilobytes plus the spec: a canvas, the engine loaded from jsDelivr (`sayshape@<version>/dist/sayshape.global.js`), and the spec embedded as JSON with `<` escaped, so nothing in it can end the script. It follows light and dark mode, and a `data-theme="light"` or `"dark"` on its root element; its background is the engine theme's own; and it fits a phone with no sideways scrolling.
97
126
 
98
- Brand colors reach the page too. The server works out the final colors for light and dark itself, from the `colors` argument if the model sent it, else `--colors` or `--accent`, and writes the accent, the text on it, the map's highlight and the six chart series into the page as values; the page lays them over the engine's own themes, so the pinned engine needs to know nothing about color lists. When the model's colors were used, the result ends with the same reminder the view's results do, outside the page, to send them again on later calls. Without any colors the page is exactly what it was.
127
+ Brand colors reach the page too. The server works out the final colors for light and dark itself, from the `colors` argument if the model sent it, else `--colors` or `--accent`, and writes the accent, the text on it, the highlight and the six chart series into the page as values; the page lays them over the engine's own themes, so the pinned engine needs to know nothing about color lists. When the model's colors were used, the result ends with the same reminder the view's results do, outside the page, to send them again on later calls. Without any colors the page is exactly what it was.
99
128
 
100
129
  A page outside the chat has no conversation to send `emit:` actions to, so for these clients only:
101
130
 
@@ -127,10 +156,10 @@ Start the server with `--widget-dir <folder>` and, for a client that announces n
127
156
  "sayshape": { "command": "node", "args": ["/full/path/to/sayshape/mcp/dist/server.js", "--widget-dir", "/Users/you/sayshape-widgets"] }
128
157
  ```
129
158
 
130
- - **One file, made from this server's own engine.** `npm run build` builds the engine from this repository's `src/` (`scripts/pack-widget-engine.mjs`: the same entry as the page's CDN build, built from this repository's `src/`, so it has the slide elements even while the page's pinned older engine doesn't), gzips it with Node's zlib and ships it in the package as `dist/widget-engine.json`, so the file always matches the server that checked the spec. The fragment holds one wrapping `<div>` (full width, at most 760 px, with its own font), a canvas, the spec (as JSON with `<` escaped, so `</script>` in a spec stays inert), the packed engine and a loader: it decodes and unpacks the engine with `DecompressionStream` and runs it as a `blob:` script, so nothing is fetched and the engine still can't run anything a spec says. A spec that mentions a browser storage name has its first letter escaped, so the words never appear in the file. Where the engine can't be unpacked, a short plain note shows in place of the canvas. A plain interface makes a file of about 260 KB; one with a map about 480 KB (the map's outlines are a second packed script). If a file would reach 1 MB, none is written and the result says why.
131
- - **Where the file shows "The SayShape engine didn't start in this chat app", add `--widget-inline`.** That sentence means the app showed the file and could unpack the engine but refused to run it as a `blob:` script (Antigravity's embeds do; Muse doesn't). With the flag the engine is written into the file as it is, in a `<script>` of its own before the loader, so there is nothing to unpack and nothing is run from a URL of any kind. A plain interface then makes a larger file, and one with a map may pass 1 MB and be refused with the usual message.
159
+ - **One file, made from this server's own engine.** `npm run build` builds the engine from this repository's `src/` (`scripts/pack-widget-engine.mjs`: the same entry as the page's CDN build, built from this repository's `src/`, so it has the slide elements even while the page's pinned older engine doesn't), gzips it with Node's zlib and ships it in the package as `dist/widget-engine.json`, so the file always matches the server that checked the spec. The fragment holds one wrapping `<div>` (full width, at most 760 px, with its own font), a canvas, the spec (as JSON with `<` escaped, so `</script>` in a spec stays inert), the packed engine and a loader: it decodes and unpacks the engine with `DecompressionStream` and runs it as a `blob:` script, so nothing is fetched and the engine still can't run anything a spec says. A spec that mentions a browser storage name has its first letter escaped, so the words never appear in the file. Where the engine can't be unpacked, a short plain note shows in place of the canvas. A plain interface makes a file of about 260 KB. If a file would reach 1 MB, none is written and the result says why.
160
+ - **Where the file shows "The SayShape engine didn't start in this chat app", add `--widget-inline`.** That sentence means the app showed the file and could unpack the engine but refused to run it as a `blob:` script (Antigravity's embeds do; Muse doesn't). With the flag the engine is written into the file as it is, in a `<script>` of its own before the loader, so there is nothing to unpack and nothing is run from a URL of any kind. A plain interface then makes a larger file, which may pass 1 MB and be refused with the usual message.
132
161
  - **The name is a hash** of the spec and everything that changes the file (the settings below and the engine), so the same interface reuses one file. The folder keeps the newest 50 (`sayshape-<16 hex digits>.html`); older ones are deleted, and nothing else in the folder is ever touched.
133
- - **The server's settings reach the file.** `--theme`, `--accent` or `--colors`, `--image-hosts` (and `--logo`), `--scene` and `--behavior` all apply (`--slides` is accepted and does nothing: decks need no flag), and unlike the page, behavior and decks work, because the file carries this server's engine and not an older pinned one. (Images from other hosts can't load in a sandbox like Muse's, so an `image` shows its description there.) Fonts: the file draws in the system font where Instrument Sans or Inter isn't installed.
162
+ - **The server's settings reach the file.** `--theme`, `--accent` or `--colors`, `--image-hosts` (and `--logo`), `--scene` and `--behavior` all apply, and unlike the page, behavior and decks work, because the file carries this server's engine and not an older pinned one. (Images from other hosts can't load in a sandbox like Muse's, so an `image` shows its description there.) Fonts: the file draws in the system font where Instrument Sans or Inter isn't installed.
134
163
  - **Light and dark** follow `data-theme="light|dark"` on the root element and the system's `prefers-color-scheme`, and changes to either.
135
164
  - **As on the page:** interfaces that load datasets are refused with the same message, `emit:` is refused and removed by the model first (a widget has no chat to send to yet; see `--widget-host` below for the way around that), and links pressed in `rich=true` text open in a new tab (https only).
136
165
 
@@ -228,7 +257,23 @@ This is a **source-level integration API**, not yet a published SDK. SayShape do
228
257
 
229
258
  ## Install
230
259
 
231
- You need Node.js 20 or later (22.13 or later for `--data`). `npx` downloads the server from npm the first time.
260
+ You need Node.js 20 or later (22.13 or later for `--data`). In a terminal:
261
+
262
+ ```bash
263
+ npx -y sayshape-mcp install
264
+ ```
265
+
266
+ It finds the AI apps on this computer (Claude Desktop, Claude Code, Codex, Cursor, VS Code with GitHub Copilot, Antigravity), lists them, asks which to set up (all, by default), and adds a `sayshape` server that runs `npx -y sayshape-mcp` to each. Then it says what it changed and what to do next, usually restarting the app.
267
+
268
+ - `install cursor` sets up one app (`claude-desktop`, `claude-code`, `codex`, `cursor`, `vscode`, `antigravity`); `--yes` skips the question.
269
+ - Config files are parsed and merged, never rewritten from scratch: other servers and settings stay, the original is saved next to it (`….sayshape-backup`) before the first change, and a file that isn't valid JSON (or a `sayshape` entry of your own, with your own flags) is left alone with a message. Running it again says it's already set up.
270
+ - Claude Code gets it for every folder (`claude mcp add --scope user`), and Codex through `codex mcp add`.
271
+ - `npx -y sayshape-mcp uninstall` takes out the `sayshape` entry and nothing else.
272
+ - Change settings any time with `npx -y sayshape-mcp config` (see [Settings](#settings)).
273
+
274
+ Where each app keeps its settings (from each app's docs): Claude Desktop, `claude_desktop_config.json` in `~/Library/Application Support/Claude`, `%APPDATA%\Claude` or `~/.config/Claude`; Cursor, `~/.cursor/mcp.json`; VS Code, GitHub Copilot's user file `~/.copilot/mcp-config.json` (or in `$COPILOT_HOME`); Antigravity, `~/.gemini/config/mcp_config.json`.
275
+
276
+ To set it up by hand instead, or in another app, add the command `npx -y sayshape-mcp` as an MCP server.
232
277
 
233
278
  **Claude Desktop:** Settings → Developer → Edit Config, then add:
234
279
 
@@ -252,7 +297,9 @@ Quit Claude Desktop completely (Cmd+Q) and reopen it. If it can't find `npx`, us
252
297
  }
253
298
  ```
254
299
 
255
- **Apps that connect to a URL** (custom connectors in Claude on the web, ChatGPT developer mode): run it over HTTP and put it behind HTTPS (a reverse proxy or a tunnel). By default it listens only on 127.0.0.1; to host it for others, see [Host it publicly](#host-it-publicly).
300
+ **Claude on the web and ChatGPT** connect to an address, not a program on your computer: add SayShape's public server, `https://mcp.sayshape.workers.dev/mcp`, as a custom connector (Claude) or an app in developer mode (ChatGPT). [The docs](https://premmannava.github.io/sayshape/docs/integration/mcp.html#hosted) say where.
301
+
302
+ **To serve it at your own address**: run it over HTTP and put it behind HTTPS (a reverse proxy or a tunnel). By default it listens only on 127.0.0.1; to host it for others, see [Host it publicly](#host-it-publicly).
256
303
 
257
304
  ```bash
258
305
  npx -y sayshape-mcp --http 3001 # http://127.0.0.1:3001/mcp
@@ -275,7 +322,7 @@ To give Claude, ChatGPT and other chat apps a permanent HTTPS address, run the H
275
322
  Start it with an exact version, never `@latest`, so what runs is what you checked:
276
323
 
277
324
  ```bash
278
- npx -y sayshape-mcp@0.7.0 --http --host 0.0.0.0 --trust-proxy
325
+ npx -y sayshape-mcp@0.8.1 --http --host 0.0.0.0 --trust-proxy
279
326
  ```
280
327
 
281
328
  | | |