-
Notifications
You must be signed in to change notification settings - Fork 213
Description
https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx#server-behavior describes that servers SHOULD check client capabilities before registering UI-enabled tools, using the getUiCapability helper from the SDK.
However, server.getClientCapabilities() does not include extensions, so getUiCapability helper will never be able to get the right extension (i.e. uiCap?.mimeTypes?.includes(RESOURCE_MIME_TYPE) always returns false).
Verified first with logging (using the Claude desktop app). The raw JSON RPC looks like this, which includes extensions:
And logged JSON.stringify(server.getClientCapabilities()), which ends up being {}, dropping extensions attribute.
Took shallow dive into code:
- Request handler for
initializeusessetRequestHandler: https://github.com/modelcontextprotocol/typescript-sdk/blob/f88c376c52e56f0c68d9f7a6bc322095bf3b0449/packages/server/src/server/server.ts#L114 setRequestHandleruses a request schema and parses using it: https://github.com/modelcontextprotocol/typescript-sdk/blob/f88c376c52e56f0c68d9f7a6bc322095bf3b0449/packages/core/src/shared/protocol.ts#L1493- The request schema for
initializedoesn't yet includeextensions: https://github.com/modelcontextprotocol/typescript-sdk/blob/f88c376c52e56f0c68d9f7a6bc322095bf3b0449/packages/core/src/types/types.ts#L2644
This prevents us from using getUiCapability helper from the SDK to be able to gate registering UI-enabled tools.
Seems like this should've been added as part of modelcontextprotocol/modelcontextprotocol#1724?