Skip to content

Commit 342a6b5

Browse files
committed
Close server session after handle stateless request
1 parent f55831e commit 342a6b5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mcp/server/streamable_http_manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ async def run_stateless_server(*, task_status: TaskStatus[None] = anyio.TASK_STA
190190
# Handle the HTTP request and return the response
191191
await http_transport.handle_request(scope, receive, send)
192192

193+
# Terminate the session after the request is handled
194+
await http_transport._terminate_session() # type: ignore[reportPrivateUsage]
195+
193196
async def _handle_stateful_request(
194197
self,
195198
scope: Scope,

0 commit comments

Comments
 (0)