modelcontextprotocol / modelcontextprotocol/typescript-sdk

Streamable HTTP: JSON-response-mode stream mappings never complete their lifecycle

Open
#2,559 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 ready for work v1 v2
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

With enableJsonResponse: true on a stateful transport, send() resolves the pending Response via resolveJson but never runs the mapping's cleanup, so every completed POST leaks one _streamMapping entry until close(). Conversely, cleanup only deletes the entry without settling the promise, so close() during an in-flight JSON-mode POST leaves the HTTP request hanging.

Pre-existing on both main and v1.x. Split out from the review discussion on #2547.

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 stateful transport's send(), resolveJson, cleanup, and close paths, following _streamMapping for enableJsonResponse requests. Reproduce both a completed POST and close during an in-flight POST, then add coverage showing completed mappings are removed and closed requests settle.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.