Skip to content

feat(embed): add @a2ui/embed with the MCP Apps contract - #4297

Draft
josemontespg wants to merge 1 commit into
mainfrom
embed/1-contract
Draft

josemontespg wants to merge 1 commit into
mainfrom
embed/1-contract

Conversation

@josemontespg

@josemontespg josemontespg commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds the @a2ui/embed package, which lets an MCP server show A2UI surfaces inside MCP Apps hosts ("A2UI in MCP Apps"). The server and the app running in the host iframe talk through a small wire contract, and this PR adds only that contract, in @a2ui/embed/contract.

A tool result carries its A2UI messages in structuredContent.a2ui as an EmbedPayload. User actions go back to the server as an ActionCall through the app-only a2ui_action tool. The contract also defines the catalog schema file that tells the server which components the app can render. Both sides import the same types and helpers so they cannot drift apart, and breaking wire updates bump _meta.ui.resourceUri (for example ui://a2ui/v2/app.html) so MCP Apps hosts fetch the matching HTML bundle instead of serving stale cached HTML.

Changes

  • typescript/embed/: new package scaffold (package.json exports, TypeScript, ESLint and Prettier config, README, CHANGELOG).
  • src/contract/embed_payload.ts: the EmbedPayload type, toToolResult to build a tool result, and readEmbedPayload to read one back.
  • src/contract/action_call.ts: the a2ui_action tool name and the ActionCall arguments.
  • src/contract/catalog_schema_file.ts and app_resource.ts: the catalog schema file format and the app resource URI constant (DEFAULT_RESOURCE_URI).

Verification

  • yarn workspace @a2ui/embed build, test, lint, and format:check pass locally.

@josemontespg
josemontespg added this pull request to stack #4301 November 18, 2026 21:14
@josemontespg josemontespg changed the title embed/1 contract feat(embed): add @a2ui/embed with the MCP Apps contract Nov 18, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces the @a2ui/embed package, establishing a versioned contract between an MCP server and its A2UI app. It defines schemas and helpers for tool results, action calls, catalog schemas, and contract versioning, along with comprehensive unit tests. The feedback suggests improving the robustness of the Zod schemas in embed_payload.ts and action_call.ts by handling null values safely to prevent validation failures or unintended string coercions. Additionally, it is recommended to simplify checkContractVersion by using a constant major version instead of dynamically parsing the static CONTRACT_VERSION string on every call.

@josemontespg
josemontespg force-pushed the embed/1-contract branch 2 times, most recently from faa7b13 to fe12822 Compare November 18, 2026 21:25
@josemontespg
josemontespg removed this pull request from stack #4301 November 20, 2026 20:26
@josemontespg
josemontespg added this pull request to stack #4333 November 20, 2026 20:26
@polina-c polina-c mentioned this pull request Nov 20, 2026
@josemontespg
josemontespg force-pushed the embed/1-contract branch 2 times, most recently from 29cae73 to 799cb4a Compare November 26, 2026 01:24
@josemontespg
josemontespg removed this pull request from stack #4333 December 2, 2026 22:12
@josemontespg
josemontespg added this pull request to stack #4548 December 2, 2026 22:13

This branch has not been deployed

No deployments
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