- MCP Memory Server
MCP Memory Server
MCP Memory Server
A Model Context Protocol (MCP) server that provides persistent memory capabilities for Large Language Models. Store concepts, code snippets, notes, and any information you want your LLM to remember across conversations.
Features
- ๐ง Persistent Memory - Information persists across LLM sessions
- ๐ท๏ธ Smart Organization - Categorize and tag memories for easy retrieval
- ๐ Natural Language Search - Find memories using conversational queries
- ๐ Usage Analytics - Track which memories are accessed most frequently
- ๐ Local Storage - All data stays on your machine
- โก Fast Access - In-memory indexing for quick retrieval
- ๐ง Easy Configuration - Environment variable based configuration
- ๐ก๏ธ Thread Safe - Concurrent access with proper locking
Quick Start
Prerequisites
- Go 1.19 or later
- Claude Desktop application
Installation
- Clone and build the server:
git clone https://github.com/yourusername/mcp-memory-server.git
cd mcp-memory-server
go build -o mcp-memory-server cmd/server/main.go
- Configure Claude Desktop:
Add the following to your Claude Desktop MCP configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"memory": {
"command": "/absolute/path/to/your/mcp-memory-server",
"args": [],
"env": {
"MCP_DATA_DIR": "/Users/yourusername/.mcp-memory"
}
}
}
}
- Restart Claude Desktop
The memory server will now be available in your Claude conversations!
Usage
Once configured, you can use these commands in Claude Desktop:
Store Information
Remember this: The scraping project uses Go with Playwright for browser automation.
The architecture follows domain-driven design with repositories and services.
Category: project
Tags: go, scraping, web-automation
Search Memories
What do you remember about Go web scraping?
List by Category
Show me all my project memories
Get Statistics
What are my memory usage statistics?
Available Tools
The MCP server provides these tools to Claude:
| Tool | Description | Parameters |
|---|---|---|
remember | Store new information | content (required), summary, category, tags |
recall | Search stored memories | query (required), category, tags, limit |
forget | Delete a memory by ID | id (required) |
list_memories | List all memories with filtering | category, tags, limit |
memory_stats | Get usage statistics | None |
Configuration
Configure the server using environment variables:
| Variable | Description | Default |
|---|---|---|
MCP_DATA_DIR | Directory for storing memory files | ~/.mcp-memory |
MCP_LOG_LEVEL | Logging level (debug, info, warn, error) | info |
MCP_LOG_FORMAT | Log format (json, text) | json |
MCP_MAX_FILE_SIZE | Maximum size for memory files (bytes) | 104857600 (100MB) |
MCP_MAX_RESULTS | Maximum search results returned | 20 |
MCP_ENABLE_EMBEDDINGS | Enable semantic search (future) | false |
MCP_EMBEDDING_MODEL | OpenAI embedding model | text-embedding-ada-002 |
Data Storage
Memories are stored in your configured data directory:
~/.mcp-memory/
โโโ memories/ # Individual memory JSON files
โโโ index/ # Search indexes (future enhancement)
โโโ logs/ # Application logs
Each memory includes:
- Unique content-based ID (SHA256 hash)
- Content and optional summary
- Categories and tags for organization
- Creation and update timestamps
- Access statistics and last access time
- Custom metadata
Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Claude LLM โโโโโบโ MCP Protocol โโโโโบโ Memory Store โ
โ โ โ (JSON-RPC) โ โ (File-based) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Local Storage โ
โ ~/.mcp-memory/ โ
โโโโโโโโโโโโโโโโโโโโ
Development
Project Structure
mcp-memory-server/
โโโ cmd/server/ # Main application entry point
โโโ internal/
โ โโโ config/ # Configuration management
โ โโโ mcp/ # MCP protocol implementation
โ โโโ memory/ # Memory storage and retrieval
โโโ pkg/logger/ # Logging utilities
โโโ go.mod
โโโ README.md
Building from Source
# Clone the repository
git clone https://github.com/yourusername/mcp-memory-server.git
cd mcp-memory-server
# Install dependencies
go mod tidy
# Build
go build -o mcp-memory-server cmd/server/main.go
# Run tests
go test ./...
Testing the Server
You can test the MCP server manually using JSON-RPC:
# List available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./mcp-memory-server
# Store a memory
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"remember","arguments":{"content":"Test memory","category":"test"}}}' | ./mcp-memory-server
Troubleshooting
Server not starting:
- Verify the binary has execute permissions
- Check that the data directory is writable
- Review logs in the data directory
Claude not connecting to server:
- Ensure the path in
claude_desktop_config.jsonis absolute - Verify the server binary exists and is executable
- Check Claude Desktop logs for connection errors
- Restart Claude Desktop after configuration changes
Memory not persisting:
- Check file permissions in the data directory
- Verify
MCP_DATA_DIRenvironment variable is set correctly - Look for error messages in the server logs
Future Enhancements
- Semantic Search - Vector embeddings for better search relevance
- Web Interface - Browser-based memory management
- Import/Export - Backup and restore capabilities
- Memory Expiration - Automatic cleanup of old memories
- Encryption - Secure storage for sensitive information
- Multi-user Support - Separate memory spaces for different users
- Advanced Search - Boolean queries and filters
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built for the Model Context Protocol
- Designed to work seamlessly with Claude Desktop
- Inspired by the need for persistent memory in LLM conversations
Support
If you encounter any issues or have questions:
- Check the troubleshooting section
- Search existing GitHub issues
- Create a new issue with detailed information about your problem
Made with โค๏ธ for the MCP community