Repository navigation
Conversation
Vendor v0.9 MCP catalog functions (callMcpTool, jmespath, split, regexCapture, regexReplace, updateDataModel) into a2ui-bridge and update the Lit, Angular, and React basic catalog sample definitions to use basic_with_mcp. Add MCP_REQUEST and MCP_RESPONSE cross-frame proxy messaging between PreviewBridge (IframeMcpClient) and HostCommunication, backed by McpClientManagerService in the Composer shell. Add MCP server management in Settings and an MCP Servers toggle in ChatPanel that injects active server tool schemas into the LLM system prompt.
Update Standalone3pLlmClient to use gemini-3.7-flash with thinkingLevel set to ThinkingLevel.MEDIUM.
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive Model Context Protocol (MCP) support across the A2UI ecosystem, enabling preview surfaces to invoke live MCP tools. Key additions include a new Angular sample application with MCP catalog integration, core MCP data functions (such as callMcpTool, jmespath, and regex utilities), and a proxy client to route requests between the preview iframe and the parent shell. The shell has been updated with an MCP client manager, a configuration interface in Settings, and dynamic prompt injection of active tools into Gemini's system instructions. Feedback focuses on enhancing robustness against malformed external payloads, such as adding strict type guards before string operations, preventing asynchronous race conditions during server connection, validating MCP_REQUEST messages in the cross-frame validator, and defensively defaulting missing arguments to prevent runtime crashes.
⚡ A2UI Composer PR PreviewYour automated preview is successfully live (commit
|
sugoi-yuzuru
left a comment
There was a problem hiding this comment.
IIUC, there are duplicated code from A2UI's MCP catalog in this PR because the NPM package has not been released. Can we make sure we have a TODO and a README to discuss this in detail and these files are grouped so that we can eventually swap it out to the NPM reference import?
Isolate vendored A2UI MCP catalog source files within bridge/src/mcp/ by moving IframeMcpClient to bridge/src/iframe-mcp-client.ts. Add bridge/src/mcp/README.md detailing upstream origins, inventory mapping, temporary dependencies, and step-by-step instructions to swap vendored code with the official @a2ui/mcp-catalog package once released on NPM. Add TODO annotations across all vendored entry points, functions, and consumer imports. Update samples/ng-basic-with-mcp-catalog/README.md.
added todo and readme |
|
A couple of UI issues:
|
| @@ -0,0 +1,25 @@ | |||
| <!-- | |||
There was a problem hiding this comment.
Why do we need a whole new renderer for this? Can't we just add this into the existing ng-basic-catalog sample?
| /** | ||
| * Checks whether the active catalog includes `callMcpTool` to determine if the renderer supports MCP mode. | ||
| */ | ||
| export function doesCatalogSupportMcp(catalog: Catalog | null | undefined): boolean { |
There was a problem hiding this comment.
This doesn't seem to fit in this file.
I suggest it be a method on the McpClientManagerService.
| yarn --cwd shell start | ||
| ``` | ||
|
|
||
| ### Angular Basic with MCP Renderer (`ng-basic-with-mcp-catalog`) |
There was a problem hiding this comment.
This comment seems out of place -- it takes the two paragraphs that used to follow and moves them into this new section, where they don't belong.
| "@modelcontextprotocol/sdk": "1.30.0", | ||
| "jmespath": "0.16.0", | ||
| "re2js": "2.8.6", | ||
| "zod": "^4.1.12" |
There was a problem hiding this comment.
We shouldn't use the ^ prefix. Along with the ~ prefix, it means we never really know what versions are being used.
- Fold BasicWithMcpCatalog and MCP function schemas into samples/ng-basic-catalog and remove the duplicate samples/ng-basic-with-mcp-catalog workspace. - Restore README.md section structure under Starting the A2UI Composer. - Move doesCatalogSupportMcp from catalog-storage.model.ts into McpClientManagerService. - Pin zod dependency version to 4.6.5 without a caret prefix in bridge/package.json. - Replace the oversized Add Server button in Settings with a compact add_circle icon button, add inline URL editing, and add a Test connection button.
- Fold BasicWithMcpCatalog and MCP function schemas into samples/ng-basic-catalog and remove the duplicate samples/ng-basic-with-mcp-catalog workspace. - Restore README.md section structure under Starting the A2UI Composer. - Move doesCatalogSupportMcp from catalog-storage.model.ts into McpClientManagerService. - Pin zod dependency version to 4.6.5 without a caret prefix in bridge/package.json. - Replace the oversized Add Server button in Settings with a compact add_circle icon button, add inline URL editing, and add a Test connection button.
…tokens On wide screens the MCP Servers card, added to main in a2ui-project#219, fell into the left column under the tall configuration card and left a gap under Connection Status. Configuration now fills the left column, and status and MCP servers, both about what Composer is connected to, stack on the right. Narrow screens still show one column. Card titles, subtitles (including the MCP card's), section headings, and the API key help text use Material system typography tokens instead of fixed sizes and weights.
…tokens On wide screens the MCP Servers card, added to main in a2ui-project#219, fell into the left column under the tall configuration card and left a gap under Connection Status. Configuration now fills the left column, and status and MCP servers, both about what Composer is connected to, stack on the right. Narrow screens still show one column. Card titles, subtitles (including the MCP card's), section headings, and the API key help text use Material system typography tokens instead of fixed sizes and weights.
) * feat(settings): arrange configuration and diagnostics responsively Settings places configuration and connection diagnostics side by side on wide screens and stacks the cards when space is limited. The cards share header and body spacing, readable diagnostic logs, and the active theme. * fix(settings): place MCP servers beside status and use Material type tokens On wide screens the MCP Servers card, added to main in #219, fell into the left column under the tall configuration card and left a gap under Connection Status. Configuration now fills the left column, and status and MCP servers, both about what Composer is connected to, stack on the right. Narrow screens still show one column. Card titles, subtitles (including the MCP card's), section headings, and the API key help text use Material system typography tokens instead of fixed sizes and weights.
Screencast: https://screencast.googleplex.com/cast/NTM1Nzk5OTk3MDMyMDM4NHwzOTVlNzFmNS1jZg
Note: copied over MCP catalog typescript as the NPM for it is not available yet.
Summary
Adds end-to-end support for the A2UI Model Context Protocol (MCP) catalog (
basic_with_mcp), enabling A2UI surfaces in the preview iframe to execute live HTTP MCP tools via the Composer shell. Also updates the standalone chat LLM client togemini-3.7-flashwith medium thinking.Key Changes
1. Bridge MCP Function Catalog & Cross-Frame Client (
bridge/)callMcpTool,jmespath,split,regexCapture,regexReplace, andupdateDataModel) inbridge/src/mcp/.IframeMcpClientand extendsPreviewBridgewithMCP_REQUESTandMCP_RESPONSEmessage handling to proxy tool invocations from the sandboxed preview iframe to the parent shell.AngularBridge,LitBridge, andReactBridge.2. Angular Basic with MCP Sample Renderer (
samples/ng-basic-with-mcp-catalog/)samples/ng-basic-with-mcp-catalog) configured with thebasic_with_mcpschema and prebuilt usage examples.shell/src/config.json,CatalogStorageModel,README.md, and the GitHub Pages / PR preview build workflows.3. Shell MCP Client Manager & Host Communication (
shell/)McpClientManagerServiceusing@modelcontextprotocol/sdk(StreamableHTTPClientTransport) to manage HTTP MCP server connections, discover tool metadata (name,description,inputSchema,outputSchema), and route tool calls across active servers.HostCommunicationandCrossFrameValidatorto validate and handleMCP_REQUESTmessages from the preview iframe, dispatchMCP_RESPONSEpayloads, and recordmcp_responseentries in the raw message debug log.4. Settings UI, System Prompt Injection & LLM Model Update (
shell/)Settingsto add, remove, and inspect connected HTTP MCP servers and their discovered tools.ChatPromptFactoryServiceto append MCP usage instructions and discovered tool schemas to the system prompt when the active catalog declarescallMcpTool.ChatPanelto display the active MCP server count in the system instructions link when an MCP-enabled catalog is active.Standalone3pLlmClientto usegemini-3.7-flashwithThinkingLevel.MEDIUM.