Skip to content

Model Context Protocol (MCP)

Suprflo ships an MCP server that exposes your memory layer as MCP tools. Any MCP client (Claude Code, Claude Desktop, Cursor, Windsurf, Continue, Cline, or a custom client) can connect to it and read, write, and search memories, plus query the knowledge graph, without writing any HTTP code.

The server runs as a separate process. It speaks stdio JSON-RPC to the client and calls the Suprflo REST API over HTTP under the hood, so everything it does maps to the endpoints in rest-api.md.

Tools

The server exposes nine tools: five for memory operations and four for the knowledge graph.

Memory tools

ToolRequired argsOptional argsPurpose
add_memorymessages (array of strings), user_idapp_idExtract and store memories from one or more messages. Maps to POST /api/memories.
search_memoryquery, user_idapp_id, top_k (default 10), memory_types (semantic, episodic, procedural)Semantic search over stored memories. Maps to POST /api/memories/search.
get_memorymemory_idRetrieve a single memory by its id. Maps to GET /api/memories/{id}.
list_memoriesuser_idapp_id, limit (default 50)List all memories for a user. Maps to GET /api/memories.
delete_memorymemory_idDelete a specific memory. Maps to DELETE /api/memories/{id}.

Knowledge graph tools

ToolRequired argsOptional argsPurpose
query_graphentity_namemax_depth (default 2)Traverse the memory knowledge graph from an entity and return its neighborhood (connected entities and relationships).
get_communitiesList all communities in the graph with entity counts.
get_god_nodestop_k (default 5)Return the most connected entities (god nodes) in the graph.
shortest_pathsource, targetFind the shortest path between two entities in the graph.

Environment variables

The server reads its configuration from the environment at startup:

VariableDefaultDescription
MEMORYG_API_URLhttp://localhost:8000Base URL of the Suprflo API. Set this to https://api.suprflo.com for the hosted service; the localhost default is only for a self-hosted backend.
MEMORYG_API_KEY(empty)API key sent as Authorization: Bearer <key>.
MEMORYG_ORG_ID(empty)Optional organization id, sent as X-Org-Id when set.
MEMORYG_PROJECT_ID(empty)Optional project id, sent as X-Project-Id when set.

For the hosted API, MEMORYG_API_KEY already carries your organization and project scope, so MEMORYG_ORG_ID and MEMORYG_PROJECT_ID are not needed.

Configure the server

Add the server to your client's MCP config. The shape is the same everywhere: command is python, args points at mcp_server.py, and env supplies the API URL and key.

json
{
  "mcpServers": {
    "memoryg": {
      "command": "python",
      "args": ["mcp_server.py"],
      "cwd": "/path/to/mem0-app/backend",
      "env": {
        "MEMORYG_API_URL": "http://localhost:8000",
        "MEMORYG_API_KEY": "your-api-key-here"
      }
    }
  }
}

The mcp and httpx packages must be available to the Python you point at:

bash
pip install mcp httpx

Claude Code example

Claude Code auto-discovers MCP servers from a .mcp.json file in the project root. Point it at the hosted API and drop in your key:

json
{
  "mcpServers": {
    "suprflo": {
      "command": "python",
      "args": ["/path/to/mem0-app/backend/mcp_server.py"],
      "env": {
        "MEMORYG_API_URL": "https://api.suprflo.com",
        "MEMORYG_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

Restart Claude Code, then run /mcp to confirm the suprflo server is connected and lists nine tools. From there just talk naturally and Claude Code routes to the right tool:

> search alice's memories for anything about databases
> add a memory: Alice prefers dark mode
> what are the most connected entities in the graph?
> find the path between FastAPI and PostgreSQL

The memory layer for AI agents.