sayshape-mcp 0.1.1 → 0.1.2

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
@@ -57,7 +57,7 @@ The one list does three things: the view's engine loads from those hosts and no
57
57
 
58
58
  ## In chat apps that can't draw interfaces
59
59
 
60
- 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. Clients that draw views get exactly what they got before.
60
+ 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.
61
61
 
62
62
  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.
63
63
 
@@ -207,7 +207,7 @@ To give Claude, ChatGPT and other chat apps a permanent HTTPS address, run the H
207
207
  Start it with an exact version, never `@latest`, so what runs is what you checked:
208
208
 
209
209
  ```bash
210
- npx -y sayshape-mcp@0.1.1 --http --host 0.0.0.0 --trust-proxy
210
+ npx -y sayshape-mcp@0.1.2 --http --host 0.0.0.0 --trust-proxy
211
211
  ```
212
212
 
213
213
  | | |
package/dist/server.js CHANGED
@@ -27459,7 +27459,7 @@ ${html}${fence}`;
27459
27459
  const PAGE_REPEAT_TEXT = "An earlier show_interface result already has the page for this exact interface, so there's no new page. Use that one, and don't call show_interface again unless the person asks for a change.";
27460
27460
  const PAGE_DATASETS_TEXT = "This chat app can't draw interfaces, and an interface that loads a dataset (the data argument) can only be shown by an app that can, because the rows never pass through the conversation. So nothing is showing, and there is no page to publish. Tell the person this chat app can't show interfaces with data from the database or imported results, and answer them in text.";
27461
27461
  const pageFixLead = (n2) => `${n2} problem${n2 === 1 ? "" : "s"} leave${n2 === 1 ? "s" : ""} part of this interface wrong or missing, and this chat app can't draw interfaces, so nothing is showing yet. Fix ${n2 === 1 ? "it" : "them"} and call show_interface again with the whole corrected spec; once there's nothing to fix, the result has a page to show the person:`;
27462
- const VERSION = "0.1.1";
27462
+ const VERSION = "0.1.2";
27463
27463
  const UI_URI = "ui://sayshape/interface.html";
27464
27464
  const MAX_SPEC_CHARS = 2e4;
27465
27465
  const MAX_REPORTED = 12;
@@ -27718,15 +27718,14 @@ function createServer(opts) {
27718
27718
  const key = interfaceKey(spec, wanted);
27719
27719
  const repeat = toFix === 0 && lastGood !== null && lastGood.key === key && now() - lastGood.at < REPEAT_WINDOW_MS;
27720
27720
  if (toFix === 0) lastGood = { key, at: now() };
27721
- const page = (shown2) => textOnly ? { page: shown2 } : {};
27722
- const counts = { datasets, title: title ?? null, errors: check2.errors.length, warnings: check2.warnings.length, toFix };
27723
- if (textOnly && names.length) {
27724
- return { content: [{ type: "text", text: PAGE_DATASETS_TEXT }], structuredContent: { ...counts, repeat, diagnostics: [], page: false } };
27721
+ if (textOnly) {
27722
+ if (names.length) return text(PAGE_DATASETS_TEXT);
27723
+ if (repeat) return text(PAGE_REPEAT_TEXT);
27725
27724
  }
27726
27725
  if (repeat) {
27727
27726
  return {
27728
- content: [{ type: "text", text: textOnly ? PAGE_REPEAT_TEXT : REPEAT_TEXT }],
27729
- structuredContent: { datasets, title: title ?? null, errors: 0, warnings: check2.warnings.length, toFix: 0, repeat: true, diagnostics: [], ...page(false) }
27727
+ content: [{ type: "text", text: REPEAT_TEXT }],
27728
+ structuredContent: { datasets, title: title ?? null, errors: 0, warnings: check2.warnings.length, toFix: 0, repeat: true, diagnostics: [] }
27730
27729
  };
27731
27730
  }
27732
27731
  const failing = elementsOnLines(spec, [...parsed2.errors, ...parsed2.warnings].filter((d) => !isHarmless(d)));
@@ -27735,8 +27734,10 @@ Docs for ${failing.join(", ")}:
27735
27734
  ${elementGuide(registry, failing).text}`);
27736
27735
  const withPage = textOnly && toFix === 0;
27737
27736
  if (withPage) notes.push(fenced(fallbackPage({ spec, title, scenes: scenesOn })));
