Skip to content

feat: Integrate MCP Apps into A2UI#748

Merged
dmandar merged 23 commits intomainfrom
md-mcpuinew
Mar 13, 2026
Merged

feat: Integrate MCP Apps into A2UI#748
dmandar merged 23 commits intomainfrom
md-mcpuinew

Conversation

@dmandar
Copy link
Collaborator

@dmandar dmandar commented Mar 2, 2026

  • Adds McpAppsCustomComponent using the official @modelcontextprotocol/ext-apps SDK.
  • Implements double-iframe sandbox isolation (sandbox.html, sandbox.ts).
  • Upgrades the backend MCP server (floor_plan_server.py) to a persistent SSE architecture using Starlette.
  • Configures agent.py to connect via mcp.client.sse.
  • Refines Vite configuration for seamless dual-origin local development.

Description

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. For larger changes, raising an issue first helps reduce redundant work.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

- Adds McpAppsCustomComponent using the official @modelcontextprotocol/ext-apps SDK.
- Implements double-iframe sandbox isolation (sandbox.html, sandbox.ts).
- Upgrades the backend MCP server (floor_plan_server.py) to a persistent SSE architecture using Starlette.
- Configures agent.py to connect via mcp.client.sse.
- Refines Vite configuration for seamless dual-origin local development.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 integrates MCP Apps into A2UI by adding a new McpAppsCustomComponent, a double-iframe sandbox for security, and a persistent SSE backend. The changes are significant and well-structured. My review focuses on improving security and configuration management. I've identified critical security issues related to postMessage usage that should be addressed. Additionally, there are opportunities to improve maintainability by removing hardcoded URLs and making the code more robust. The repository's style guide requires tests for new code (line 17), which seem to be missing for the new components and server logic. Please consider adding tests to ensure the stability and correctness of these new features.

@dmandar dmandar requested review from sugoi-yuzuru and wrenj March 4, 2026 01:26
- Extract location action logic in ContactAgent.stream into _handle_action
- Provide code comments clarifying action intent for UI surfaces
- Extract location-surface into LOCATION_SURFACE_ID constant
- Rename McpAppsCustomComponent to McpApp
@dmandar dmandar enabled auto-merge (squash) March 13, 2026 06:43

# Registry for bidirectional format conversion:
#
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we revert lines that are non-operational to reduce the change needed for review to be limited to operational changes?

…d fix a2ui schema validation for multi-surface payloads
Copy link
Collaborator

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

Let's get this in.

@dmandar dmandar merged commit 0cb1c51 into main Mar 13, 2026
13 checks passed
@dmandar dmandar deleted the md-mcpuinew branch March 13, 2026 19:28
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 13, 2026
# Load the first inline catalog schema.
inline_catalog_schema = inline_catalogs[0]
inline_catalog_schema = self._apply_modifiers(inline_catalog_schema)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit of a code smell to me.

In line 139 we add a prescription that client can only provide one or the other; inline or supported catalog.

But here, we are now implicitly baking the standard catalog.

1 ) Clients might NOT want standard catalog components included in responses.
2) component name overlaps could result in unexpected behavior without safe-guards

Can we revert this change and perhaps consider a more hi-fi solution to achieve this effect?

surface_id = None
if "surfaceUpdate" in message: # v0.8
components = message["surfaceUpdate"].get(COMPONENTS)
surface_id = message["surfaceUpdate"].get("surfaceId")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use constants for "surfaceId"

ref_map = _extract_component_ref_fields(self._catalog)
root_id = _find_root_id(messages, surface_id)
_validate_component_integrity(root_id, components, ref_map)
_validate_topology(root_id, components, ref_map)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Making root_id optional and the validation to be prone to pass when root id is absent seems making this validator brittle and false-negative prone.

inner.style.cssText = "width:100%; height:100%; border:none;";
inner.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
document.body.appendChild(inner);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we import these from the library so that we aren't exposed to misalignment in the future?

import {
SANDBOX_PROXY_READY_METHOD,
SANDBOX_RESOURCE_READY_METHOD
} from '@modelcontextprotocol/ext-apps/app-bridge';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants