@womp/mcp-ui 0.1.9 → 0.1.10

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
@@ -221,6 +221,26 @@ snapped Tinted clear back to Clear on every re-quote), `materialLabel`,
221
221
  list with `swatchUrl`, `finishes`, `colorRequired` / `colorOptional`,
222
222
  `available` and `contactUrl`.
223
223
 
224
+ **The card's knob turns must be published, or the model orders the defaults.**
225
+ A card's own tool calls go host → server → iframe and never enter the
226
+ conversation, so the model's view of the print is frozen at the arguments it
227
+ opened the card with: tune it, ask for the cart in chat, and you get a 10 cm
228
+ white one. So every change (`markDirty()`, which every control already goes
229
+ through) schedules a `syncConfig()` that does two things:
230
+
231
+ - calls **`sync_print_config`** — an app-ONLY tool (`visibility: ["app"]`, kept
232
+ out of the model's tool list) that parks the selection server-side, where
233
+ `add_to_cart` and `prepare_print` read it. This is the load-bearing half.
234
+ Colour and finish changes do not re-quote, so `estimate_print` could not have
235
+ been the sync point.
236
+ - calls **`updateModelContext`** via `pushModelContext` (shared/bridge.ts),
237
+ which is the MCP Apps channel for the same fact and lets the model *talk*
238
+ about the right print. Host-gated, and Claude web was reported to drop the
239
+ payload ([claude-ai-mcp#102]), so it is a bonus, never the mechanism. The
240
+ harness advertises the capability and logs what arrives.
241
+
242
+ [claude-ai-mcp#102]: https://github.com/anthropics/claude-ai-mcp/issues/102
243
+
224
244
  **Layout trap that cost an hour:** a grid container's implicit `auto` track
225
245
  grows to its items' min-content, and a bare `<input type="number">` is ~150px
226
246
  wide intrinsically — three of them widened every row past the card's edge while
@@ -231,6 +251,9 @@ flex basis. If a row overflows, look there first.
231
251
  The stub takes three switches for the states a default account never shows:
232
252
  `FAKE_ENTERPRISE=1` (Enterprise materials orderable), `FAKE_PRO=1` (hollow
233
253
  priced as available), `FAKE_REPAIRED=1` (the repaired / non-manifold callouts).
254
+ It also keeps the last `sync_print_config` and merges it into `add_to_cart` /
255
+ `prepare_print` the way the server does — module scope, not inside
256
+ `buildServer()`, which runs per request exactly as swan-backend's does.
234
257
 
235
258
  ### The upload card sends bytes from inside the iframe
236
259
 
@@ -281,6 +304,10 @@ yarn dev # vite; opens the harness at /dev/host/index.html
281
304
 
282
305
  Two terminals, then edit `src/` and watch the card hot-reload.
283
306
 
307
+ Someone else already on :3001? `node dev/server.mjs 3002`, then open the harness
308
+ with `?mcp=http://127.0.0.1:3002/mcp` — two sessions, one checkout, no fighting
309
+ over the port.
310
+
284
311
  ### The harness (`dev/host/`)
285
312
 
286
313
  A real MCP Apps host: `AppBridge` from `@modelcontextprotocol/ext-apps`, driving
@@ -296,6 +323,7 @@ It is deliberately faithful where being unfaithful would hide a bug:
296
323
  | host style variables sent **only** over the bridge (and a toggle to withhold them) | a `var()` shipped without a fallback |
297
324
  | the card's own `get_generation` polling, proxied to a real MCP server | a running state that never resolves |
298
325
  | **"built resource" mode** — the exact HTML `resources/read` returns, in a sandboxed opaque-origin iframe | an asset `vite-plugin-singlefile` failed to inline (blank card) |
326
+ | `updateModelContext` advertised and logged, and a stub that remembers `sync_print_config` across requests | a card whose selection never leaves the iframe — press `add_to_cart` (it sends the mesh and nothing else) and read what the stub merged |
299
327
 
300
328
  `FAKE_DURATION_MS=8000 yarn dev:mcp` lengthens a fake generation, so the
301
329
  running → polling → complete transition is worth watching. The print stubs