MemOS Memos API MCP Server
Deploy the MemOS Memos API MCP server to manage AI memory contexts, streamline API integration, and optimize memory-driven application performance.
npx -y @MemTensor/memos-api-mcpOverview
MemOS Memos API MCP Server implements the Model Context Protocol (MCP) to provide a dedicated API for managing AI memory contexts. It acts as a centralized memory service that stores, indexes, and serves contextual memory snippets to language models and downstream services. By separating memory management from the application logic, the server helps teams build memory-driven assistants and RAG (retrieval-augmented generation) workflows with consistent, low-latency access to relevant context.
This server is designed for integration with existing MemOS-based tooling and any LLM pipelines that consume contextual memory. Typical usage patterns include short-term session memory, long-term user profiles, and retrieval layers for generative systems. Deploying an MCP server simplifies scaling, caching, and access-control concerns while exposing a stable HTTP API that your models and microservices can consume.
Features
- MCP-compatible HTTP API for storing and retrieving memory contexts
- Flexible storage backends (configurable via environment variables)
- Lightweight Docker image and compose-friendly deployment
- Basic access control and logging configuration
- Batch insert and search endpoints for efficient retrieval
- Optional metadata & TTL support for memory lifecycle management
- JSON-based requests/responses for easy integration with most stacks
Installation / Configuration
Prerequisites:
- Docker (recommended) or a runtime that matches the repository language (Node/Python/Go)
- Optional: PostgreSQL, Redis, or other datastore depending on your configuration
Clone the repository:
Run with Docker (recommended):
Example docker-compose.yml:
version: "3.8"
services:
memos-mcp:
image: memos-api-mcp:latest
build: .
ports:
- "8080:8080"
environment:
- PORT=8080
- STORAGE_URL=postgres://postgres:password@postgres:5432/memos
- LOG_LEVEL=info
postgres:
image: postgres:15
environment:
- POSTGRES_PASSWORD=password
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Common environment variables:
| Variable | Purpose |
|---|---|
| PORT | HTTP port to listen on (default: 8080) |
| STORAGE_URL | Connection string for persistent storage (Postgres, SQLite, etc.) |
| REDIS_URL | Optional cache / pubsub backend |
| LOG_LEVEL | Logging verbosity (debug, info, warn, error) |
| MCP_NAMESPACE | Namespace or tenant identifier for multi-tenant deployments |
Configuration can also be provided via a .env file or platform secrets manager.
Available Resources
- GitHub repository: https://github.com/MemTensor/memos-api-mcp
- Example clients: check the
examples/directory in the repository for sample requests and integration snippets - Documentation: repository README and inline API docs (OpenAPI/Swagger if included)
- Storage adapters: configured via STORAGE_URL to support multiple backends
If the repository includes an OpenAPI spec, point your API client generator at that file to create typed SDKs for your language.
Use Cases
Chat assistant session memory
- Store conversation turns and short-term facts for a user session.
- Retrieve the last N relevant memories and stitch them into the prompt sent to the LLM.
- Example (create memory):
- Example (query relevant memories):
Retrieval-Augmented Generation (RAG)
- Index domain documents as memory items and let the MCP server return the most relevant chunks for a model query.
- Batch-insert documents from a scraper or content pipeline and use the search endpoint to compose context windows.
Personalization and profiles
- Keep long-lived user facts (profiles, past purchases, preferences) separate from the application database for rapid retrieval during generation.
- Use TTL/expiry metadata to forget outdated items automatically.
Multi-service orchestration
- Central