From d0945d99a3e9b1c7d34cc25b6eaca0104cacaabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20VACHOT?= Date: Sun, 30 Nov 2025 02:10:51 +0100 Subject: [PATCH] Fix uvicorn to run for all types of transport --- src/geoguessr_mcp/main.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/geoguessr_mcp/main.py b/src/geoguessr_mcp/main.py index 2d8113b..5bb63bf 100644 --- a/src/geoguessr_mcp/main.py +++ b/src/geoguessr_mcp/main.py @@ -105,23 +105,12 @@ def main(): ) # Run the server with the modified app (with middleware) - # Note: We cannot use mcp.run() as it creates a new app instance without our middleware - if settings.TRANSPORT == "streamable-http": - # Run uvicorn directly with our middleware-enhanced app - uvicorn.run( - mcp_app, - host=settings.HOST, - port=settings.PORT, - log_level=settings.LOG_LEVEL.lower(), - ) - else: - # For other transports (SSE), use the default run method - # Note: SSE transport may not support custom middleware - logger.warning( - "Using mcp.run() for non-streamable-http transport. " - "CORS middleware may not be applied." - ) - mcp.run(transport=settings.TRANSPORT) + uvicorn.run( + mcp_app, + host=settings.HOST, + port=settings.PORT, + log_level=settings.LOG_LEVEL.lower(), + ) if __name__ == "__main__":