memory-mcp
A simple MCP server that stores and retrieves memories from multiple LLMs.
š§ Memory MCP Server
Persistent memory and context window caching for LLM conversations. Save, retrieve, and manage memories with intelligent context archiving. MongoDB-backed storage.
An MCP (Model Context Protocol) server that provides memory management and context window caching for AI coding environments like Cursor and Claude Desktop.
Why Use Memory MCP?
- š¾ Persistent Storage ā MongoDB-backed memory that survives sessions
- š§ Context Caching ā Intelligent archiving and retrieval of conversation context
- š·ļø Tag-based Search ā Organize and find memories by tags
- š Relevance Scoring ā Automatically score archived content relevance
- ā” Easy Setup ā One-click install in Cursor or simple manual setup
Quick Start
Ready to add memory to your AI workflow? Install in seconds:
Install in Cursor (Recommended):
Or install manually:
npm install -g @jamesanz/memory-mcp
# Or from source:
git clone https://github.com/JamesANZ/memory-mcp.git
cd memory-mcp && npm install && npm run build
Features
Basic Memory Tools
save-memoriesā Save memories to database (overwrites existing)get-memoriesā Retrieve all stored memoriesadd-memoriesā Append new memories without overwritingclear-memoriesā Remove all stored memories
Context Window Caching
archive-contextā Archive conversation context with tagsretrieve-contextā Retrieve relevant archived contextscore-relevanceā Score archived content relevancecreate-summaryā Create summaries of archived contentget-conversation-summariesā Get all summaries for a conversationsearch-context-by-tagsā Search archived content by tags
Installation
Cursor (One-Click)
Click the install link above or use:
cursor://anysphere.cursor-deeplink/mcp/install?name=memory-mcp&config=eyJtZW1vcnktbWNwIjp7ImNvbW1hbmQiOiJucHgiLCJhcmdzIjpbIi15IiwiQGphbWVzYW56L21lbW9yeS1tY3AiXX19
Manual Installation
Requirements: Node.js 18+, npm, MongoDB
# Clone and build
git clone https://github.com/JamesANZ/memory-mcp.git
cd memory-mcp
npm install
npm run build
# Set MongoDB connection string
export MONGODB_URI="mongodb://localhost:27017"
# Run server
npm start
Claude Desktop
Add to claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"memory-mcp": {
"command": "node",
"args": ["/absolute/path/to/memory-mcp/build/index.js"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017"
}
}
}
}
Restart Claude Desktop after configuration.
Configuration
Set the MongoDB connection string:
export MONGODB_URI="mongodb://localhost:27017"
Default: mongodb://localhost:27017
Usage Examples
Save Memories
Store memories from a conversation:
{
"tool": "save-memories",
"arguments": {
"memories": ["User prefers TypeScript", "User works on blockchain projects"],
"llm": "claude",
"userId": "user123"
}
}
Retrieve Memories
Get all stored memories:
{
"tool": "get-memories",
"arguments": {}
}
Archive Context
Archive conversation context when it gets too long:
{
"tool": "archive-context",
"arguments": {
"conversationId": "conv-123",
"contextMessages": ["Message 1", "Message 2"],
"tags": ["coding", "typescript"],
"llm": "claude"
}
}
Retrieve Relevant Context
Get archived content relevant to current conversation:
{
"tool": "retrieve-context",
"arguments": {
"conversationId": "conv-123",
"tags": ["coding"],
"minRelevanceScore": 0.5,
"limit": 10
}
}
Context Window Caching
The system automatically:
- Archives content when context usage reaches 80%
- Retrieves relevant content when usage drops below 30%
- Scores relevance using keyword overlap
- Creates summaries to condense long conversations
Use Cases
- Long Conversations ā Manage context windows for extended sessions
- Memory Persistence ā Save important information across sessions
- Context Retrieval ā Bring back relevant past conversations
- Research Projects ā Organize and tag research conversations
Technical Details
Built with: Node.js, TypeScript, MCP SDK, MongoDB
Dependencies: @modelcontextprotocol/sdk, mongodb, zod
Platforms: macOS, Windows, Linux
Storage: MongoDB (default: mongodb://localhost:27017)
Contributing
ā If this project helps you, please star it on GitHub! ā
Contributions welcome! Please open an issue or submit a pull request.
License
ISC
Support
If you find this project useful, consider supporting it:
ā” Lightning Network
lnbc1pjhhsqepp5mjgwnvg0z53shm22hfe9us289lnaqkwv8rn2s0rtekg5vvj56xnqdqqcqzzsxqyz5vqsp5gu6vh9hyp94c7t3tkpqrp2r059t4vrw7ps78a4n0a2u52678c7yq9qyyssq7zcferywka50wcy75skjfrdrk930cuyx24rg55cwfuzxs49rc9c53mpz6zug5y2544pt8y9jflnq0ltlha26ed846jh0y7n4gm8jd3qqaautqa
āæ Bitcoin: bc1ptzvr93pn959xq4et6sqzpfnkk2args22ewv5u2th4ps7hshfaqrshe0xtp
Ī Ethereum/EVM: 0x42ea529282DDE0AA87B42d9E83316eb23FE62c3f
Server Terkait
PubChem MCP Server
Provides comprehensive access to PubChem's chemical information database via the PubChem PUG REST API.
Bauplan
Interact with Bauplan data tables and run queries.
ThoughtSpot MCP Server
Securely query and retrieve data from your ThoughtSpot instance.
NSE Ticker MCP Server
Provides access to National Stock Exchange (NSE) data using the Upstox API.
libSQL by xexr
MCP server for libSQL databases with comprehensive security and management tools. Supports file, local HTTP, and remote Turso databases with connection pooling, transaction support, and 6 specialized database tools.
PostgreSQL
Provides read-only access to PostgreSQL databases, enabling schema inspection and query execution.
Blackbaud FE NXT by CData
A read-only MCP server for Blackbaud FE NXT by CData, enabling LLMs to query live data. Requires a separate CData JDBC Driver.
BioMCP
Connects AI assistants to authoritative biomedical data sources like PubMed and ClinicalTrials.gov, enabling natural language queries.
Zero-Vector MCP
A high-performance vector database server for AI persona memory management.
GoldRush
Exposes Covalent's GoldRush blockchain data APIs as MCP resources and tools.