mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 23:04:25 +01:00
Fix inconsistencies in examples
This commit is contained in:
@@ -106,7 +106,7 @@ def main(port: int, transport: str) -> int:
|
|||||||
debug=True,
|
debug=True,
|
||||||
routes=[
|
routes=[
|
||||||
Route("/sse", endpoint=handle_sse),
|
Route("/sse", endpoint=handle_sse),
|
||||||
Mount("/messages/", app=sse.handle_post_message)
|
Mount("/messages/", app=sse.handle_post_message),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Example usage:
|
|||||||
# Create Starlette routes for SSE and message handling
|
# Create Starlette routes for SSE and message handling
|
||||||
routes = [
|
routes = [
|
||||||
Route("/sse", endpoint=handle_sse),
|
Route("/sse", endpoint=handle_sse),
|
||||||
Mount("/messages", endpoint=handle_messages, methods=["POST"])
|
Mount("/messages", app=sse.handle_post_message),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Define handler functions
|
# Define handler functions
|
||||||
@@ -23,9 +23,6 @@ Example usage:
|
|||||||
streams[0], streams[1], app.create_initialization_options()
|
streams[0], streams[1], app.create_initialization_options()
|
||||||
)
|
)
|
||||||
|
|
||||||
async def handle_messages(request):
|
|
||||||
await sse.handle_post_message(request.scope, request.receive, request._send)
|
|
||||||
|
|
||||||
# Create and run Starlette app
|
# Create and run Starlette app
|
||||||
starlette_app = Starlette(routes=routes)
|
starlette_app = Starlette(routes=routes)
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
||||||
|
|||||||
Reference in New Issue
Block a user