Skip to content

feat(server): backport MCP Apps UI support to v20241105 - #4057

Open
pjmsmithgoogle wants to merge 2 commits into
googleapis:mainfrom
pjmsmithgoogle:backport-mcp-apps-v20241105
Open

pjmsmithgoogle wants to merge 2 commits into
googleapis:mainfrom
pjmsmithgoogle:backport-mcp-apps-v20241105

Conversation

@pjmsmithgoogle

Copy link
Copy Markdown

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, such as Gemini Enterprise, currently negotiate earlier MCP protocol versions (e.g., 2024-11-05). 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 2024-11-05), the protocol did not define an extensions capability block on ServerCapabilities. Conforming with the specification and existing Toolbox convention for older schemas (see #3300), tools preserve and transmit their UI metadata via _meta.ui on tools/list.

This change backports MCP Apps support to v20241105:

  • 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 v20241105.

PR Checklist

  • Make sure you reviewed CONTRIBUTING.md
  • Make sure to open an issue as a bug/issue before writing your code!
  • Ensure you have manually reviewed the entire diff before requesting a review
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

🛠️ Fixes #4055

## 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, such as Gemini Enterprise, currently negotiate earlier MCP protocol versions (e.g., `2024-11-05`). 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 `2024-11-05`), 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 `v20241105`:
- 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 `v20241105`.

## 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
@pjmsmithgoogle
pjmsmithgoogle requested a review from a team as a code owner September 16, 2026 21:27

@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 support for UI metadata in tools and resources. It adds a utility function to resolve a tool's UI resource, updates tool manifest generation to include UI metadata, and enhances resource reading to attach UI metadata to resource contents. Additionally, UI resources and templates are now globally accessible. The review feedback suggests improving error handling in ResolveToolUIMetadata by returning a descriptive error when a specified UI resource is not registered, rather than silently returning an empty URI, and avoiding unnecessary defensive nil checks.

Comment thread internal/server/mcp/util/ui.go
@pjmsmithgoogle

Copy link
Copy Markdown
Author

/gemini review

@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 support for UI metadata in tools and resources. It adds a utility function ResolveToolUIMetadata to resolve UI resources and templates, and updates the tool manifest generation to include this UI metadata under the "ui" key. Additionally, it updates resource resolution and reading handlers to globally support UI resources and templates, attaching UI metadata to the resource read results and contents. Unit tests have been updated to cover these changes. No review comments were provided, so there is no additional feedback.

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.

Backport MCP Apps support to older protocol versions

2 participants