Skip to content

fix(mcp-server): serve the configured MCP App sandbox metadata on resources/read - #3000

Draft
legreffier[bot] wants to merge 1 commit into
mcp-sdk-3-cleanupfrom
mcp-sdk-4-apps
Draft

legreffier[bot] wants to merge 1 commit into
mcp-sdk-3-cleanupfrom
mcp-sdk-4-apps

Conversation

@legreffier

@legreffier legreffier Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2995 (then #2994, #2993, #2990). Part of #2967.

Summary

  • Sandbox metadata on read: the tasks and diary-map MCP App resources were listed with the configured sandbox metadata (ui.domain from MCP_APP_DOMAIN, plus the CSP domain lists). But resources/read returned a default _meta.ui with no domain and empty CSP lists. Hosts prefer the read result's _meta.ui over the listing, so the configured domain never reached them on read. Production sets MCP_APP_DOMAIN, so this affects ChatGPT today; the bug predates the SDK migration. The read handlers now return the same metadata the resource is listed with.
  • Legacy tool key: the opener tools (tasks_app_open, entries_map_open) also carry the flat _meta["ui/resourceUri"] key that older hosts read, as @modelcontextprotocol/ext-apps' registerAppTool does.

Changes

  • apps/mcp-server/src/task-app.ts, src/entry-explore-app.ts: the read handlers take the listing's metadata.
  • apps/mcp-server/src/mcp-app-ui.ts: createMcpAppToolMeta adds ui/resourceUri.
  • apps/mcp-server/__tests__/mcp-apps.spec.ts (new): drives resources/read, resources/list and tools/list through the SDK handler with a configured sandbox. It fails without the fix.

Test plan

  • pnpm exec nx run-many -t typecheck lint test --projects=@moltnet/mcp-server,@moltnet/mcp-server-e2e: 244 unit tests
  • After deploy: open the tasks app and the diary map from ChatGPT

Follow-up

  • Upgrading @modelcontextprotocol/ext-apps to 2.x (the line that targets the v2 SDK) goes in its own PR.

No UI change in the apps themselves: only the sandbox metadata hosts receive.

…ources/read

The tasks and diary-map MCP App resources were listed with the configured
sandbox metadata (ui.domain from MCP_APP_DOMAIN and the CSP domains), but
resources/read returned a default _meta.ui with no domain and empty CSP
lists. Hosts prefer the read result's _meta.ui over the listing, so the
configured domain never reached them on read. The read handlers now return
the same metadata the resource is listed with.

The opener tools also carry the flat ui/resourceUri key older hosts read,
as ext-apps' registerAppTool does.

MoltNet-Diary: ac69955e-8c02-468d-8427-8f643c3df905

This branch has not been deployed

No deployments
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.

0 participants