# MCP Memory Service

> One self-hosted memory backend for AI agents, over MCP, a REST API, a CLI and a web dashboard

- Category: Agents & Automation / Agent Memory
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/doobidoo/mcp-memory-service
- Website: https://mcpmemory.services
- Canonical page: https://ai-tldr.dev/tools/mcp-memory-service/

## In short

MCP Memory Service is an open-source memory backend for AI agents. It starts from a familiar problem: an assistant forgets everything when a new chat begins, and you spend the first minutes of every session re-explaining your architecture. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

MCP Memory Service is an open-source memory backend for AI agents. It starts from a familiar problem: an assistant forgets everything when a new chat begins, and you spend the first minutes of every session re-explaining your architecture. The service stores decisions, notes, code patterns and project context, and hands them back to the next session or the next agent, so work does not restart from zero each time.

It is one self-hosted Python service that speaks every transport its users need: MCP for Claude Desktop, Claude Code, Cursor, VS Code and other MCP clients; a framework-agnostic REST API for agent pipelines built on LangGraph, CrewAI, AutoGen or any HTTP client; Remote MCP with OAuth 2.0 over HTTPS for claude.ai and ChatGPT in the browser; plus a CLI and a web dashboard. Embeddings run locally through ONNX and the default store is SQLite, so core memory operations stay on your own infrastructure; Cloudflare, a Hybrid mode (local reads with background cloud sync) and Milvus are the other storage backends.

Beyond plain storage, memories are linked in a knowledge graph with typed edges such as causes, fixes and contradicts, so agents can share causal chains rather than isolated facts. A scheduled consolidation pass clusters, compresses and selectively forgets old memories, and heuristic contradiction detection can mark older memories as superseded. The README says agents retrieve prior decisions in 5ms; the project publishes LongMemEval, DevBench and LoCoMo benchmark results, with run commands, in its own docs.

## What it does

- Persistent memory shared across sessions, agents and runs, with an `X-Agent-ID` header that tags each memory by the agent that stored it for scoped retrieval
- Semantic search combined with BM25 keyword search, a ranked mode that weighs recency, access frequency and quality, and tag, time-range and store-partition filters
- Knowledge graph with typed causal relationships and entity extraction that links @mentions, #tags, URLs and file paths, explorable in an interactive graph view
- Autonomous consolidation — clustering, compression, association discovery and controlled forgetting — plus confidence-scored beliefs and contradiction handling
- Automatic session capture through Claude Code and Codex hooks, document ingestion for PDF, text and Markdown, and JSON import/export including mem0 exports
- Web dashboard with Dashboard, Search, Browse, Documents, Manage, Analytics, Quality and API Docs tabs, served by the same HTTP server

## Getting started

The package is on PyPI and installs a `memory` command. Wire it into an MCP client, or run it as an HTTP server for agent frameworks. The project's Setup Guide walks through choosing a path.

1. Install from PyPI

```bash
pip install mcp-memory-service
```

2. Connect Claude Desktop

   Add the server to `claude_desktop_config.json` (on macOS `~/Library/Application Support/Claude/`, on Windows `%APPDATA%\Claude\`, on Linux `~/.config/Claude/`), then restart Claude Desktop.

```json
{
  "mcpServers": {
    "memory": {
      "command": "memory",
      "args": ["server"]
    }
  }
}
```

3. Or connect Claude Code

   Register the server with one command and restart Claude Code; the memory tools appear automatically.

```bash
claude mcp add memory -- memory server
```

4. Serve the REST API for agent pipelines

   For LangGraph, CrewAI, AutoGen or any HTTP client, start the HTTP server. Store with `POST /api/memories`, search with `POST /api/search` and filter by tag with `POST /api/search/by-tag`; sending `X-Agent-ID: <id>` on a store tags the memory `agent:<id>`. The live endpoint list is at `/api/docs`.

```bash
MCP_ALLOW_ANONYMOUS_ACCESS=true memory server --http
# REST API running at http://localhost:8000
```

5. Run it in the background and open the dashboard

   `memory launch` starts the HTTP server on 127.0.0.1:8000, where the web dashboard lets you search, browse and manage memories. The server binds to localhost by default; the README warns to expose it with `--host 0.0.0.0` only behind authentication, firewall rules, TLS or a VPN.

```bash
memory launch                  # start HTTP server in background (127.0.0.1:8000)
memory launch --port 8192      # custom port
memory info                    # status and health
memory logs --lines 50         # recent logs
memory stop                    # stop server
```

6. Pick a storage backend (optional)

   The source installer lets you choose SQLite (local, single-user), Cloudflare (multi-device sync), Hybrid (local reads with background cloud sync, which the README recommends for production) or Milvus.

```bash
git clone https://github.com/doobidoo/mcp-memory-service.git
cd mcp-memory-service
python scripts/installation/install.py
```

## When to use it

- Give Claude Desktop or Claude Code memory of your project's architecture and decisions, so a new session starts with that context
- Share one memory store across a LangGraph, CrewAI or AutoGen pipeline over plain HTTP, scoped per agent with the `X-Agent-ID` header
- Reach the same memories from claude.ai and ChatGPT in the browser through a self-hosted Remote MCP endpoint with OAuth
- Replace a hand-managed Redis + Pinecone + glue-code setup with one self-hosted service, and migrate existing mem0 exports into it
