While I was happy with the result(s), i've decided to replace this with @genAi/Tapedeck, so that the project will become more stable and focus on large ecosystems rather than teams of >3 <10.
- CSS 52.1%
- JavaScript 44.8%
- CSharp 2.3%
- Markdown 0.6%
- Yaml 0.1%
- JSON 0.1%
Memory MCP
A Persistent Memory Tool with semantic 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
- Semantic embeddings - Powered by all-MiniLM-L6-v2 (384 dimensions, ONNX) for meaningful vector similarity
- 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) │
└──────────────────┘
Embeddings
Text embeddings are generated locally using the all-MiniLM-L6-v2 ONNX model via Microsoft.ML.OnnxRuntime. The model and vocabulary are automatically downloaded on first use to .models/all-MiniLM-L6-v2/ in the application directory (~80MB).
- Dimensions: 384
- Pooling: Mean pooling with attention mask
- Normalization: L2-normalized (cosine similarity via dot product)
Memory Backends
| Backend | Search Type | Embeddings |
|---|---|---|
| ChromaDB | Vector similarity | ONNX semantic embeddings (all-MiniLM-L6-v2) |
| MongoDB | Text index + vector | ONNX semantic embeddings (all-MiniLM-L6-v2) |
MCP Tools
| Tool | Required params | Optional params | Description |
|---|---|---|---|
store_context | text, project, sessionId | tags | Persist a memory entry (tape) to long-term storage. Use for decisions, file changes, or conventions worth recalling later. Text is embedded with all-MiniLM-L6-v2. Returns { id, stored }. |
search_context | searchQuery, project | tags | Search stored tapes for context relevant to the current task. Returns up to 10 results sorted by most recently updated. |
get_session_summary | sessionId | — | Lightweight overview of one session: tape count plus messages, tags, and timestamps. Use to decide whether to call continue_session. |
continue_session | sessionId | — | Load the full body of every tape in a session, ordered by creation time. Use to resume a previous conversation with complete context. |
delete_tape | tapeId | — | Permanently delete a single tape by its id. Use to remove incorrect, stale, or sensitive entries. Returns { id, deleted }. |
unwind | — | count, project | Retrieve the latest N tapes (default 10) sorted by creation date, newest first. Use to export recent memory entries to disk as markdown files for a specific project. Returns { tapes, count }. |
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 |
/memory/delete | POST | Delete a single tape by id |
/memory/unwind | POST | Get latest N tapes (default 10) for export |
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"
}'
# Delete a tape
curl -X POST http://localhost:5000/memory/delete \
-H "Content-Type: application/json" \
-d '{
"tapeId": "65f3a2b9c8d4e1f0a1234567"
}'
# Get latest tapes for export
curl -X POST http://localhost:5000/memory/unwind \
-H "Content-Type: application/json" \
-d '{
"count": 10,
"project": "my-app"
}'
Running Locally
Prerequisites
- .NET 10 SDK
- A database backend:
- MongoDB (default):
docker run -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mcpuser -e MONGO_INITDB_ROOT_PASSWORD=mcppassword mongo:8 - ChromaDB:
docker run -p 8000:8000 ghcr.io/chroma-core/chroma:latest
- MongoDB (default):
Build and Run
# Build the project
dotnet build
# Run with MongoDB (default)
dotnet run --project memory-mcp
# Run with ChromaDB
export MEMORY_BACKEND=chromadb
dotnet run --project memory-mcp
# Run with custom MongoDB settings
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
# 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
Building the Docker Image
The project is configured to build as dnnsdev/tapedeck:latest using .NET SDK container support.
Using .NET SDK (recommended)
# Build and publish the container image
dotnet publish /t:PublishContainer -c Release
# Or specify a custom tag
dotnet publish /t:PublishContainer -c Release -p:ContainerImageTags=latest
Using Dockerfile
# Build from the repository root
docker build -t dnnsdev/tapedeck:latest -f memory-mcp/Dockerfile .
Environment Variables
| Variable | Description | Default |
|---|---|---|
MEMORY_BACKEND | Database backend (chromadb or mongo) | mongo |
MONGO_CONNECTION_STRING | MongoDB connection string | mongodb://mcpuser:mcppassword@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"
}
}
}
}