feat(server): backport MCP Apps UI support to v20251125 - #4060
pjmsmithgoogle wants to merge 2 commits into
Conversation
## Description MCP Apps (interactive UI resources and tool metadata) was introduced only under the latest protocol version (`2026-07-28`). Many production MCP clients and host integrations negotiate earlier MCP protocol versions. When connecting with these clients, MCP Apps metadata and UI resource fetching were previously unavailable or stripped from tool manifests and resource handlers. In earlier MCP schemas (such as `2025-11-25`), the protocol did not define an `extensions` capability block on `ServerCapabilities`. Conforming with the specification and existing Toolbox convention for older schemas (see googleapis#3300), tools preserve and transmit their UI metadata via `_meta.ui` on `tools/list`. This change backports MCP Apps support to `v20251125`: - Preserves and serializes `_meta.ui` on tools in tool manifests (`tools/list`). - Supports reading registered UI resources via `resources/read`. - Shares UI metadata resolution logic in `internal/server/mcp/util/ui.go`. - Adds unit tests verifying UI metadata generation and serialization for `v20251125`. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! - [x] Ensure you have manually reviewed the entire diff before requesting a review - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes googleapis#4055
There was a problem hiding this comment.
Code Review
This pull request introduces support for resolving and including UI metadata in tool manifests and resource read results. It adds a utility function ResolveToolUIMetadata to resolve UI resources and templates, integrates it into the tool manifest generation, and updates resource reading to append UI metadata. The review feedback suggests simplifying ResolveToolUIMetadata by removing its unused error return parameter, which always returns nil, and updating its call sites accordingly to eliminate redundant error handling.
…UI metadata in v20251125
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for UI metadata in tools and resources. It adds a utility function ResolveToolUIMetadata to resolve UI resources and templates for tools, integrates this metadata into the tool manifests under the 'ui' key, and updates the resource read handler to include UI metadata in the read results. Additionally, UI resources and templates are now globally accessible. There are no review comments to address.
Description
MCP Apps (interactive UI resources and tool metadata) was introduced only under the latest protocol version (
2026-07-28). Many production MCP clients and host integrations negotiate earlier MCP protocol versions. When connecting with these clients, MCP Apps metadata and UI resource fetching were previously unavailable or stripped from tool manifests and resource handlers.In earlier MCP schemas (such as
2025-11-25), the protocol did not define anextensionscapability block onServerCapabilities. Conforming with the specification and existing Toolbox convention for older schemas (see #3300), tools preserve and transmit their UI metadata via_meta.uiontools/list.This change backports MCP Apps support to
v20251125:_meta.uion tools in tool manifests (tools/list).resources/read.internal/server/mcp/util/ui.go.v20251125.PR Checklist
🛠️ Fixes #4055