File tree Expand file tree Collapse file tree
libs/arcade-mcp-server/arcade_mcp_server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,6 +320,32 @@ def create_arcade_mcp_factory() -> FastAPI:
320320 )
321321
322322
323+ async def serve_with_force_quit (
324+ app : FastAPI ,
325+ host : str ,
326+ port : int ,
327+ log_level : str ,
328+ ) -> None :
329+ """Serve the FastAPI app with force quit capability."""
330+ timeout_graceful_shutdown = int (
331+ os .environ .get ("ARCADE_UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN" , "15" )
332+ )
333+
334+ config = uvicorn .Config (
335+ app = app ,
336+ host = host ,
337+ port = port ,
338+ log_level = log_level ,
339+ lifespan = "on" ,
340+ timeout_graceful_shutdown = timeout_graceful_shutdown ,
341+ )
342+
343+ task_tracker = app .state .task_tracker
344+ server = CustomUvicornServer (config , task_tracker )
345+
346+ await server .serve ()
347+
348+
323349def run_arcade_mcp (
324350 host : str = "127.0.0.1" ,
325351 port : int = 8000 ,
@@ -379,6 +405,7 @@ def run_arcade_mcp(
379405 log_level = log_level ,
380406 reload = reload ,
381407 lifespan = "on" ,
408+ workers = 1 ,
382409 )
383410 else :
384411 uvicorn .run (
You can’t perform that action at this time.
0 commit comments