To connect an LLM to the Supermemory MCP, you must establish a connection through the Durable Object's SSE endpoint. The connection follows this pattern:
- Identify/Create Session: The main worker uses a
sessionId from the URL search parameters to retrieve an existing Durable Object or creates a new one using namespace.newUniqueId(). - Establish SSE Connection: Connect to the
/sse endpoint of the Durable Object. This endpoint uses SSEHonoTransport and bridge to facilitate the MCP communication. - Message Exchange: Subsequent messages are handled via the
/messages endpoint using the established transport.
Example Workflow (Conceptual):
// The Durable Object setup inside the worker:
server.get("/sse", async (c) => {
const userId = c.get("userId")
return streamSSE(c, async (stream) => {
this.transport?.connectWithStream(stream)
await bridge({
mcp: muppet(createSuperMemory(userId, c.env), {
name: "Supermemory MCP",
version: "1.0.0",
}),
transport: c.env.transport,
})
})
})