Repository navigation
feat(embed): add @a2ui/embed with the MCP Apps contract - #4297
Draft
josemontespg wants to merge 1 commit into
Draft
josemontespg wants to merge 1 commit into
josemontespg wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
force-pushed
the
embed/1-contract
branch
2 times, most recently
from
November 18, 2026 21:25
faa7b13 to
fe12822
Compare
Draft
josemontespg
force-pushed
the
embed/1-contract
branch
2 times, most recently
from
November 26, 2026 01:24
29cae73 to
799cb4a
Compare
josemontespg
force-pushed
the
embed/1-contract
branch
from
December 2, 2026 21:07
799cb4a to
2defcb1
Compare
josemontespg
force-pushed
the
embed/1-contract
branch
from
December 3, 2026 18:34
2defcb1 to
1cd89a1
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the
@a2ui/embedpackage, 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.a2uias anEmbedPayload. User actions go back to the server as anActionCallthrough the app-onlya2ui_actiontool. 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 exampleui://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.jsonexports, TypeScript, ESLint and Prettier config, README, CHANGELOG).src/contract/embed_payload.ts: theEmbedPayloadtype,toToolResultto build a tool result, andreadEmbedPayloadto read one back.src/contract/action_call.ts: thea2ui_actiontool name and theActionCallarguments.src/contract/catalog_schema_file.tsandapp_resource.ts: the catalog schema file format and the app resource URI constant (DEFAULT_RESOURCE_URI).Verification
yarn workspace @a2ui/embed build,test,lint, andformat:checkpass locally.