MCP MITM Mem0
This project is experimental and deprecated. A new, improved version is being developed at https://github.com/terrymunro/mcp-claude-memories. Please consider using the new version for future projects.
A simplified memory service for Claude that intercepts conversations via MITM proxy and provides memory access through MCP.
Overview
This project provides three core components:
MITM Addon - Intercepts Claude API conversations and stores them in Mem0
MCP Server - Provides tools for Claude to query and manage memories
Reflection Agent - Analyzes conversations to identify patterns and provide insights
What This Project IS For
β Core Use Cases
Personal AI Assistant Memory
Give Claude memory of your past conversations
Enable continuity across sessions
Example: "Claude, what was that Docker command we used last week?"
Project Context Persistence
Maintain project-specific knowledge across conversations
Track decisions, approaches, and solutions
Example: Claude remembers your preferred coding style and project structure
Learning and Adaptation
Claude learns your preferences over time
Identifies patterns in your questions and needs
Example: Claude notices you prefer concise answers and adapts accordingly
Development Workflow Enhancement
Remember debugging sessions and solutions
Track what approaches worked or failed
Example: Claude recalls "We tried approach X for this error before, it didn't work because..."
π― Real-World Examples
Example 1: Continuing Work
Example 2: Learning Preferences
Example 3: Debugging History
What This Project is NOT For
β Not Designed For
Enterprise Knowledge Management
β Multi-tenant memory isolation with RBAC
β Compliance features (GDPR right-to-be-forgotten, HIPAA, SOC2)
β Complex retention policies and data governance
β Instead: Simple user-based memory storage
Team Collaboration
β Shared memory pools across team members
β Real-time sync between multiple Claude instances
β Collaborative knowledge base editing
β Instead: Personal memory for individual users
Structured Data Systems
β CRM replacement for tracking contacts/customers
β Project management tool with tasks and deadlines
β Documentation platform with versioning
β Instead: Conversational memory storage
High-Performance Requirements
β Sub-millisecond memory retrieval
β Real-time streaming of memories
β High-frequency trading or gaming applications
β Instead: Async cloud-based memory suitable for conversations
Complex Analytics
β Business intelligence dashboards
β Advanced NLP analysis pipelines
β Machine learning model training
β Instead: Simple pattern recognition for conversation insights
π« Anti-Patterns to Avoid
Don't try to use this as a general-purpose database
Don't expect ACID transactions or complex queries
Don't store sensitive data without understanding Mem0's security model
Don't assume memories are instantly available after storage
Features
π― Simple & Focused - Just memory capture and retrieval, no enterprise complexity
π Mem0 SaaS - Uses Mem0's cloud service, no local infrastructure needed
π Memory Search - Natural language search across conversation history
π Reflection Analysis - Identifies patterns and suggests improvements
π οΈ MCP Tools - Direct integration with Claude via MCP protocol
π Memory Resources - Browse memories as MCP resources
Setup
1. Get a Mem0 API Key
Sign up at https://app.mem0.ai and get your API key.
2. Configure Environment
3. Install Dependencies
Usage
Running the MITM Proxy
Configure your Claude client to use the proxy (typically localhost:8080).
Running the MCP Server
Configure Claude Code
Add to your .mcp.json:
MCP Tools
search_memories(query, user_id?, limit?)- Search memories using natural languagelist_memories(user_id?)- List all memories for a useradd_memory(messages, user_id?, metadata?)- Manually add memoriesdelete_memory(memory_id)- Delete a specific memoryanalyze_conversations(user_id?, limit?)- Analyze patterns in recent conversationssuggest_next_actions(user_id?)- Get suggestions based on conversation history
MCP Resources
memory://{user_id}- Browse all memories for a specific usermemory://recent- View the 10 most recent memories
Architecture
Concrete Use Case Examples
π§ Software Development Assistant
Scenario: Working on a complex refactoring across multiple sessions
π Debug Session Continuity
Scenario: Debugging an intermittent production issue
π Learning & Mentorship
Scenario: Learning a new technology with Claude as a mentor
ποΈ Project Architecture Evolution
Scenario: Building a startup MVP over several months
π‘ Personal Coding Preferences
Scenario: Claude learns and adapts to your style
Development
Running Tests
Linting
Configuration
All configuration is done via environment variables:
MEM0_API_KEY- Your Mem0 SaaS API key (required)DEBUG- Enable debug logging (default: false)DEFAULT_USER_ID- Default user ID for memories (default: "default_user")MITM_HOST- MITM proxy host (default: "localhost")MITM_PORT- MITM proxy port (default: 8080)MCP_NAME- MCP server name (default: "memory-service")
License
MIT