ME

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.

Quick Install
npx -y @MemTensor/memos-api-mcp

Overview

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:

git clone https://github.com/MemTensor/memos-api-mcp.git
cd memos-api-mcp

Run with Docker (recommended):

docker build -t memos-api-mcp:latest .
docker run -e PORT=8080 -e STORAGE_URL=postgres://user:pass@db:5432/memos \
  -p 8080:8080 memos-api-mcp:latest

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:

VariablePurpose
PORTHTTP port to listen on (default: 8080)
STORAGE_URLConnection string for persistent storage (Postgres, SQLite, etc.)
REDIS_URLOptional cache / pubsub backend
LOG_LEVELLogging verbosity (debug, info, warn, error)
MCP_NAMESPACENamespace 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

  1. 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):
    curl -X POST http://localhost:8080/contexts \
      -H "Content-Type: application/json" \
      -d '{"id":"user:123:turn:1","namespace":"user:123","text":"User prefers French cuisine","metadata":{"type":"preference"}}'
    
    • Example (query relevant memories):
    curl "http://localhost:8080/contexts/search?namespace=user:123&q=favorite%20food&limit=5"
    
  2. 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.
  3. 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.
  4. Multi-service orchestration

    • Central