Skip to content

fix(mcp-apps-server): put CSP meta on resource read response - #140

Open
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/mcp-apps-csp-on-resource-response-136
Open

fix(mcp-apps-server): put CSP meta on resource read response#140
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/mcp-apps-csp-on-resource-response-136

Conversation

@arimu1

@arimu1 arimu1 commented Jul 26, 2026

Copy link
Copy Markdown

Summary

Fixes #136

The MCP Apps spec requires _meta.ui.csp (and related UI metadata) on the contents[] objects returned by the resource read callback, not on the resource definition registered via @McpResource / metaProvider.

This change:

  • Removes CspMetaProvider from the @McpResource registration
  • Returns ReadResourceResult with TextResourceContents that carries _meta.ui.csp.resourceDomains for https://unpkg.com
  • Keeps tool-level DiceMetaProvider (_meta.ui.resourceUri) unchanged — that belongs on the tool, not the resource definition

Test plan

  • ./gradlew build in model-context-protocol/mcp-apps-server (Java 25 toolchain)
  • Spring context loads (McpAppsServerApplicationTests)

AI assistance disclosure

This fix was AI-assisted (Composer/Cursor) and human-reviewed per Spring AI CONTRIBUTING accountability guidelines.

Made with Cursor

@arimu1
arimu1 force-pushed the fix/mcp-apps-csp-on-resource-response-136 branch from b11efad to facd414 Compare July 26, 2026 03:51
Per MCP Apps spec, _meta.ui.csp belongs on contents[] objects
returned by the resource read callback, not on the resource
definition via metaProvider.

Fixes spring-projects#136

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
@arimu1
arimu1 force-pushed the fix/mcp-apps-csp-on-resource-response-136 branch from facd414 to 47cc2f5 Compare July 26, 2026 03:51
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.

MCP Apps server example CSP config is incorrect

1 participant