@@ -428,9 +428,9 @@ async def run_stdio_async(self) -> None:
428
428
async def run_sse_async (self ) -> None :
429
429
"""Run the server using SSE transport."""
430
430
from starlette .applications import Starlette
431
- from starlette .routing import Route
431
+ from starlette .routing import Route , Mount
432
432
433
- sse = SseServerTransport ("/messages" )
433
+ sse = SseServerTransport ("/messages/ " )
434
434
435
435
async def handle_sse (request ):
436
436
async with sse .connect_sse (
@@ -442,14 +442,11 @@ async def handle_sse(request):
442
442
self ._mcp_server .create_initialization_options (),
443
443
)
444
444
445
- async def handle_messages (request ):
446
- await sse .handle_post_message (request .scope , request .receive , request ._send )
447
-
448
445
starlette_app = Starlette (
449
446
debug = self .settings .debug ,
450
447
routes = [
451
448
Route ("/sse" , endpoint = handle_sse ),
452
- Route ("/messages" , endpoint = handle_messages , methods = [ "POST" ] ),
449
+ Mount ("/messages/ " , app = sse . handle_post_message ),
453
450
],
454
451
)
455
452
0 commit comments