mem0-selfhosted-fastmcp
Thin FastMCP bridge for a self-hosted Mem0 REST API.
It fetches the live OpenAPI spec from a Mem0 server, prunes it to the useful memory operations, and exposes those endpoints as MCP tools for OpenCode or other MCP clients.
Implementation note:
- this uses FastMCP's official OpenAPI integration via
FastMCP.from_openapi - there is no handwritten MCP protocol layer here; the bridge is generated from the live Mem0 OpenAPI spec at startup and then lightly curated (path pruning plus friendly MCP tool names)
Scope
Exposed tools:
add_memorylist_memoriessearch_memoriesget_memoryupdate_memorydelete_memorydelete_all_memoriesmemory_historylist_entitiesdelete_entity
Excluded on purpose:
- auth/login/refresh flows
- setup/bootstrap endpoints
- admin/configure/request-log endpoints
Environment
Required:
MEM0_BASE_URL(default:http://mem0-memory:8765)- one of:
MEM0_API_KEY(sent asX-API-Key)MEM0_BEARER_TOKEN(sent asAuthorization: Bearer ...)
Optional:
FASTMCP_TRANSPORT(stdioby default)HOST/PORTfor HTTP transports
Install
Published package:
Install with uvx (recommended for MCP clients):
uvx mem0-selfhosted-fastmcp --help
Install into a Python environment:
uv pip install mem0-selfhosted-fastmcp
or:
pip install mem0-selfhosted-fastmcp
Usage
Stdio mode for OpenCode-style spawning:
MEM0_BASE_URL=http://mem0-memory:8765 \
MEM0_API_KEY=... \
uvx mem0-selfhosted-fastmcp
Dump the pruned OpenAPI used for generation:
MEM0_BASE_URL=http://mem0-memory:8765 \
MEM0_API_KEY=... \
uvx mem0-selfhosted-fastmcp --dump-openapi
Run as HTTP MCP server:
MEM0_BASE_URL=http://mem0-memory:8765 \
MEM0_API_KEY=... \
uvx mem0-selfhosted-fastmcp --transport streamable-http --port 8081
Maintenance
Because the bridge loads the live OpenAPI spec at startup, many Mem0 API changes are picked up automatically without code generation. The places most likely to need manual updates are:
- path allowlist changes in
server.py - operationId -> MCP name mappings when upstream operationIds change
- auth header strategy if Mem0 auth changes
Helpful targets:
make sync # install/update dependencies
make dump-openapi # print the pruned live OpenAPI used by the bridge
make snapshot-openapi # save the current pruned live OpenAPI to generated/
make check-live # smoke-test server creation against the live Mem0 API
make run # stdio mode for OpenCode
make run-http # streamable-http mode for shared/server use
OpenCode MCP example
[servers.mem0]
transport = "stdio"
command = "uvx"
args = ["mem0-selfhosted-fastmcp"]
env.MEM0_BASE_URL = "http://mem0-memory:8765"
env.MEM0_API_KEY = "${MEM0_API_KEY}"
For a pinned version:
[servers.mem0]
transport = "stdio"
command = "uvx"
args = ["mem0-selfhosted-fastmcp==0.1.1"]
env.MEM0_BASE_URL = "http://mem0-memory:8765"
env.MEM0_API_KEY = "${MEM0_API_KEY}"
Metadata
Release files for mem0-selfhosted-fastmcp 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mem0_selfhosted_fastmcp-0.1.4.tar.gz | 53.9 kB | Without provenance | Details for mem0_selfhosted_fastmcp-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mem0_selfhosted_fastmcp-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mem0_selfhosted_fastmcp-0.1.4-py3-none-any.whl |
Total release size: 59.1 kB
Release files / mem0_selfhosted_fastmcp-0.1.4.tar.gz
| Download URL | mem0_selfhosted_fastmcp-0.1.4.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d5567ade5617d753694d7ae554b1a7da675615f6dab0cbbaa65bd86f48446c8
|
|
BLAKE2b-256 checksum How to use checksums |
b8d22cc531db2db6a102a8fe9aca5be6f2ee3bd39e6c32b9cc096866204b171e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mem0_selfhosted_fastmcp-0.1.4-py3-none-any.whl
| Download URL | mem0_selfhosted_fastmcp-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08c2576d73921ddfc570c00fb70e6108e006515843d13f569f00bb19d1c9ea7a
|
|
BLAKE2b-256 checksum How to use checksums |
1fc89cd0637084595de4bea26552af88e800e279cbf2f5615113ccb4da26b0dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mem0-selfhosted-fastmcp 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.