modelcontextprotocol / modelcontextprotocol/go-sdk

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

Open
#1,169 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3
Dominant language
Go
Stars
5.1k
Forks
543
Avg merge
1d 17h
Merged PRs (30d)
37

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Go Client.Connect entry point and the regression test described in the issue, then trace the server/discover and subscriptions/listen requests when ToolListChangedHandler is configured. Run the fake streamable server test and verify that a rejected subscriptions/listen JSON-RPC request makes Connect return the surfaced error rather than a usable session.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.