Skip to content

feat(server): backport MCP Apps UI support to v20251125 - #4060

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

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

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 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 #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

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

@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 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.

Comment thread internal/server/mcp/util/ui.go
Comment thread internal/server/mcp/v20251125/manifests.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 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.

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