Skip to content
GitHub Security Advisories·Indexed by this site · Originally publishedSelectedAttention40

MCP Python SDK: StreamableHTTP transport unbounded session accumulation leads to resource exhaustion

MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion

AI summary

The MCP Python SDK's Streamable HTTP stateful mode has a vulnerability where session state is not reclaimed, which can exhaust server memory with ordinary short requests. The advisory states that affected versions are 1.8.0 and higher before 1.30.0, and 2.0.0 and higher before 2.2.0; fixed versions are 1.30.0 and 2.2.0. The vulnerability stems from sessions having no expiration, client DELETE only ending the session but retaining the registration entry, sessions whose first request is rejected still lingering with running tasks, and no limit on the number of sessions, with each session also retaining parsed initialize parameters; only a restart can reclaim them. The fixed versions add two parameters, session_idle_timeout (default 1800 seconds) and max_sessions (default 10000), returning 404 and 503 respectively on timeout or exceeding the limit; live sessions still retain initialize parameters, about twice the 4 MiB request body limit. If upgrading is not possible, switch to stateless mode or restrict endpoint access.

Why it was selected

The advisory lists the affected version ranges and fixed versions for the MCP Python SDK; teams running their own Streamable HTTP servers can use this to determine whether they need to upgrade or switch to stateless mode.

Read originalgithub.com