fix(server): handle multiple lifespan runs and module-scoped testclient
This commit is contained in:
1 parent
15339a62f2
commit
b75e952738
2 files changed
+60
-56
No files matched your search
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user