feat(mcp-annotations): add SEP-1865 MCP Apps support - #6182
Open
apappascs wants to merge 2 commits into
Open
Conversation
apappascs
force-pushed
the
feature/mcp-apps-sep-1865
branch
from
May 27, 2026 09:37
b2659e8 to
cdcf2d6
Compare
apappascs
marked this pull request as draft
May 27, 2026 09:37
apappascs
force-pushed
the
feature/mcp-apps-sep-1865
branch
from
May 27, 2026 09:43
cdcf2d6 to
cae74b5
Compare
Contributor
Author
|
Reference Links for Reviewers ( @tzolov )
|
- 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>
… findings - fix McpAppResult handler dead-code path: move instanceof branch before STRUCTURED branch in AbstractMcpToolMethodCallback; null guard moved before both branches - exclude McpAppResult from output-schema generation in all 4 providers (Sync, SyncStateless, Async, AsyncStateless) — it is a wire-format container, not a structured data output - fix ui/resourceUri flat alias diverging from nested ui.resourceUri after MetaProvider override in MetaUtils.mergeMeta - extract duplicated ui:// vs MIME validation into validateMcpAppResource() helper in ResourceAdapter; add case-insensitive scheme matching (RFC 3986) and whitespace/case-lenient MIME comparison - add McpAppResult compact-constructor: both-null throws IllegalArgumentException - add @author Alexandros Pappas to McpAppResult.java - fix buildUiMeta blank-URI guard: isEmpty() -> isBlank() - document CSP domain format (full origins) in McpCsp javadoc; align test value from bare domain to https://api.example.com - fix contradictory comments in testToolWithResourceUriAndMetaProviderMerge - add generateOutputSchema=true E2E tests for McpAppResult across all 4 provider test classes; add UI-meta smoke tests to Async, AsyncStateless, SyncStateless providers Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
apappascs
force-pushed
the
feature/mcp-apps-sep-1865
branch
from
June 12, 2026 12:22
0e82b86 to
92eb063
Compare
apappascs
marked this pull request as ready for review
June 15, 2026 08:52
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