Skip to content

feat(mcp): the card offers the activity in a new tab where a chat cannot play it in a reply (#274) - #275

Merged
alekswebnet merged 2 commits into
mainfrom
feat/card-new-tab
Nov 25, 2026
Merged

alekswebnet merged 2 commits into
mainfrom
feat/card-new-tab

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #274.

Where a chat cannot play the activity inside its reply, the card says so and offers it in a new tab, where the whole player runs. Nothing changes in ChatGPT, on the server or on the play page.

How the card knows

From the browser, never from a chat's name:

  • It has no origin (self.origin is "null"). The chat sandboxed it without one, and a sandbox passes to every frame inside, so the play page there could not register its Service Worker. No frame is tried. This is Open WebUI 0.13.4.
  • The frame is refused. The browser raises securitypolicyviolation for the play page's address. This is Claude.
  • If the page speaks from inside the frame after all, the card shows the page: a wrong conclusion never hides a player that works.

What is seen

One state, in the loader's place and as tall as what it says, in the chat's theme:

State Title Under it
The chat opens links The activity opens in a new tab why, and the button Open the activity
After a press the same "A new tab should have opened. If none did, copy this link into your browser's address bar.", the address and Copy
The chat answers no the same "The chat did not open it. Copy this link…", the address and Copy
The chat opens no link Open the activity in your browser "Copy this link…", the address and Copy, no button

The button asks the chat to open the play page's address with the source in it (ui/open-link, or ChatGPT's openExternal). A plain link would not do: a tab opened from a sandboxed card keeps the sandbox, in Chromium, Firefox and WebKit. Whether a tab opened is not the card's to see, so the address is there from the first press on. Each state was looked at in light and dark, at 760 px and at a phone's 390 px, in the three engines: no scroller in the card, and Copy works in a card without an origin.

The card now also takes the chat's theme the MCP Apps way (hostContext.theme, and ui/notifications/host-context-changed), which it read only from ChatGPT's window.openai before.

Testing

  • New packages/mcp/tests/card.test.ts, five tests, in the verifier's browser: the card in a chat that sandboxes it as Open WebUI does, under the policy Open WebUI writes from the card's own domains; in one that refuses the frame; and in one that lets the page be framed. Each speaks MCP Apps to the card. Against the card before this change all five fail.
  • The package's tests: 36 pass in 4 files. The Worker's: 6 pass. typecheck is clean.
  • By hand, in Chromium, Firefox and WebKit: the two signals, the four states above, and a page framed as before.
  • End to end: from a card sandboxed without an origin, the press reached the stand-in chat as ui/open-link, the chat opened the tab, and the live play page built and played the True/False sample there ("True False · 882 kB").

Not verified: Claude and Open WebUI themselves, which the card met only as stand-ins built from Open WebUI's source and from the policy Claude was seen to apply.

Notes

  • playwright-core is a dev dependency of the package now, for the test's types; the browser is the verifier's own choice (launch).
  • design/mcp.md has the rule; design/scope.md records that a player without the Service Worker is not built, with the corpus numbers behind that.
  • The live server serves the new card once the Worker is deployed again. The card's address changes with its text, so a chat fetches it afresh. No npm release is needed for that.

Summary by cubic

Where a chat cannot play the activity inside its reply, the MCP card now offers it in a new tab instead of hanging on a spinner. The chat opens the tab itself, because a tab opened from a sandboxed card keeps the sandbox and loses its origin, as probed in Chromium, Firefox, and WebKit.

  • Detects it from the browser (self.origin === 'null' or securitypolicyviolation), never from a chat's name.
  • Shows an "Open the activity" button that asks the chat to open the play page, with the address available to copy from the first press on.
  • A page that speaks from the frame still takes over, so a wrong conclusion never hides a player that works.
  • Reads the chat's theme the MCP Apps way (hostContext.theme) as well as ChatGPT's window.openai.
  • Adds tests/card.test.ts, which runs the card in a browser in three stand-in chats, and playwright-core as a dev dependency.

Written for commit 0e86804. Summary will update on new commits.

View guided diff Turn on auto-fix

…not play it in a reply (#274)

A card with no origin frames nothing, since no frame inside it can have a Service Worker, and a
frame the chat refuses is known from the browser's securitypolicyviolation. The card then shows
one state in the loader's place: what happens, and a button that asks the chat to open the play
page's address with the source in it (ui/open-link, or ChatGPT's openExternal), with the address
to copy from the first press on. The page's own word from the frame takes the card back. The
chat's theme is read the MCP Apps way as well (hostContext.theme).

tests/card.test.ts runs the card in a browser in three stand-in chats.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/mcp/README.md Resolved
Comment thread design/mcp.md Resolved
Comment thread design/mcp.md Resolved
… card opened itself would keep it, as probed in three engines (#274)
@alekswebnet
alekswebnet merged commit 2b8d069 into main Nov 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The app's card offers the activity in a new tab where a chat cannot play it in a reply

1 participant