Restore and update handle_post_message implementation (#3152)
This commit is contained in:
@@ -410,28 +410,26 @@ async def handle_get_message(request: Request):
|
|||||||
async def handle_post_message(request: Request):
|
async def handle_post_message(request: Request):
|
||||||
return await handle_post_message(request)
|
return await handle_post_message(request)
|
||||||
|
|
||||||
# async def handle_post_message(request: Request):
|
async def handle_post_message(request: Request):
|
||||||
# """Handle POST messages for SSE"""
|
"""Handle POST messages for SSE"""
|
||||||
# try:
|
try:
|
||||||
# body = await request.body()
|
body = await request.body()
|
||||||
|
|
||||||
# # Create a simple receive function that returns the body
|
# Create a simple receive function that returns the body
|
||||||
# async def receive():
|
async def receive():
|
||||||
# return {"type": "http.request", "body": body, "more_body": False}
|
return {"type": "http.request", "body": body, "more_body": False}
|
||||||
|
|
||||||
# # Create a simple send function that does nothing
|
# Create a simple send function that does nothing
|
||||||
# async def send(message):
|
async def send(message):
|
||||||
# return {}
|
return {}
|
||||||
|
|
||||||
# # Call handle_post_message with the correct arguments
|
# Call handle_post_message with the correct arguments
|
||||||
# await sse.handle_post_message(request.scope, receive, send)
|
await sse.handle_post_message(request.scope, receive, send)
|
||||||
|
|
||||||
# # Return a success response
|
# Return a success response
|
||||||
# return {"status": "ok"}
|
return {"status": "ok"}
|
||||||
# finally:
|
finally:
|
||||||
# pass
|
pass
|
||||||
# # Clean up context variable
|
|
||||||
# # client_name_var.reset(client_token)
|
|
||||||
|
|
||||||
def setup_mcp_server(app: FastAPI):
|
def setup_mcp_server(app: FastAPI):
|
||||||
"""Setup MCP server with the FastAPI application"""
|
"""Setup MCP server with the FastAPI application"""
|
||||||
|
|||||||
Reference in New Issue
Block a user