Skip to content

McpStatelessSyncServer should preemptively register a no-op handler for resources/subscribe #776

@rombert

Description

@rombert

Bug description
Certain non-compliant MCP clients try to subscribe for resource updates even if the MCP server reports no support for subscription.

I have seen this behaviour with Cursor 2.4.27 and 2.4.28.

This leads to the MCP server not intialising in Cursor due to internal errors: Failed to handle request: Missing handler for request type: resources/subscribe" .

Environment
MCP Java SDK 0.17.0
Cursor

Steps to reproduce

I am using a pretty standard MCP server setup

        syncServer = McpServer.sync(transportProvider)
                .serverInfo(config.serverTitle(), serverVersion)
                .jsonMapper(jsonMapper)
                .jsonSchemaValidator(new DefaultJsonSchemaValidator())
                .instructions(config.instructions())
                .completions(completions)
                .capabilities(ServerCapabilities.builder()
                        .tools(false)
                        .prompts(false)
                        .resources(false, false)
                        .completions()
                        .build())
                .build();

When connecting to the server from Cursor the connection fails

2026-02-06 15:15:15.122 [error] Client error for command Streamable HTTP error: Error POSTing to endpoint: (...) "message":"Failed to handle request: Missing handler for request type: resources/subscribe","suppressed":[],"localizedMessage":"Failed to handle request: Missing handler for request type: resources/subscribe"}

Expected behavior

I would expect the server to gracefully handle non-compliant clients that try to subscribe to updates. Failing that, I should be able to register a handler myself.

However, the API does not allow that.

I had to resort to reflectiont to access HttpServletStatelessServerTransport → mcpHandler → requestHandlers and then register a no-op handler

handlers.put(McpSchema.METHOD_RESOURCES_SUBSCRIBE, (context, params) -> Mono.just(Map.of()));

This is brittle and I would welcome either:

  • a default handler that prevents this error from happening
  • the ability to register handlers directly using a low-level API

Minimal Complete Reproducible example
N/A, sorry. But if the problem is not clear from the report let me know and I'll set something up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions