memory-mcp is an MCP server that provides persistent memory management and context window caching for large language model conversations. It connects AI assistants directly to a MongoDB database to record, retrieve, and organize facts or conversational history across separate sessions. Designed for developers and AI practitioners using environments like Cursor and Claude Desktop, the server helps maintain continuous user context without exceeding window limits. It enables agents to execute operations such as saving memory entries, retrieving stored items, archiving extended message threads with custom tags, and calculating relevance scores based on keyword overlap. In addition, the server includes tools to generate and query summaries of past exchanges, allowing LLMs to condense previous interactions and recall pertinent background details on demand. By offloading conversational state to MongoDB, memory-mcp prevents loss of critical context during iterative coding, research, or complex multi-turn sessions across multiple models.
Category: AI Memory & Context
Tags: context, memory, persistence, recall
npm install -g @jamesanz/memory-mcp or clone the repository using git clone https://github.com/JamesANZ/memory-mcp.git followed by npm install and npm run build. 3. Configure your MongoDB connection string by exporting MONGODB_URI (defaults to mongodb://localhost:27017). 4. For Claude Desktop, edit your configuration file (claude_desktop_config.json) and add the server configuration under mcpServers with the command set to node, args pointing to /absolute/path/to/memory-mcp/build/index.js, and env containing MONGODB_URI. 5. For Cursor, install via the provided deep link or manual NPX configuration pointing to @jamesanz/memory-mcp. 6. Restart your MCP client to initialize the server.Part of MCP Servers
You can install memory-mcp globally using npm with the command npm install -g @jamesanz/memory-mcp, or by cloning the repository and running npm install and npm run build. It can also be integrated into Cursor using the one-click install link or added manually to your Claude Desktop configuration file with a running MongoDB instance.
memory-mcp requires a MongoDB instance for persistent storage. By default, it connects to mongodb://localhost:27017, but you can specify a custom connection string by setting the MONGODB_URI environment variable before launching the server or within your MCP client configuration.
The server provides tools to save, retrieve, append, and clear user memories. It also features context window caching capabilities, including archiving conversation messages with tags, retrieving context based on relevance scores, generating conversation summaries, and searching past context by tags.
memory-mcp is compatible with MCP-compliant environments such as Cursor and Claude Desktop on macOS, Windows, and Linux. Any MCP client supporting standard input/output transport and custom environment variables can run this server.
According to the project documentation, memory-mcp is open-source software released under the ISC license.