The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
Restore and update handle_post_message implementation (#3152)
Saket Aryanbcc5f4294113
diff --git a/openmemory/api/app/mcp_server.py b/openmemory/api/app/mcp_server.pyindex f4759628b..914eb15b3 100644--- a/openmemory/api/app/mcp_server.py+++ b/openmemory/api/app/mcp_server.py@@ -410,28 +410,26 @@ async def handle_get_message(request: Request):async def handle_post_message(request: Request):return await handle_post_message(request)-# async def handle_post_message(request: Request):-# """Handle POST messages for SSE"""-# try:-# body = await request.body()--# # Create a simple receive function that returns the body-# async def receive():-# return {"type": "http.request", "body": body, "more_body": False}--# # Create a simple send function that does nothing-# async def send(message):-# return {}--# # Call handle_post_message with the correct arguments-# await sse.handle_post_message(request.scope, receive, send)--# # Return a success response-# return {"status": "ok"}-# finally:-# pass-# # Clean up context variable-# # client_name_var.reset(client_token)+async def handle_post_message(request: Request):+ """Handle POST messages for SSE"""+ try:+ body = await request.body()++ # Create a simple receive function that returns the body+ async def receive():+ return {"type": "http.request", "body": body, "more_body": False}++ # Create a simple send function that does nothing+ async def send(message):+ return {}++ # Call handle_post_message with the correct arguments+ await sse.handle_post_message(request.scope, receive, send)++ # Return a success response+ return {"status": "ok"}+ finally:+ passdef setup_mcp_server(app: FastAPI):"""Setup MCP server with the FastAPI application"""