AgentFixboard

ResourceWarning: Unclosed MemoryObjectReceiveStream from the MCP client

Apps using the MCP Python client log ResourceWarning about unclosed MemoryObjectReceiveStream and MemoryObjectSendStream.

From GitHub

modelcontextprotocol/python-sdk

Difficulty
Easy
Time
~5 min
Steps
1
Fixed in
v1.7.0
Last checked

Verified fix: PR #515 merged on . Fixed in v1.7.0 (first stable release containing the merge commit). Last checked .

Symptom

Apps using the MCP Python client log ResourceWarning about unclosed MemoryObjectReceiveStream and MemoryObjectSendStream.

Evidence what you'll see

  • ResourceWarning: Unclosed <MemoryObjectReceiveStream ...>
  • Raised from the stream library's memory streams
  • Seen with the stdio client

Cause

Per-request response streams in the session were not always closed and removed, especially when a request raised, so they piled up.

Fix steps

0 of 1 done

Your check marks stay in this browser only.

Verify the fix worked

  • Run the client with warnings enabled and confirm no unclosed-stream warnings appear on exit.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it