[OpenMemory] Cannot connect, 404 on `messages` route, wrong URL (?)
🐛 Describe the bug
Issue
If I look at the logs, they try to connect to the wrong /messages:
openmemory-mcp-1 | INFO: 192.168.65.1:42093 - "GET /mcp/cursor/sse/afstkla HTTP/1.1" 200 OK
openmemory-mcp-1 | INFO: 192.168.65.1:60370 - "POST /mcp/cursor/sse/afstkla/messages?session_id=<some_session_id> HTTP/1.1" 404 Not Found
According to the docs, it should POST to /mcp/messages instead of /mcp/cursor/sse/afstkla/messages, but I can't seem to figure out why it doesn't.
Setup
I've ran the instructions from the README, but none of Claude, Claude code, cursor or mcp inspector can connect.
I ran:
cp api/.env.example api/.env
# <set OpenAI key>
make build
make up
And then followed the npx install-mcp commands from the UI. Unfortunately, none of the clients seem to be able to connect, all fail in the same way.
Specs
- MacOS 15.4.1
- M2 MacBook
MCP Inspector
npx @modelcontextprotocol/inspector with npx -y supergateway --sse http://localhost:8765/mcp/cursor/sse/afstkla
[supergateway] Starting...
[supergateway] Supergateway is supported by Supermachine (hosted MCPs) - https://supermachine.ai [supergateway] - outputTransport: stdio [supergateway] - sse: http://localhost:8765/mcp/cursor/sse/afstkla [supergateway] - Headers: (none) [supergateway] Connecting to SSE...
[supergateway] Stdio server listening
[supergateway] Stdio → SSE: { jsonrpc: '2.0', id: 0, method: 'initialize', params: { protocolVersion: '2025-03-26', capabilities: { sampling: {}, roots: [Object] }, clientInfo: { name: 'mcp-inspector', version: '0.12.0' } } }
[supergateway] Request error: Error: Error POSTing to endpoint (HTTP 404): {"detail":"Not Found"} at SSEClientTransport.send (file:///Users/afstkla/.npm/_npx/85d60ba1adc82a16/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:168:23) at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
same problem
Same issue here. Here are the logs when I open Claude Desktop and then refresh the OpenMemory UI
openmemory-mcp-1 | INFO: 192.168.65.1:45145 - "POST /mcp/claude/sse/mike/messages?session_id=64d3a73b31bd462ca4cc67c90298e051 HTTP/1.1" 404 Not Found
openmemory-mcp-1 | INFO: 192.168.65.1:45186 - "OPTIONS /api/v1/memories/filter HTTP/1.1" 200 OK
openmemory-mcp-1 | INFO: 192.168.65.1:45185 - "GET /api/v1/stats?user_id=mike HTTP/1.1" 307 Temporary Redirect
openmemory-mcp-1 | INFO: 192.168.65.1:45186 - "POST /api/v1/memories/filter HTTP/1.1" 200 OK
openmemory-mcp-1 | INFO: 192.168.65.1:45185 - "GET /api/v1/stats/?user_id=mike HTTP/1.1" 200 OK
Same. Here's my Claude OpenMemory log file:
2025-05-15T16:58:11.302Z [OpenMemory] [info] Initializing server...
2025-05-15T16:58:11.363Z [OpenMemory] [info] Server started and connected successfully
2025-05-15T16:58:11.364Z [OpenMemory] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
[supergateway] Starting...
[supergateway] Supergateway is supported by Supermachine (hosted MCPs) - https://supermachine.ai
[supergateway] - outputTransport: stdio
[supergateway] - sse: http://localhost:8765/mcp/claude/sse/kevinjarnot
[supergateway] - Headers: (none)
[supergateway] Connecting to SSE...
[supergateway] Stdio server listening
[supergateway] Stdio → SSE: {
jsonrpc: '2.0',
id: 0,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'claude-ai', version: '0.1.0' }
}
}
[supergateway] Request error: Error: Error POSTing to endpoint (HTTP 404): {"detail":"Not Found"}
at SSEClientTransport.send (file:///Users/kevinjarnot/.npm/_npx/85d60ba1adc82a16/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:168:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2025-05-15T16:58:18.276Z [OpenMemory] [info] Message from server: {"jsonrpc":"2.0","id":0,"error":{"code":-32000,"message":"Error POSTing to endpoint (HTTP 404): {\"detail\":\"Not Found\"}"}}
2025-05-15T16:58:18.276Z [OpenMemory] [info] Client transport closed
[supergateway] Caught SIGTERM. Exiting...
2025-05-15T16:58:18.277Z [OpenMemory] [info] Server transport closed
2025-05-15T16:58:18.277Z [OpenMemory] [info] Client transport closed
2025-05-15T16:58:18.277Z [OpenMemory] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-05-15T16:58:18.277Z [OpenMemory] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-05-15T16:58:18.318Z [OpenMemory] [info] Server transport closed
2025-05-15T16:58:18.318Z [OpenMemory] [info] Client transport closed
2025-05-15T17:00:56.416Z [OpenMemory] [info] Initializing server...
2025-05-15T17:00:56.478Z [OpenMemory] [info] Server started and connected successfully
2025-05-15T17:00:56.480Z [OpenMemory] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
[supergateway] Starting...
[supergateway] Supergateway is supported by Supermachine (hosted MCPs) - https://supermachine.ai
[supergateway] - outputTransport: stdio
[supergateway] - sse: http://localhost:8765/mcp/claude/sse/kevinjarnot
[supergateway] - Headers: (none)
[supergateway] Connecting to SSE...
[supergateway] Stdio server listening
[supergateway] Stdio → SSE: {
jsonrpc: '2.0',
id: 0,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'claude-ai', version: '0.1.0' }
}
}
[supergateway] Request error: Error: Error POSTing to endpoint (HTTP 404): {"detail":"Not Found"}
at SSEClientTransport.send (file:///Users/kevinjarnot/.npm/_npx/85d60ba1adc82a16/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:168:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2025-05-15T17:01:00.897Z [OpenMemory] [info] Message from server: {"jsonrpc":"2.0","id":0,"error":{"code":-32000,"message":"Error POSTing to endpoint (HTTP 404): {\"detail\":\"Not Found\"}"}}
2025-05-15T17:01:00.897Z [OpenMemory] [info] Client transport closed
2025-05-15T17:01:00.898Z [OpenMemory] [info] Server transport closed
2025-05-15T17:01:00.898Z [OpenMemory] [info] Client transport closed
2025-05-15T17:01:00.898Z [OpenMemory] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-05-15T17:01:00.898Z [OpenMemory] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
[supergateway] Caught SIGTERM. Exiting...
2025-05-15T17:01:00.911Z [OpenMemory] [info] Server transport closed
2025-05-15T17:01:00.911Z [OpenMemory] [info] Client transport closed
The same error is occurring
Same, following this issue.
same issue
same here: openmemory-mcp-1 | INFO: 192.168.65.1:63292 - "GET /mcp/windsurf/sse/qiansui HTTP/1.1" 200 OK openmemory-mcp-1 | INFO: 192.168.65.1:61876 - "POST /mcp/windsurf/sse/qiansui/messages?session_id=8df09bb93a9d406a80de999ea93081a8 HTTP/1.1" 404 Not Found
same issue
It seems wrong url for /messages . I changed openmemory/api/app/mcp_server.py handle_post_message method annotation from @mcp_router.post("/messages/") to @mcp_router.post("/{client_name}/sse/{user_id}/messages/"). http 404 status fixed ,but still not work for cursor
2025-05-16T03:10:40.464744573Z INFO: 192.168.8.129:52789 - "GET /mcp/cursor/sse/root HTTP/1.1" 200 OK 2025-05-16T03:10:40.477080750Z INFO: 192.168.8.129:52790 - "POST /mcp/cursor/sse/root/messages?session_id=2c74f986ab4b4f53affc3e1681c03a4e HTTP/1.1" 307 Temporary Redirect 2025-05-16T03:10:40.484894822Z INFO: 192.168.8.129:52791 - "POST /mcp/cursor/sse/root/messages/?session_id=2c74f986ab4b4f53affc3e1681c03a4e HTTP/1.1" 200 OK 2025-05-16T03:10:40.490851782Z INFO: 192.168.8.129:52790 - "POST /mcp/cursor/sse/root/messages?session_id=2c74f986ab4b4f53affc3e1681c03a4e HTTP/1.1" 307 Temporary Redirect 2025-05-16T03:10:40.494846387Z INFO: 192.168.8.129:52791 - "POST /mcp/cursor/sse/root/messages/?session_id=2c74f986ab4b4f53affc3e1681c03a4e HTTP/1.1" 200 OK maybe status 307 make cursor not to work with this mcp
same issue
1.Modify /mem0/openmemory/ui/Dockerfile to add: ENV NEXT_PUBLIC_API_URL="http://openmemory-mcp:8765/" ENV NEXT_PUBLIC_USER_ID=root Otherwise, when deploying the web interface via docker, many API interfaces won't connect properly. 2.Modify /mem0/openmemory/api/requirements.txt to use mcp[cli]==1.8.1 Yesterday's build was using version 1.8.1, and Claude desktop could successfully connect to openmemory. Today, after rebuilding, it somehow upgraded to version 1.9.0, causing Claude to lose connection to openmemory.
Git checkout a22287a, Claude Version 0.9.3 is now working normally after using openai_api_key. Added to /mem0/openmemory/api/app/mcp_server.py: python@mcp_router.post("/messages/") @mcp_router.post("/{client_name}/sse/{user_id}/messages/") async def handle_post_message(request: Request): Current testing results are a bit strange:
Claude can add memories and query them, but cannot see memories created from the web interface Cline fails to add memories (with no error messages), but can query memories added by Claude
Will continue to investigate and follow up.
I'll begin by searching for /messages and /cursor/sse in the codebase to locate where the wrong route is being built. I'll read openmemory/api/app/mcp_server.py to review how the /messages endpoint is set up and whether there is route construction logic that could explain the wrong URL. The backend is implemented correctly—the /mcp/messages/ endpoint exists and is not nested under /cursor/sse/.... The bug is likely on the client: it builds the wrong POST URL by appending /messages to the SSE cursor path. I'll now look for code that constructs the POST endpoint, searching for "cursor/sse" and "messages" in the frontend/client code. I'll search for usages of .post and "messages" in the codebase to find where the client builds and calls the POST /messages endpoint. I'll look at the file structure under openmemory/ui/ and mem0-ts/ to find where the MCP or SSE client logic is implemented, so I can check how the POST /messages endpoint is constructed. I'll examine the file structure in mem0-ts/ to find the MCP/SSE client logic and review how it determines the POST /messages endpoint. I'll list the contents of mem0-ts/src/ to determine which files implement the MCP/SSE client and endpoint construction. I'll list the contents of mem0-ts/src/client/ to find the MCP/SSE client implementation files. I'll read mem0-ts/src/client/mem0.ts to find and fix the logic that incorrectly builds the POST /messages endpoint. The problem is not in the backend or the MemoryClient, but in the way the MCP client (e.g., supergateway or inspector) constructs the POST /messages endpoint. According to the MCP protocol, you should POST to /mcp/messages, not /mcp/cursor/sse/afstkla/messages.
How to fix:
In your supergateway or inspector configuration, make sure the POST endpoint is set to /mcp/messages and not derived from the SSE URL. If you are using a wrapper script, relay, or client library that builds the POST path by appending /messages to the SSE cursor URL, you need to change it so that POSTs always go to /mcp/messages.
same issue
I'm not sure if this will get look up or not, but I still have error with claude desktop. work with cursor.
2025-05-16T11:00:41.762Z [openmemory] [info] Initializing server...
2025-05-16T11:00:41.795Z [openmemory] [info] Server started and connected successfully
2025-05-16T11:00:41.795Z [openmemory] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
[supergateway] Starting...
[supergateway] Supergateway is supported by Supermachine (hosted MCPs) - https://supermachine.ai
[supergateway] - outputTransport: stdio
[supergateway] - sse: http://localhost:8765/mcp/claude/sse/onlyabrak
[supergateway] - Headers: (none)
[supergateway] Connecting to SSE...
[supergateway] Stdio server listening
[supergateway] Stdio → SSE: {
jsonrpc: '2.0',
id: 0,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'claude-ai', version: '0.1.0' }
}
}
[supergateway] SSE connected
[supergateway] Response: {
jsonrpc: '2.0',
id: 0,
result: {
protocolVersion: '2025-03-26',
capabilities: {
experimental: {},
prompts: [Object],
resources: [Object],
tools: [Object]
},
serverInfo: { name: 'mem0-mcp-server', version: '1.9.0' }
}
}
2025-05-16T11:00:42.970Z [openmemory] [info] Message from server: {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-03-26","capabilities":{"experimental":{},"prompts":{"listChanged":false},"resources":{"subscribe":false,"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"mem0-mcp-server","version":"1.9.0"}}}
2025-05-16T11:00:42.982Z [openmemory] [info] Client transport closed
[supergateway] Caught SIGTERM. Exiting...
2025-05-16T11:00:42.983Z [openmemory] [info] Server transport closed
2025-05-16T11:00:42.983Z [openmemory] [info] Client transport closed
2025-05-16T11:00:42.983Z [openmemory] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. console.error('...') in JavaScript, print('...', file=sys.stderr) in python) and it will appear in this log.
2025-05-16T11:00:42.983Z [openmemory] [error] Server disconnected. For troubleshooting guidance, please visit our debugging documentation {"context":"connection"}
2025-05-16T11:00:43.004Z [openmemory] [info] Server transport closed
2025-05-16T11:00:43.004Z [openmemory] [info] Client transport closed
You can modify a file by following this: https://github.com/mem0ai/mem0/pull/2696/files
I've clone the latest merged code. I've also tried to edit the line manually. Both resulted the same error above. Only issue in Claude Desktop. It work fine with Cursor.
Error POSTing to endpoint (HTTP 404): {"detail":"Not Found"
Same error, any update any one has luck?