Fix: wire WORKSPACE_MCP_STATELESS_MODE to FastMCP's stateless_http parameter
WORKSPACE_MCP_STATELESS_MODE=true was already read, validated, and used to
configure the OAuth layer — but was never passed to server.run(). FastMCP
therefore always ran in stateful mode, keeping session state in memory.
On pod/process restart all in-memory sessions are lost, causing clients to
receive {"code":-32600,"message":"Session not found"} on their next request.
Passes stateless_http=is_stateless_mode() to server.run() so FastMCP drops
session tracking when stateless mode is configured, matching what the env var
already advertises.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
7
main.py
7
main.py
@@ -517,7 +517,12 @@ def main():
|
|||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
server.run(transport="streamable-http", host=host, port=port)
|
server.run(
|
||||||
|
transport="streamable-http",
|
||||||
|
host=host,
|
||||||
|
port=port,
|
||||||
|
stateless_http=is_stateless_mode(),
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
server.run()
|
server.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user