Skip to content

feat(embed): add the @a2ui/embed/mcp/server entry point - #4298

Draft
josemontespg wants to merge 1 commit into
embed/1-contractfrom
embed/2-server
Draft

josemontespg wants to merge 1 commit into
embed/1-contractfrom
embed/2-server

Conversation

@josemontespg

@josemontespg josemontespg commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Problem: Serving A2UI v1.0 surfaces from an MCP Apps server requires wiring ui:// resources, _meta.ui tool metadata, an app-only action dispatcher, templated follow-ups, action prompt contracts, and specification plus catalog validation by hand.

This PR adds @a2ui/embed/mcp/server. createA2uiApp registers the ui:// app resource, links tools registered through app.tool to that resource, routes user interactions through the app-only a2ui_action tool (app.action and app.followUp), summarizes registered actions for model prompts with app.describeActions(), and validates outgoing messages against A2UI v1.0 and the app's catalogs (app.validate).

Changes

  1. src/mcp/server/create_a2ui_app.ts: createA2uiApp, app.tool, app.action, app.followUp (including optional description), app.describeActions(), and app.validate.
  2. src/mcp/server/describe_actions.ts: deterministic Markdown action and follow-up contract formatting across Zod v3 and Zod v4 argument shapes.
  3. src/mcp/server/follow_up_template.ts: follow-up message interpolation with control-character stripping, truncation, and JSON quoting.
  4. src/mcp/server/a2ui_validator.ts, describe_schema_errors.ts, and load_catalog_schema_file.ts: Ajv validation (including cross-catalog @call function validation) and readable property-level errors.
  5. package.json, README.md, and CHANGELOG.md: export @a2ui/embed/mcp/server and declare @modelcontextprotocol/sdk as a peer dependency.

Verification

  1. yarn --cwd embed test: 161 Node tests and type checks pass.
  2. yarn --cwd embed lint, yarn --cwd embed format:check, and ./scripts/fix_licenses.py --check pass.

@josemontespg
josemontespg added this pull request to stack #4301 November 18, 2026 21:14

@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/mcp/server module, which enables serving an A2UI application from a Model Context Protocol (MCP) server. Key additions include the createA2uiApp API for registering app resources, tools, actions, and follow-ups, alongside the A2uiValidator class for validating A2UI messages against specification and catalog schemas using Ajv. Comprehensive unit tests have been added for the validator, app creation, schema error formatting, and follow-up template interpolation. Since there are no review comments, I have no feedback to provide.

@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
@josemontespg
josemontespg force-pushed the embed/2-server branch 2 times, most recently from 30617f1 to 53ebf67 Compare November 20, 2026 21:36
@josemontespg
josemontespg force-pushed the embed/2-server branch 3 times, most recently from 8c7dfc1 to bf4e6a7 Compare November 26, 2026 01:03
@josemontespg
josemontespg force-pushed the embed/2-server branch 2 times, most recently from 5f0ebab to 0009304 Compare December 2, 2026 20:07
@josemontespg
josemontespg force-pushed the embed/2-server branch 2 times, most recently from 26bc0b2 to d435f75 Compare December 2, 2026 21:28
@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