Skip to content

fix(mcp): offer the frame preview card only to clients that embed it - #548

Merged
kgoedecke merged 1 commit into
mainfrom
fix/preview-card-embedding-clients
Nov 19, 2026
Merged

kgoedecke merged 1 commit into
mainfrom
fix/preview-card-embedding-clients

Conversation

@kgoedecke

Copy link
Copy Markdown
Collaborator

Why

A user on the Pi agent reported that starting a task opens their browser on a Doop sign-in screen. Pi supports MCP Apps but runs in a terminal, so its adapter opens every preview card as a local browser tab (MCP UI - doop / get_canvas): one per get_canvas, edit and screenshot. The card's "Open in Doop" button then lands a signed-out browser on the sign-in page.

The card was built for ChatGPT and Claude, but its _meta link was advertised to every client.

What changes

  • embedsPreview(clientName) in server/chatgptApp.ts: an allowlist of clients known to show the card inside the conversation. Only those get the _meta link on the preview tools; every other client gets the same tools and the same text results without it.
  • On the list: ChatGPT (openai-mcp, OAuth application ChatGPT) and Claude (Anthropic/ClaudeAI, claude-ai, OAuth applications Claude and Doop for Claude Desktop). Both names are needed: the server uses the name from initialize when it remembers it and falls back to the OAuth application's name after a restart or token refresh.
  • Off the list on purpose: codex-mcp-client and openai-mcp (Codex).
  • The card resource is still served to everyone, so cards already rendered in old chats keep loading.

Port of the same change from the hosted repository; the only difference is that the hosted-only import_psd tool is not part of it.

Not verified

  • Not run against a live Pi, ChatGPT or Claude session; coverage is the contract tests in tests/mcp-tools.test.ts.
  • claude-ai / Doop for Claude Desktop (the desktop extension through mcp-remote) is assumed to embed the card like claude.ai does.
  • Whether openai-mcp (Codex) embeds cards is unknown; it stays off until someone checks.
  • A host that embeds cards and is not on the list gets none until its names are added to EMBEDDING_CLIENTS.

Testing

  • bun run typecheck
  • bunx vitest run tests/mcp-tools.test.ts tests/access.test.ts (39 passed)

🤖 Generated with Claude Code

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 4f17042505ffd2043ca8ce06d83db974a6751f26)
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Preview cards are now offered only to named ChatGPT and Claude clients, while tool results and existing card resources stay unchanged.

  • The frame preview appears only for known ChatGPT and Claude clients.

kgoedecke intentionally excludes unlisted hosts and Codex until embedding is confirmed. kgoedecke also notes that Claude Desktop embedding is assumed and live-client checks were not run.

Reviews (1) · Last reviewed commit: "fix(mcp): offer the frame preview card o..." · Reviewed by Greptile

@kgoedecke
kgoedecke merged commit d0820b3 into main Nov 19, 2026
9 of 10 checks passed
VTalleyrand pushed a commit to VTalleyrand/doop that referenced this pull request Nov 20, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fcf7f645f5893206df763545c0ef33115088462b)
kgoedecke added a commit that referenced this pull request Nov 21, 2026
…579)

withPreview attached the ChatGPT card's data as structuredContent on six
tools for every client. Claude Code, opencode and Codex read
structuredContent in place of content, so get_canvas came back as the card
(frame ids, sizes, image URLs) with no pages, pageId, positions, approval,
components, tokens or notes, and the write tools lost their HUMAN FEEDBACK
and component notes. Agents filed about 40 reports of it in three days.
#548 stopped offering the card to those clients but still sent its data;
now only a client embedsPreview names gets it.

Refs #526

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant