Skip to content

[TS SDK Bug] server.getClientCapabilities() does not seem to include extensions #521

@asana-jau

Description

@asana-jau

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:

Image

And logged JSON.stringify(server.getClientCapabilities()), which ends up being {}, dropping extensions attribute.

Took shallow dive into code:

  1. Request handler for initialize uses setRequestHandler: https://github.com/modelcontextprotocol/typescript-sdk/blob/f88c376c52e56f0c68d9f7a6bc322095bf3b0449/packages/server/src/server/server.ts#L114
  2. setRequestHandler uses a request schema and parses using it: https://github.com/modelcontextprotocol/typescript-sdk/blob/f88c376c52e56f0c68d9f7a6bc322095bf3b0449/packages/core/src/shared/protocol.ts#L1493
  3. The request schema for initialize doesn't yet include extensions: 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions