feat(mcp-annotations): add SEP-1865 MCP Apps support#6182
Draft
apappascs wants to merge 1 commit into
Draft
Conversation
b2659e8 to
cdcf2d6
Compare
- add resourceUri, visibility, csp fields to @mcptool - create Visibility enum and @McpCsp annotation - add MetaUtils.buildUiMeta() and mergeMeta() helpers - update all 4 tool providers to use merged meta - add McpAppResult return type with text/structuredContent split - handle McpAppResult in convertValueToCallToolResult - add ui:// URI + MIME type validation to ResourceAdapter - add comprehensive tests for all new functionality Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
cdcf2d6 to
cae74b5
Compare
Contributor
Author
|
Reference Links for Reviewers ( @tzolov )
|
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.
Summary
Add SEP-1865 (MCP Apps) support to the
mcp-annotationsmodule, enabling Spring AI MCP servers to expose interactive UI widgets alongside their tools.What's included
@McpToolextensions —resourceUri,visibility, andcspfields to link tools to UI resources and control visibility (model-only, app-only, or both)Visibilityenum —MODELandAPPvisibility scopes@McpCspannotation — declare Content Security Policy domains (connectDomains,resourceDomains,redirectDomains) for widget sandboxingMcpAppResult— convenience return type that splitstext→content[](for the LLM) andstructuredContent(for the widget UI)MetaUtils—buildUiMeta()andmergeMeta()helpers to construct_meta.uiblocks per the SEP-1865 specResourceAdapter— validatesui://URIs andtext/html;profile=mcp-appMIME type for MCP App resourcesMcpAppResultTests,ResourceAdapterTests,MetaUtilsTest,SyncMcpToolProviderTestsExample usage
Context
SEP-1865 defines how MCP servers expose interactive UIs (widgets) that render inside AI chat clients (ChatGPT, Claude, etc.). This PR adds first-class annotation support so Spring AI developers can build MCP Apps with the same
@McpTool/@McpResourcepatterns they already use.Test plan
McpAppResultTests— verifies text/structuredContent splitResourceAdapterTests— validates ui:// URI and MIME type handlingMetaUtilsTest— tests meta construction and mergingSyncMcpToolProviderTests— verifies tool providers inject UI metadata