sayshape-mcp 0.2.2 → 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.
package/README.md CHANGED
@@ -27,7 +27,8 @@ Interfaces match the chat app they're in. The view follows its light or dark mod
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
- - **Copy text** (a copy icon). A canvas has no text to select, so 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.
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
+ - **Save as PDF, Save as PowerPoint and Present**, while a slide deck is showing. See [Slide decks](#slide-decks).
31
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
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`:
@@ -36,13 +37,22 @@ When none is on, there's no toolbar at all. Whoever installs the server chooses,
36
37
  |---|---|
37
38
  | `--theme-picker` | Show the theme selector (off by default) |
38
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 |
39
- | `--accent "#e4572e"` | A brand color (hex, `#rrggbb` or `#rgb`) for buttons, highlights and charts' first series, laid over the theme. 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 |
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 |
41
+ | `--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
+ | `--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 |
40
43
  | `--no-save-image` | Hide Save image (shown by default where the chat app can download) |
41
44
  | `--no-copy-text` | Hide Copy text, and leave Ctrl+C alone (shown by default) |
45
+ | `--select-touch` | Let a long press on a touch screen select the word under the finger, with the phone's own handles and Copy menu. Off by default until it has been checked on real phones; `--no-select-touch` says off explicitly. Mouse and pen selection are unaffected |
46
+ | `--no-select-text` | No invisible text layer: words can't be selected by dragging or found with Ctrl/Cmd+F, and nothing extra is added to the page (on by default) |
42
47
  | `--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. |
43
48
  | `--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. |
44
- | `--image-hosts cdn.example.com,*.img.example.com` | Hosts `image` elements may load from, comma-separated; `*.example.com` allows its subdomains. None by default, so no images show. See [Images](#images). |
49
+ | `--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). |
50
+ | `--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). |
51
+ | `--slides` | Does nothing. Slide decks need no flag; this is accepted so setups written for an earlier version still start. |
52
+ | `--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). |
53
+ | `--no-image-hosts` | Allow no images from anywhere. Not with `--image-hosts` |
45
54
  | `--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). |
55
+ | `--widget-inline` | With `--widget-dir` only: write the engine into each file as plain script text, not packed. For chat apps that show the file but say the engine didn't start, because their sandbox runs a file's own scripts and no `blob:` script (Antigravity's embeds). Files are about twice the size. |
46
56
  | `--widget-host <name>` | With `--widget-dir` only: hook that chat app's adapter into every file, so `emit:` presses (and the interface's state) are saved for the model's next turn. Names: `muse`. An unknown name, or no `--widget-dir`, stops the server with a message. Off by default. See [Adapting a file to a chat app](#adapting-a-file-to-a-chat-app---widget-host). |
47
57
 
48
58
  ```json
@@ -57,15 +67,25 @@ With both experimental features on:
57
67
 
58
68
  Then ask for something that moves or can be pressed: *"Draw a traffic light I can press, where the active light glows"*, *"Draw a shiny ball bouncing with a shadow on the floor"* or *"A 30-second countdown I can pause"*. Both features may still change between releases.
59
69
 
70
+ ### Slide decks
71
+
72
+ `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).
73
+
74
+ - **No flag.** Earlier versions needed `--slides`. It is still accepted and does nothing, so existing setups keep starting.
75
+ - **`--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`.
76
+ - **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.
77
+ - **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.
78
+ - **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.
79
+
60
80
  ### Images
61
81
 
62
- The view has no website of its own, so an `image` only loads from a host you list with `--image-hosts`, usually your company's image CDN:
82
+ The view has no website of its own, so an `image` only loads from a host on its list. By default that is `COMMON_IMAGE_HOSTS`, the sites models know image addresses on (Wikimedia, Unsplash, Picsum, flag, poster and cover sites and the like; the list and the rule for what may be on it are in `src/images.ts`). `--image-hosts` replaces it with only your hosts, usually your company's image CDN, and `--no-image-hosts` allows none, so no images show:
63
83
 
64
84
  ```json
65
85
  "sayshape": { "command": "node", "args": ["/full/path/to/sayshape/mcp/dist/server.js", "--image-hosts", "cdn.acme.com,images.unsplash.com"] }
66
86
  ```
67
87
 
68
- The one list does three things: the view's engine loads from those hosts and no others, the server asks the chat app to allow them in the view's Content Security Policy (MCP Apps `resourceDomains`), and the model is told which hosts work, so it doesn't invent URLs elsewhere. Images must be https, and the host must send CORS headers (`Access-Control-Allow-Origin`), as image CDNs do, because the view keeps its canvas readable for Save image and Copy text. An image that can't load shows its description instead. Some chat apps may not honour a view's CSP request; then images show their descriptions there.
88
+ Each image is requested from its host by the person's browser, so that host sees their IP address. The one list does three things: the view's engine loads from those hosts and no others, the server asks the chat app to allow them in the view's Content Security Policy (MCP Apps `resourceDomains`), and the model is told which hosts work, so it doesn't invent URLs elsewhere. Images must be https, and the host must send CORS headers (`Access-Control-Allow-Origin`), as image CDNs do, because the view keeps its canvas readable for Save image and Copy text. An image that can't load shows its description instead. Some chat apps may not honour a view's CSP request; then images show their descriptions there.
69
89
 
