fix(server): handle multiple lifespan runs and module-scoped testclient

This commit is contained in:
bolbol committed 2026-10-28 08:13:32 +00:00
1 parent 15339a62f2
commit b75e952738
2 files changed
+60 -56

No files matched your search

+3
View File
@@ -213,6 +213,9 @@ async def health(request):
@asynccontextmanager
async def lifespan(app_instance):
global session_manager
if getattr(session_manager, "_has_started", False):
session_manager = StreamableHTTPSessionManager(mcp._mcp_server, stateless=True, json_response=True)
async with session_manager.run():
yield