27737
+ const said = [describeCheck(check2, textOnly), ...notes].join("\n");
27738
+ if (textOnly) return text(said);
27738
27739
  return {
27739
- content: [{ type: "text", text: [describeCheck(check2, textOnly), ...notes].join("\n") }],
27740
+ content: [{ type: "text", text: said }],
27740
27741
  structuredContent: {
27741
27742
  datasets,
27742
27743
  title: title ?? null,
@@ -27744,8 +27745,7 @@ ${elementGuide(registry, failing).text}`);
27744
27745
  warnings: check2.warnings.length,
27745
27746
  toFix,
27746
27747
  repeat: false,
27747
- diagnostics: [...check2.errors, ...check2.warnings].slice(0, MAX_REPORTED).map((d) => ({ line: d.line, severity: d.severity, message: d.message })),
27748
- ...page(withPage)
27748
+ diagnostics: [...check2.errors, ...check2.warnings].slice(0, MAX_REPORTED).map((d) => ({ line: d.line, severity: d.severity, message: d.message }))
27749
27749
  }
27750
27750
  };
27751
27751
  }
package/dist/ui.html CHANGED
@@ -282,7 +282,7 @@ ${i}`;return r.length<=Dg?r:r.slice(0,Dg-1)+"…"}const Rg=120;function bO(e,t){
282
282
  `:"";return t.length===1?`${n}${t[0]}
283
283
  `:`${n}row gap=${Bg} align=center wrap=false
284
284
  ${t.map(o=>` ${o}
285
- `).join("")}`}function UO(e){return typeof e=="string"&&G1.some(t=>t.id===e)}function FO(e,t,n){const o=DO(e,t,null).theme;return n?PO(o,n):o}async function HO(e,t){if(t.writeText)try{return await t.writeText(e),!0}catch{}try{return t.copyCommand?.(e)??!1}catch{return!1}}function WO(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;return{writeText:t?.writeText?n=>t.writeText(n):void 0,copyCommand:n=>{const o=e.createElement("textarea");o.value=n,o.setAttribute("readonly",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";const i=e.activeElement;e.body.append(o),o.select();let r=!1;try{r=e.execCommand("copy")}finally{o.remove(),i?.focus?.({preventScroll:!0})}return r}}}const m7=16,g7=e=>Math.round(e*.75),BO={type:"tool-button",category:"input",description:"A square icon button for the view's own controls, such as Save image. Not offered to models.",text:{description:"What the button does, read out for people using a screen reader.",required:!0},props:{icon:{type:"string",required:!0,description:"An icon from icon's list, e.g. icon=download."},on:it("when pressed")},example:'tool-button "Save image" icon=download on=emit:save_image',minWidth:(e,t)=>g7(t.theme.control.height),semantics(e,t){return{role:"button",name:t.props(e.node).text()}},layout(e,t){e.h=g7(t.theme.control.height)},paint(e,t){const{g:n,theme:o}=t,i=o.colors,r=t.props(e.node),a=g7(o.control.height),s=e.x+Math.max(0,e.w-a),L=t.tween(e.node,"tool:hover",t.isHovered(e.node)?1:0,120),l=t.isPressed(e.node);(L>0||l)&&(t.roundRect(s+.5,e.y+.5,a-1,a-1,o.radius.sm),ne(n,i.ink,.06*L+(l?.06:0)),n.save(),n.globalAlpha*=L,n.strokeStyle=i.line,n.lineWidth=1,n.stroke(),n.restore());const c=r.str("icon");On(c)&&Gt(n,c,s+(a-m7)/2,e.y+(a-m7)/2,m7,L>.5||l?i.ink:i.muted),t.addHit(Ye(e,s,e.y,a,a))}},qO=Object.freeze({themePicker:!1,theme:"teal",saveImage:!0,copyText:!0}),VO="sayshape-view",KO=G1.map(e=>e.id),GO=e=>!!e&&KO.includes(e),JO=/^(\*\.)?[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/,YO=20;function XO(e){const t=[...new Set(e.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean))];return t.length&&t.length<=YO&&t.every(n=>JO.test(n))?t:null}function QO(e){const t={...qO};if(!e)return t;const n=new URLSearchParams(e);n.get("picker")==="1"&&(t.themePicker=!0),n.get("save")==="0"&&(t.saveImage=!1),n.get("copy")==="0"&&(t.copyText=!1),n.get("scene")==="1"&&(t.scene=!0);const o=n.get("images"),i=o?XO(o):null;i&&(t.imageHosts=i);const r=n.get("theme");return GO(r)&&(t.theme=r),t}function eN(e){return QO(e.querySelector(`meta[name="${VO}"]`)?.content)}const tN=['400 15px "Instrument Sans"','600 15px "Instrument Sans"','700 15px "Instrument Sans"'],qg=document.querySelector("#bar"),nN=document.querySelector("#view-tools"),Fi=eN(document),Vg=document.querySelector("#sayshape"),Ot=new a6({name:"SayShape",version:"0.1.1"},{},{autoResize:!0});let Me=null,bo=null,y7=Fi.theme,dL="",fL=null;const Kg=new Map;let hL=null;const Dr=new Set;let Cr=!1;const iN=`card
285
+ `).join("")}`}function UO(e){return typeof e=="string"&&G1.some(t=>t.id===e)}function FO(e,t,n){const o=DO(e,t,null).theme;return n?PO(o,n):o}async function HO(e,t){if(t.writeText)try{return await t.writeText(e),!0}catch{}try{return t.copyCommand?.(e)??!1}catch{return!1}}function WO(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;return{writeText:t?.writeText?n=>t.writeText(n):void 0,copyCommand:n=>{const o=e.createElement("textarea");o.value=n,o.setAttribute("readonly",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";const i=e.activeElement;e.body.append(o),o.select();let r=!1;try{r=e.execCommand("copy")}finally{o.remove(),i?.focus?.({preventScroll:!0})}return r}}}const m7=16,g7=e=>Math.round(e*.75),BO={type:"tool-button",category:"input",description:"A square icon button for the view's own controls, such as Save image. Not offered to models.",text:{description:"What the button does, read out for people using a screen reader.",required:!0},props:{icon:{type:"string",required:!0,description:"An icon from icon's list, e.g. icon=download."},on:it("when pressed")},example:'tool-button "Save image" icon=download on=emit:save_image',minWidth:(e,t)=>g7(t.theme.control.height),semantics(e,t){return{role:"button",name:t.props(e.node).text()}},layout(e,t){e.h=g7(t.theme.control.height)},paint(e,t){const{g:n,theme:o}=t,i=o.colors,r=t.props(e.node),a=g7(o.control.height),s=e.x+Math.max(0,e.w-a),L=t.tween(e.node,"tool:hover",t.isHovered(e.node)?1:0,120),l=t.isPressed(e.node);(L>0||l)&&(t.roundRect(s+.5,e.y+.5,a-1,a-1,o.radius.sm),ne(n,i.ink,.06*L+(l?.06:0)),n.save(),n.globalAlpha*=L,n.strokeStyle=i.line,n.lineWidth=1,n.stroke(),n.restore());const c=r.str("icon");On(c)&&Gt(n,c,s+(a-m7)/2,e.y+(a-m7)/2,m7,L>.5||l?i.ink:i.muted),t.addHit(Ye(e,s,e.y,a,a))}},qO=Object.freeze({themePicker:!1,theme:"teal",saveImage:!0,copyText:!0}),VO="sayshape-view",KO=G1.map(e=>e.id),GO=e=>!!e&&KO.includes(e),JO=/^(\*\.)?[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/,YO=20;function XO(e){const t=[...new Set(e.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean))];return t.length&&t.length<=YO&&t.every(n=>JO.test(n))?t:null}function QO(e){const t={...qO};if(!e)return t;const n=new URLSearchParams(e);n.get("picker")==="1"&&(t.themePicker=!0),n.get("save")==="0"&&(t.saveImage=!1),n.get("copy")==="0"&&(t.copyText=!1),n.get("scene")==="1"&&(t.scene=!0);const o=n.get("images"),i=o?XO(o):null;i&&(t.imageHosts=i);const r=n.get("theme");return GO(r)&&(t.theme=r),t}function eN(e){return QO(e.querySelector(`meta[name="${VO}"]`)?.content)}const tN=['400 15px "Instrument Sans"','600 15px "Instrument Sans"','700 15px "Instrument Sans"'],qg=document.querySelector("#bar"),nN=document.querySelector("#view-tools"),Fi=eN(document),Vg=document.querySelector("#sayshape"),Ot=new a6({name:"SayShape",version:"0.1.2"},{},{autoResize:!0});let Me=null,bo=null,y7=Fi.theme,dL="",fL=null;const Kg=new Map;let hL=null;const Dr=new Set;let Cr=!1;const iN=`card
286
286
  skeleton lines=1
287
287
  skeleton shape=block height=150
288
288
  skeleton lines=2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sayshape-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "An MCP server that lets Claude, ChatGPT and other MCP Apps clients show SayShape interfaces inside the chat.",
5
5
  "type": "module",
6
6
  "license": "MIT",