70
90
  ## In chat apps that can't draw interfaces
71
91
 
@@ -73,6 +93,8 @@ Coding agents and other text-only clients (Claude Code, Codex, Antigravity and o
73
93
 
74
94
  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.
75
95
 
96
+ 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.
97
+
76
98
  A page outside the chat has no conversation to send `emit:` actions to, so for these clients only:
77
99
 
78
100
  - **The model is told not to use `emit:`.** Their quick start (in `show_interface`'s description and `sayshape_docs` with nothing named) says to leave it out and ask the person to reply in the chat instead.
@@ -86,7 +108,7 @@ What doesn't work there:
86
108
  - **Save image and Copy text** aren't on the page.
87
109
  - **It needs internet access** to load the engine from the CDN; without it, or before the pinned version is on the CDN, the page names the engine version that didn't load.
88
110
  - **Interfaces that load datasets** (`--data`, `--mcp-result`) can't be shown: the page has no way to fetch rows, and the rows never go through the conversation. The model is told so and answers in text.
89
- - It uses the default Teal light and dark themes; `--theme`, `--theme-picker` and the chat app's own colors and fonts apply only to the view.
111
+ - It uses SayShape's default look in light and dark; `--theme`, `--theme-picker` and the chat app's own colors and fonts apply only to the view. Brand colors (`--colors`, `--accent` and the `colors` argument) are the one thing from them the page does use.
90
112
  - The engine version is pinned and moves at releases, so the page can be one release behind the server: an element added in the newest release may not draw there yet. ([Why](https://github.com/premmannava/sayshape/blob/main/docs/releasing.md#the-engine-version-the-text-only-page-loads).)
91
113
  - For chat apps whose sandbox blocks the CDN but can show a widget from a file, see [`--widget-dir`](#chat-apps-that-show-widgets-from-files).
92
114
  - In `--http` mode the server makes a new server for every request and never sees what the client announced, so it always answers as for a client that draws views.
@@ -103,9 +125,10 @@ Start the server with `--widget-dir <folder>` and, for a client that announces n
103
125
  "sayshape": { "command": "node", "args": ["/full/path/to/sayshape/mcp/dist/server.js", "--widget-dir", "/Users/you/sayshape-widgets"] }
104
126
  ```
105
127
 
106
- - **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, plus the slide elements), 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.
128
+ - **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.
129
+ - **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.
107
130
  - **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.
108
- - **The server's settings reach the file.** `--theme`, `--accent`, `--image-hosts` (and `--logo`), `--scene`, `--behavior` and `--slides` 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.
131
+ - **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.
109
132
  - **Light and dark** follow `data-theme="light|dark"` on the root element and the system's `prefers-color-scheme`, and changes to either.
110
133
  - **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).
111
134
 
@@ -119,7 +142,7 @@ The fragment builder (`mcp/src/widget-file.ts`) takes a `host` option: the sourc
119
142
 
120
143
  What changes with it, for clients that get a file:
121
144
 
122
- - **The file carries the adapter.** The Muse adapter keeps `emit:` actions in a short list in the widget's state bridge, next to the interface's own state (saved without passwords, and skipped when it is large), and puts that state back when the widget is mounted again. If `--theme` or `--accent` was given, the adapter ignores the chat app's colors and the interface keeps its own; otherwise it follows the app's.
145
+ - **The file carries the adapter.** The Muse adapter keeps `emit:` actions in a short list in the widget's state bridge, next to the interface's own state (saved without passwords, and skipped when it is large), and puts that state back when the widget is mounted again. If `--theme`, `--accent` or `--colors` was given, the adapter ignores the chat app's colors and the interface keeps its own; otherwise it follows the app's.
123
146
  - **`emit:` is allowed.** The quick start no longer says not to use it, and a line with `emit:` is no longer a problem to fix. It says that presses are saved for the model's next turn instead: after the person's next message, the model reads the widget's state, where `actions` lists what they pressed (name, value, time). The result for a spec that uses `emit:` says the same.
124
147
  - **Nothing else changes.** Without the flag, `emit:` is handled exactly as above; clients that draw MCP Apps views get the same tools, docs and results with or without it.
125
148
 
@@ -250,7 +273,7 @@ To give Claude, ChatGPT and other chat apps a permanent HTTPS address, run the H
250
273
  Start it with an exact version, never `@latest`, so what runs is what you checked:
251
274
 
252
275
  ```bash
253
- npx -y sayshape-mcp@0.2.2 --http --host 0.0.0.0 --trust-proxy
276
+ npx -y sayshape-mcp@0.4.0 --http --host 0.0.0.0 --trust-proxy
254
277
  ```
255
278
 
256
279
  | | |