Description
In stateless HTTP mode, every request logs INFO:mcp.server.streamable_http:Terminating session: None. This is correct behavior — stateless mode creates a new transport with mcp_session_id=None per request and terminates it afterward — but the message is confusing to end users who see it and assume their connection is failing or being dropped.
I maintain an MCP server (ha-mcp) that runs in stateless mode, and this log message regularly causes confusion among users who think they aren't connected.
Suggested change
Differentiate the log message for stateless (session-less) terminations:
# Current (streamable_http.py):
logger.info(f"Terminating session: {self.mcp_session_id}")
# Suggested:
if self.mcp_session_id:
logger.info(f"Terminating session: {self.mcp_session_id}")
else:
logger.debug("Stateless request completed, cleaning up transport")
This would:
- Downgrade stateless cleanup to
DEBUG (routine, not noteworthy)
- Use wording that doesn't alarm users ("completed" vs "Terminating")
- Keep the existing
INFO-level log for actual session terminations
References
Description
In stateless HTTP mode, every request logs
INFO:mcp.server.streamable_http:Terminating session: None. This is correct behavior — stateless mode creates a new transport withmcp_session_id=Noneper request and terminates it afterward — but the message is confusing to end users who see it and assume their connection is failing or being dropped.I maintain an MCP server (ha-mcp) that runs in stateless mode, and this log message regularly causes confusion among users who think they aren't connected.
Suggested change
Differentiate the log message for stateless (session-less) terminations:
This would:
DEBUG(routine, not noteworthy)INFO-level log for actual session terminationsReferences
streamable_http.pyterminate() methodstreamable_http_manager.py_handle_stateless_request()