feat: add MCP Apps support (renders_ui DSL, weather dashboard demo)#212
Open
crisnahine wants to merge 1 commit intoseuros:masterfrom
Open
feat: add MCP Apps support (renders_ui DSL, weather dashboard demo)#212crisnahine wants to merge 1 commit intoseuros:masterfrom
crisnahine wants to merge 1 commit intoseuros:masterfrom
Conversation
3aca819 to
4113d32
Compare
Contributor
Author
|
rebased onto master, CI green on the new base. three corrections since the previous push:
|
per ext-apps draft spec (2026-01-26). closes seuros#202. - ActionMCP::MIME_TYPE_APP_HTML constant for text/html;profile=mcp-app - renders_ui "ui://..." class macro on Tool with optional visibility kwarg. validates URI scheme and visibility values at class-load time. emits nested _meta.ui.resourceUri only, no legacy flat _meta["ui/resourceUri"] anywhere (pinned by a negative test). - Capability#client_supports_ui? instance helper. key-presence check on capabilities.extensions["io.modelcontextprotocol/ui"]. lives on Capability so any tool/prompt/resource_template can call it. - weather dashboard resource template at ui://weather/dashboard with self-contained HTML. csp connectDomains and prefersBorder are emitted on the resource content (resources/read), following the apps.mdx canonical examples. - existing weather tool gets renders_ui. text and structured output are preserved. per apps.mdx, tools/list filtering by visibility is host-side; no server-side filter is added. ToolsRegistry.items is snapshotted and restored in setup/teardown since Class.new(ActionMCP::Tool) fires the inherited hook before abstract! can run, briefly leaking the unnamed class under the "" key. matches the snapshot/restore pattern in resource_templates_registry_test.rb.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implements MCP Apps support per ext-apps draft spec (2026-01-26). closes #202.
changes
ActionMCP::MIME_TYPE_APP_HTMLconstant (text/html;profile=mcp-app)renders_ui "ui://..."class macro onTool. validates URI scheme and visibility values at class-load time. emits nested_meta.ui.resourceUrionly, no legacy flat_meta["ui/resourceUri"]anywhere (pinned by a negative test).Capability#client_supports_ui?instance helper. key-presence check oncapabilities.extensions["io.modelcontextprotocol/ui"]. lives onCapabilityso any tool/prompt/resource_template can call it.WeatherDashboardTemplateatui://weather/dashboardwith self-contained HTML. cspconnectDomainsandprefersBorderare emitted on the resource content (resources/read), following the apps.mdx canonical examples.WeatherToolgetsrenders_ui. text and structured output are preserved.tests
test/action_mcp/mcp_apps_test.rb, 13 tests:renders_uihappy path with and withoutvisibility:meta(...)on orthogonal keysui/resourceUrikey is never emittedui://, emptyclient_supports_ui?: extension present, extension absent, no session, nil capabilitiesspec compliance
_meta.ui.resourceUrinested only, per apps.mdx Tool Metadata sectiontools/listfiltering by visibility is host-side per apps.mdx, no server-side filter addedresources/readcontent payload, following the apps.mdx canonical examplesnotes