mem0-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mem0-mcpremember that my favorite programming language is Rust"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mem0-mcp
Streamable HTTP MCP adapter for self-hosted Mem0 OSS. It sits in front of your own Mem0 REST API and exposes memory tools to Codex, Claude Code, Cursor, and other MCP clients — no Mem0 Platform account required.
Official Mem0 MCP (mcp.mem0.ai) talks to Mem0 Cloud. This project talks to the Mem0 you run yourself.
This repo also ships a Go CLI for the same OSS API (mem0 add / search / list / update / delete / … with an agent-JSON mode). See cli/.
Architecture
MCP client (Codex / Cursor / Claude Code)
│ HTTP + X-API-Key: m0sk_...
▼
mem0-mcp :8080/mcp ← this repo
│ REST + X-API-Key (passthrough)
▼
Mem0 OSS :8888 ← github.com/mem0ai/mem0/server
│ POST /memories, POST /search, …
▼
Postgres + pgvector (your data)Component | Role | You configure |
Mem0 OSS | Stores and searches memories |
|
mem0-mcp | MCP ↔ REST bridge |
|
mem0 CLI | Go CLI against the OSS API ( |
|
MCP client | Calls tools from the agent | MCP URL + |
Important: Mem0 API keys (m0sk_...) go in the MCP client, not in mem0-mcp's environment. mem0-mcp forwards the key from each HTTP request to your Mem0 instance.
Related MCP server: mem0-mcp
1. Deploy self-hosted Mem0 OSS
Follow the Mem0 self-hosted server docs. Minimal path:
git clone https://github.com/mem0ai/mem0.git
cd mem0/server
cp .env.example .env
# Edit .env — set at least POSTGRES_PASSWORD and OPENAI_API_KEY
make bootstrapThis starts Postgres, the Mem0 API, and the dashboard. After bootstrap you should see:
Service | URL |
Mem0 REST API |
|
OpenAPI docs |
|
Dashboard |
|
Save the admin password and API key (m0sk_...) printed in the === Ready === block — the key is shown only once.
Verify Mem0 is up:
curl -s http://localhost:8888/docs | head -1 # HTML from OpenAPI page
curl -X POST http://localhost:8888/memories \
-H "Content-Type: application/json" \
-H "X-API-Key: m0sk_YOUR_KEY" \
-d '{"messages":[{"role":"user","content":"I prefer TypeScript"}],"user_id":"alice"}'Mem0 OSS API notes
Paths have no
/v1/prefix: usePOST /memories,POST /search, not/v1/memories.Auth is on by default. Send
X-API-Key: m0sk_...on protected endpoints.Docker Compose maps host 8888 → container 8000. From another container on the same network, use
http://mem0:8000.
More: Mem0 server README, REST API reference.
2. Deploy mem0-mcp
Point mem0-mcp at your running Mem0 OSS instance and choose the fallback user_id. Memory tools may override it explicitly per call.
Option A — Docker (recommended)
docker pull ghcr.io/kongken/mem0-mcp:main
docker run -d --name mem0-mcp \
-p 8080:8080 \
-e MEM0_API_URL=http://host.docker.internal:8888 \
-e MEM0_DEFAULT_USER_ID=alice \
mem0-mcpOn Linux without host.docker.internal, use your host IP or join the Mem0 Docker network (see Option C).
Option B — Local Node.js
cp .env.example .envMEM0_API_URL=http://localhost:8888
MEM0_DEFAULT_USER_ID=alice
HOST=127.0.0.1
PORT=8080npm install
npm run devOption C — Same Docker network as Mem0
Add mem0-mcp to Mem0's compose stack or attach to its network:
# compose.yaml (add alongside Mem0 services)
services:
mem0-mcp:
image: ghcr.io/kongken/mem0-mcp:main
ports:
- "8080:8080"
environment:
MEM0_API_URL: http://mem0:8000 # service name + internal port
MEM0_DEFAULT_USER_ID: alice
MCP_ALLOWED_HOSTS: localhost,mem0-mcp.example.com
networks:
- mem0_network # same network as Mem0 OSS
restart: unless-stopped
networks:
mem0_network:
external: true # if using Mem0's existing networkCheck mem0-mcp:
curl http://localhost:8080/healthz
# {"status":"ok"}MCP endpoint: http://localhost:8080/mcp
3. Configure MCP clients
Clients connect to mem0-mcp, not directly to Mem0 OSS. Pass the Mem0 API key as X-API-Key.
Codex (~/.codex/config.toml)
[mcp_servers.mem0]
url = "http://127.0.0.1:8080/mcp"
http_headers = { "X-API-Key" = "${MEM0_API_KEY}" }export MEM0_API_KEY=m0sk_your_key_here
codexCursor (~/.cursor/mcp.json)
{
"mcpServers": {
"mem0-oss": {
"url": "http://127.0.0.1:8080/mcp",
"headers": {
"X-API-Key": "m0sk_your_key_here"
}
}
}
}Claude Code / generic HTTP MCP
{
"mcpServers": {
"mem0-oss": {
"type": "http",
"url": "http://127.0.0.1:8080/mcp",
"headers": {
"X-API-Key": "m0sk_your_key_here"
}
}
}
}End-to-end smoke test
Ask your agent to remember something, then in a new turn ask it to recall:
You: Remember that I prefer TypeScript for new projects.
Agent: Saved.
You: What language do I prefer for new projects?
Agent: TypeScript.Confirm the memory also appears in the Mem0 dashboard at http://localhost:3000.
mem0-mcp environment variables
Variable | Required | Default | Description |
| yes | — | Self-hosted Mem0 REST base URL, e.g. |
| yes | — | Fallback |
| no |
| HTTP bind address |
| no |
| HTTP port |
| no |
| MCP HTTP path |
| no |
| Upstream timeout to Mem0 OSS |
| no |
| Stateless Streamable HTTP mode |
| no | — | Allowed Host headers when binding publicly (recommended with |
| no |
|
|
Do not put m0sk_... keys in these variables. Keys belong in MCP client headers only.
MCP tools
Tool | Mem0 OSS endpoint | Scope input |
|
| optional |
|
| optional |
|
| optional |
|
| exact memory ID |
|
| exact memory ID |
|
| exact memory ID |
|
| optional |
Security
Missing
X-API-Keyon MCP requests →401before Mem0 is contactedadd_memory,search_memories,get_memories, andlist_entitiesaccept an optional top-leveluser_id; otherwise the adapter usesMEM0_DEFAULT_USER_IDIdentity keys are rejected anywhere inside search
filters; passuser_idthrough the dedicated top-level argumentagent_idandrun_idare not supported by this adapterA Mem0 OSS API key authenticates the caller but does not authorize a specific memory
user_id; any trusted client with a valid key can select anotheruser_idNo bulk delete, entity cascade delete, configure, or reset in v1
API keys and memory bodies are redacted from logs
Keep Mem0 OSS auth enabled; do not use
AUTH_DISABLED=truein production
Production checklist
TLS — terminate HTTPS at nginx/Caddy/Traefik in front of mem0-mcp (and Mem0 dashboard if exposed).
Network — Mem0 Postgres and API on a private network; only expose mem0-mcp (and dashboard if needed).
Keys — use separate
m0sk_...keys per client and rotate by updating client headers; do not treat a key as bound to a memoryuser_id.Access — expose the endpoint only to clients trusted to choose any
user_id, or add an authorization proxy that maps credentials to allowed identities.Host allowlist — set
MCP_ALLOWED_HOSTSwhen binding0.0.0.0.Identity — set
MEM0_DEFAULT_USER_IDto the normal fallback scope used when callers omituser_id.
Example nginx for mem0-mcp:
location /mcp {
proxy_pass http://127.0.0.1:8080/mcp;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 120s;
client_max_body_size 1m;
}vs official Mem0 MCP
Official ( | mem0-mcp (this repo) | |
Backend | Mem0 Platform | Your Mem0 OSS |
Data | Mem0 Cloud | Your Postgres |
Auth | OAuth / platform key |
|
User scope | Tool-selected user/agent filters | Optional tool |
Setup |
| Deploy Mem0 OSS + this adapter |
Development
npm install
npm test
npm run build
npm startLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
StremAI MCP: shared memory for AI coding agents. Connected agents can recall. OAuth + local stdio.
Persistent memory for AI agents with OAuth-backed hosted MCP access.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseAqualityAmaintenanceA server that wraps a self-hosted mem0 REST API as MCP tools for Claude Desktop and Claude Code, enabling memory operations such as adding, searching, and managing memories via natural language.61MIT

@memofs/mcp-serverofficial
AlicenseNot gradedqualityBmaintenance@memofs/mcp-server lets AI coding agents (Claude Code, Claude Desktop, Codex, Cursor, opencode, Gemini CLI, GitHub Copilot, Zed, and any other MCP client) securely read and write MemoFS memory through standard Model Context Protocol tools.6MIT- AlicenseNot gradedqualityBmaintenanceMCP server wrapping a self-hosted mem0 REST API, enabling memory management with deduplication and mention-aware reranked search.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kongken/mem0-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server