An MCP (Model Context Protocol) server that provides memory management and context window caching for AI coding environments like Cursor and Claude Desktop. - ๐พ 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 โ Auto
Add this skill
npx mdskills install JamesANZ/memory-mcpWell-documented MongoDB-backed memory server with useful caching and retrieval tools
1# ๐ง Memory MCP Server23> **Persistent memory and context window caching for LLM conversations.** Save, retrieve, and manage memories with intelligent context archiving. MongoDB-backed storage.45An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that provides memory management and context window caching for AI coding environments like Cursor and Claude Desktop.67[](https://archestra.ai/mcp-catalog/jamesanz__memory-mcp)89## Why Use Memory MCP?1011- ๐พ **Persistent Storage** โ MongoDB-backed memory that survives sessions12- ๐ง **Context Caching** โ Intelligent archiving and retrieval of conversation context13- ๐ท๏ธ **Tag-based Search** โ Organize and find memories by tags14- ๐ **Relevance Scoring** โ Automatically score archived content relevance15- โก **Easy Setup** โ One-click install in Cursor or simple manual setup1617## Quick Start1819Ready to add memory to your AI workflow? Install in seconds:2021**Install in Cursor (Recommended):**2223[๐ Install in Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=memory-mcp&config=eyJtZW1vcnktbWNwIjp7ImNvbW1hbmQiOiJucHgiLCJhcmdzIjpbIi15IiwiQGphbWVzYW56L21lbW9yeS1tY3AiXX19)2425**Or install manually:**2627```bash28npm install -g @jamesanz/memory-mcp29# Or from source:30git clone https://github.com/JamesANZ/memory-mcp.git31cd memory-mcp && npm install && npm run build32```3334## Features3536### Basic Memory Tools37- **`save-memories`** โ Save memories to database (overwrites existing)38- **`get-memories`** โ Retrieve all stored memories39- **`add-memories`** โ Append new memories without overwriting40- **`clear-memories`** โ Remove all stored memories4142### Context Window Caching43- **`archive-context`** โ Archive conversation context with tags44- **`retrieve-context`** โ Retrieve relevant archived context45- **`score-relevance`** โ Score archived content relevance46- **`create-summary`** โ Create summaries of archived content47- **`get-conversation-summaries`** โ Get all summaries for a conversation48- **`search-context-by-tags`** โ Search archived content by tags4950## Installation5152### Cursor (One-Click)5354Click the install link above or use:5556```57cursor://anysphere.cursor-deeplink/mcp/install?name=memory-mcp&config=eyJtZW1vcnktbWNwIjp7ImNvbW1hbmQiOiJucHgiLCJhcmdzIjpbIi15IiwiQGphbWVzYW56L21lbW9yeS1tY3AiXX1958```5960### Manual Installation6162**Requirements:** Node.js 18+, npm, MongoDB6364```bash65# Clone and build66git clone https://github.com/JamesANZ/memory-mcp.git67cd memory-mcp68npm install69npm run build7071# Set MongoDB connection string72export MONGODB_URI="mongodb://localhost:27017"7374# Run server75npm start76```7778### Claude Desktop7980Add to `claude_desktop_config.json`:8182**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`83**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`8485```json86{87 "mcpServers": {88 "memory-mcp": {89 "command": "node",90 "args": ["/absolute/path/to/memory-mcp/build/index.js"],91 "env": {92 "MONGODB_URI": "mongodb://localhost:27017"93 }94 }95 }96}97```9899Restart Claude Desktop after configuration.100101## Configuration102103Set the MongoDB connection string:104105```bash106export MONGODB_URI="mongodb://localhost:27017"107```108109Default: `mongodb://localhost:27017`110111## Usage Examples112113### Save Memories114Store memories from a conversation:115116```json117{118 "tool": "save-memories",119 "arguments": {120 "memories": ["User prefers TypeScript", "User works on blockchain projects"],121 "llm": "claude",122 "userId": "user123"123 }124}125```126127### Retrieve Memories128Get all stored memories:129130```json131{132 "tool": "get-memories",133 "arguments": {}134}135```136137### Archive Context138Archive conversation context when it gets too long:139140```json141{142 "tool": "archive-context",143 "arguments": {144 "conversationId": "conv-123",145 "contextMessages": ["Message 1", "Message 2"],146 "tags": ["coding", "typescript"],147 "llm": "claude"148 }149}150```151152### Retrieve Relevant Context153Get archived content relevant to current conversation:154155```json156{157 "tool": "retrieve-context",158 "arguments": {159 "conversationId": "conv-123",160 "tags": ["coding"],161 "minRelevanceScore": 0.5,162 "limit": 10163 }164}165```166167## Context Window Caching168169The system automatically:170- **Archives content** when context usage reaches 80%171- **Retrieves relevant content** when usage drops below 30%172- **Scores relevance** using keyword overlap173- **Creates summaries** to condense long conversations174175## Use Cases176177- **Long Conversations** โ Manage context windows for extended sessions178- **Memory Persistence** โ Save important information across sessions179- **Context Retrieval** โ Bring back relevant past conversations180- **Research Projects** โ Organize and tag research conversations181182## Technical Details183184**Built with:** Node.js, TypeScript, MCP SDK, MongoDB185**Dependencies:** `@modelcontextprotocol/sdk`, `mongodb`, `zod`186**Platforms:** macOS, Windows, Linux187188**Storage:** MongoDB (default: `mongodb://localhost:27017`)189190## Contributing191192โญ **If this project helps you, please star it on GitHub!** โญ193194Contributions welcome! Please open an issue or submit a pull request.195196## License197198ISC199200## Support201202If you find this project useful, consider supporting it:203204**โก Lightning Network**205```206lnbc1pjhhsqepp5mjgwnvg0z53shm22hfe9us289lnaqkwv8rn2s0rtekg5vvj56xnqdqqcqzzsxqyz5vqsp5gu6vh9hyp94c7t3tkpqrp2r059t4vrw7ps78a4n0a2u52678c7yq9qyyssq7zcferywka50wcy75skjfrdrk930cuyx24rg55cwfuzxs49rc9c53mpz6zug5y2544pt8y9jflnq0ltlha26ed846jh0y7n4gm8jd3qqaautqa207```208209**โฟ Bitcoin**: [bc1ptzvr93pn959xq4et6sqzpfnkk2args22ewv5u2th4ps7hshfaqrshe0xtp](https://mempool.space/address/bc1ptzvr93pn959xq4et6sqzpfnkk2args22ewv5u2th4ps7hshfaqrshe0xtp)210211**ฮ Ethereum/EVM**: [0x42ea529282DDE0AA87B42d9E83316eb23FE62c3f](https://etherscan.io/address/0x42ea529282DDE0AA87B42d9E83316eb23FE62c3f)212
Full transparency โ inspect the skill content before installing.