Skip to content

mcp: Client.Connect succeeds after subscriptions/listen is rejected #1169

Description

@jstar0

When a v2026-07-28 streamable HTTP client has notification handlers installed, Client.Connect opens subscriptions/listen after server/discover. If the server immediately rejects that subscriptions/listen request with a JSON-RPC error, Connect currently still returns a usable session.

What I did:

I added a regression test with a fake streamable server that returns a successful server/discover response, then returns a JSON-RPC InvalidParams error for subscriptions/listen. The client is configured with ToolListChangedHandler so it attempts the listen call during connect.

What I saw:

On current origin/main at 64e454e35c23, the regression test fails because Connect succeeds even though the listen request was rejected.

What I expected:

Connect should fail and surface the subscriptions/listen error. Otherwise callers believe notification subscriptions are active when the server already rejected them.

Version:

origin/main at 64e454e35c23

Go version:

go version go1.26.5 darwin/arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge cases

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions