Skip to content

Omit app-only ui_get unless the client advertises MCP Apps - #3687

Open
vshalpnjabi wants to merge 6 commits into
github:mainfrom
vshalpnjabi:fix-ui-get-apps-capability-3683
Open

vshalpnjabi wants to merge 6 commits into
github:mainfrom
vshalpnjabi:fix-ui-get-apps-capability-3683

Conversation

@vshalpnjabi

@vshalpnjabi vshalpnjabi commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

Do not list the app-only ui_get tool to clients that lack MCP Apps support, on both the remote (HTTP) server and the local stdio server.

Why

ui_get is marked _meta.ui.visibility: ["app"]. Apps hosts hide that from the model; other clients ignore the meta and hand the helper to the model, wasting tokens.

A client that supports Apps declares extensions["io.modelcontextprotocol/ui"]. The remote server already parses those capabilities on tools/list, but the strip path only checked the HasUISupport context flag, which HTTP never set. Empty capabilities therefore still listed ui_get. Stdio registers tools before initialize, so client capabilities aren't known at registration and ui_get was always listed there too (reported on the issue for v2.1.0 stdio --toolsets all).

What changed

  • shouldStripMCPAppsMetadata now treats parsed ClientCapabilities as an explicit capability source: no io.modelcontextprotocol/ui extension → omit app-only tools; extension present → keep ui_get.
  • For stdio, app-only tools are filtered per session at tools/list from the session's declared capabilities, following the existing availability middleware pattern. ui_get stays callable for MCP App views.

Lint & tests

  • go build ./..., go test ./...
  • ./script/lint (0 issues)
  • Test_UIGet_ListedOnlyWhenClientAdvertisesMCPAppsCapability
  • Session-level in-memory tests for clients with and without MCP Apps support

AI-assisted; I reviewed the full diff and ran the tests myself.

Fixes #3683

Remote tools/list already parses client capabilities into MCPMethodInfo,
but the strip decision only checked the HasUISupport context flag, which
HTTP never sets. Clients that sent empty capabilities still received
ui_get.

Honor parsed ClientCapabilities and omit app-only tools unless the
client advertises extensions["io.modelcontextprotocol/ui"].
@vshalpnjabi
vshalpnjabi requested a review from a team as a code owner November 5, 2026 15:39
Copilot AI adaptive review requested due to automatic review settings November 5, 2026 15:39

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the capability-based filtering of the app-only ui_get tool.

No open issues 🎉

What changed in this PR

Addresses #3683 by using parsed client capabilities to omit the app-only ui_get tool from clients without MCP Apps support, avoiding unnecessary tool exposure to the model.

Changes:

  • Falls back to parsed capabilities when the explicit UI-support flag is absent, preserving behavior when capabilities are unknown.
  • Adds tests for capability-based metadata stripping and ui_get visibility.
File Description
pkg/​inventory/​registry.go Adds capability-based fallback to the MCP Apps metadata-stripping decision.
pkg/​inventory/​registry_test.go Tests stripping with and without the MCP Apps extension.
pkg/​github/​ui_tools_test.go Verifies ui_get visibility based on parsed client capabilities.

Review effort: Balanced (auto)

@vshalpnjabi

Copy link
Copy Markdown
Author

@SamMorrowDrums @omgitsads Friendly ping — this has one approval and green checks. Ready for a maintainer look when you have a minute. Thanks!

cursoragent and others added 4 commits November 10, 2026 04:58
Stdio registers tools before initialize, so client capabilities are not
available at registration. Filter app-only tools such as ui_get per
session at tools/list from the client's declared capabilities.
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.

Remote server lists the app-only ui_get tool to clients without MCP Apps support

4 participants