sayshape-mcp 0.3.0 → 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,7 @@ 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
31
  - **Save as PDF, Save as PowerPoint and Present**, while a slide deck is showing. See [Slide decks](#slide-decks).
32
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.
33
33
 
@@ -42,12 +42,17 @@ When none is on, there's no toolbar at all. Whoever installs the server chooses,
42
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 |
43
43
  | `--no-save-image` | Hide Save image (shown by default where the chat app can download) |
44
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) |
45
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. |
46
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. |
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). |
47
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). |
48
51
  | `--slides` | Does nothing. Slide decks need no flag; this is accepted so setups written for an earlier version still start. |
49
- | `--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). |
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` |
50
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. |
51
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). |
52
57
 
53
58
  ```json
@@ -74,13 +79,13 @@ Then ask for something that moves or can be pressed: *"Draw a traffic light I ca
74
79
 
75
80
  ### Images
76
81
 
77
- 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:
78
83
 
79
84
  ```json
80
85
  "sayshape": { "command": "node", "args": ["/full/path/to/sayshape/mcp/dist/server.js", "--image-hosts", "cdn.acme.com,images.unsplash.com"] }
81
86
  ```
82
87
 
83
- 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.
84
89
 
85
90
  ## In chat apps that can't draw interfaces
86
91
 
@@ -121,6 +126,7 @@ Start the server with `--widget-dir <folder>` and, for a client that announces n
121
126
  ```
122
127
 
123
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.
124
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.
125
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.
126
132
  - **Light and dark** follow `data-theme="light|dark"` on the root element and the system's `prefers-color-scheme`, and changes to either.
@@ -267,7 +273,7 @@ To give Claude, ChatGPT and other chat apps a permanent HTTPS address, run the H
267
273
  Start it with an exact version, never `@latest`, so what runs is what you checked:
268
274
 
269
275
  ```bash
270
- npx -y sayshape-mcp@0.3.0 --http --host 0.0.0.0 --trust-proxy
276
+ npx -y sayshape-mcp@0.4.0 --http --host 0.0.0.0 --trust-proxy
271
277
  ```
272
278
 
273
279
  | | |