sayshape-mcp 0.2.2 → 0.3.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 +23 -6
- package/dist/server.js +12579 -12202
- package/dist/ui.html +108 -107
- package/dist/widget-engine.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ 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). 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.
|
|
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,11 +37,15 @@ 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) |
|
|
42
45
|
| `--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
46
|
| `--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. |
|
|
47
|
+
| `--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
|
+
| `--slides` | Does nothing. Slide decks need no flag; this is accepted so setups written for an earlier version still start. |
|
|
44
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). |
|
|
45
50
|
| `--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). |
|
|
46
51
|
| `--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). |
|
|
@@ -57,6 +62,16 @@ With both experimental features on:
|
|
|
57
62
|
|
|
58
63
|
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
64
|
|
|
65
|
+
### Slide decks
|
|
66
|
+
|
|
67
|
+
`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).
|
|
68
|
+
|
|
69
|
+
- **No flag.** Earlier versions needed `--slides`. It is still accepted and does nothing, so existing setups keep starting.
|
|
70
|
+
- **`--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`.
|
|
71
|
+
- **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.
|
|
72
|
+
- **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.
|
|
73
|
+
- **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.
|
|
74
|
+
|
|
60
75
|
### Images
|
|
61
76
|
|
|
62
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:
|
|
@@ -73,6 +88,8 @@ Coding agents and other text-only clients (Claude Code, Codex, Antigravity and o
|
|
|
73
88
|
|
|
74
89
|
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
90
|
|
|
91
|
+
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.
|
|
92
|
+
|
|
76
93
|
A page outside the chat has no conversation to send `emit:` actions to, so for these clients only:
|
|
77
94
|
|
|
78
95
|
- **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 +103,7 @@ What doesn't work there:
|
|
|
86
103
|
- **Save image and Copy text** aren't on the page.
|
|
87
104
|
- **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
105
|
- **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
|
|
106
|
+
- 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
107
|
- 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
108
|
- 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
109
|
- 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 +120,9 @@ Start the server with `--widget-dir <folder>` and, for a client that announces n
|
|
|
103
120
|
"sayshape": { "command": "node", "args": ["/full/path/to/sayshape/mcp/dist/server.js", "--widget-dir", "/Users/you/sayshape-widgets"] }
|
|
104
121
|
```
|
|
105
122
|
|
|
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,
|
|
123
|
+
- **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.
|
|
107
124
|
- **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
|
|
125
|
+
- **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
126
|
- **Light and dark** follow `data-theme="light|dark"` on the root element and the system's `prefers-color-scheme`, and changes to either.
|
|
110
127
|
- **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
128
|
|
|
@@ -119,7 +136,7 @@ The fragment builder (`mcp/src/widget-file.ts`) takes a `host` option: the sourc
|
|
|
119
136
|
|
|
120
137
|
What changes with it, for clients that get a file:
|
|
121
138
|
|
|
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 `--
|
|
139
|
+
- **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
140
|
- **`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
141
|
- **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
142
|
|
|
@@ -250,7 +267,7 @@ To give Claude, ChatGPT and other chat apps a permanent HTTPS address, run the H
|
|
|
250
267
|
Start it with an exact version, never `@latest`, so what runs is what you checked:
|
|
251
268
|
|
|
252
269
|
```bash
|
|
253
|
-
npx -y sayshape-mcp@0.
|
|
270
|
+
npx -y sayshape-mcp@0.3.0 --http --host 0.0.0.0 --trust-proxy
|
|
254
271
|
```
|
|
255
272
|
|
|
256
273
|
| | |
|