Enable CI/CD by adding .onedev-buildspec.yml
| memory-mcp | Loading last commit info... | |
| .dockerignore | ||
| .gitignore | ||
| README.md | ||
| compose.yaml | ||
| memory-mcp.slnx |
README.md
Memory MCP
A Persistent Memory Tool with support for embeddings, designed for LLM/AI agent situations using the Model Context Protocol (MCP). It enables AI agents to store, search, and retrieve contextual information across sessions, providing long-term memory capabilities.
Features
- Store context - Save text with tags, project names, and session IDs
- Search memory - Find relevant past context using text search or vector embeddings
- Session summaries - Retrieve all context stored for a specific session
- Multiple backends - Switch between ChromaDB and MongoDB
- HTTP API - Test and interact with memory endpoints via REST
- MCP stdio transport - Native integration with MCP clients (Claude Desktop, Cursor, etc.)
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ MCP Client │────▶│ Memory MCP │────▶│ ChromaDB / │
│ (Claude, etc.) │ │ Server │ │ MongoDB │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ HTTP Endpoints │
│ (for testing) │
└──────────────────┘
Memory Backends
| Backend | Search Type | Embeddings |
|---|---|---|
| ChromaDB | Vector similarity | SHA256-based (simple) or external embedding service |
| MongoDB | Text index + vector | SHA256-based (simple) with Atlas vector search ready |
MCP Tools
| Tool | Description |
|---|---|
Store item in persistent memory | Store a memory entry with tags, project, and session_id |
Get item(s) from persistent memory | Search through stored memory for relevant past context |
Get session summary | Get a summary of all context stored in a given session |
HTTP Endpoints
| Endpoint | Method | Description |
|---|---|---|
/memory/store | POST | Store a new memory entry |
/memory/search | POST | Search stored memories |
/memory/session-summary | POST | Get session summary |
Example Requests
# Store a memory
curl -X POST http://localhost:5000/memory/store \
-H "Content-Type: application/json" \
-d '{
"text": "The user is building a React application with TypeScript",
"tags": ["react", "typescript", "frontend"],
"project": "my-app",
"sessionId": "session-001"
}'
# Search memories
curl -X POST http://localhost:5000/memory/search \
-H "Content-Type: application/json" \
-d '{
"searchQuery": "React application",
"tags": ["react"],
"project": "my-app"
}'
# Get session summary
curl -X POST http://localhost:5000/memory/session-summary \
-H "Content-Type: application/json" \
-d '{
"sessionId": "session-001"
}'
Running Locally
Prerequisites
- .NET 10 SDK
- A database backend:
- ChromaDB:
docker run -p 8000:8000 ghcr.io/chroma-core/chroma:latest - MongoDB:
docker run -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mcpuser -e MONGO_INITDB_ROOT_PASSWORD=mcppassword mongo:8
- ChromaDB:
Build and Run
# Build the project
dotnet build
# Run with ChromaDB (default)
dotnet run --project memory-mcp
# Run with MongoDB
export MEMORY_BACKEND=mongo
export MONGO_CONNECTION_STRING="mongodb://mcpuser:mcppassword@localhost:27017"
export MONGO_DATABASE=mcp
export MONGO_COLLECTION=tapes
dotnet run --project memory-mcp
The HTTP API will be available at http://localhost:5000.
Testing with HTTP Client
Open memory-mcp/test/memory.http in JetBrains Rider to interactively test all endpoints.
Running with Docker Compose
MongoDB Setup (Recommended)
# Build and start all services
docker compose up -d
# View logs
docker compose logs -f memory-mcp
This starts:
- MongoDB on port 27017 with authentication
- Memory MCP on port 5000, configured to use MongoDB
ChromaDB Setup
Modify compose.yaml to use ChromaDB:
services:
memory-mcp:
environment:
- MEMORY_BACKEND=chromadb
# ... rest of config
Environment Variables
| Variable | Description | Default |
|---|---|---|
MEMORY_BACKEND | Database backend (chromadb or mongo) | chromadb |
MONGO_CONNECTION_STRING | MongoDB connection string | mongodb://localhost:27017 |
MONGO_DATABASE | MongoDB database name | mcp |
MONGO_COLLECTION | MongoDB collection name | tapes |
MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"memory": {
"command": "dotnet",
"args": ["run", "--project", "/path/to/memory-mcp/memory-mcp"],
"env": {
"MEMORY_BACKEND": "mongo",
"MONGO_CONNECTION_STRING": "mongodb://mcpuser:mcppassword@localhost:27017"
}
}
}
}