Samantha
MCP server that dynamically extracts and manages user memory from LLM conversations, enabling consistent personalization across different models.
README
Samantha: MCP Memory Manager
</div>
š Overview
Samantha is a sophisticated MCP (Model Context Protocol) server that dynamically extracts and manages user memory from LLM conversations. This memory can be shared across different LLMs, allowing for consistent personalization even when switching between models.
Samantha analyzes conversations, extracting information about learning styles, topics of interest, knowledge levels, and personal preferences, creating a comprehensive user profile that LLMs can use to provide tailored responses.
š Key Features
- Dynamic Memory Extraction - Automatically identifies learning styles, topics, and preferences from conversations
- Learning Style Analysis - Uses the VARK model (Visual, Auditory, Reading/Writing, Kinesthetic) with detailed recommendations
- Topic Relationship Mapping - Creates connection graphs between knowledge areas
- Personal Preference Tracking - Records and ranks preferences in categories like movies, books, and music
- System Prompt Memory - Stores effective system prompts with effectiveness ratings
- Interactive Dashboard - Visualizes and manages memory profiles
- Multi-format Export/Import - Supports JSON, MentorSync, and LLM-friendly formats
- Docker Integration - Runs in isolated containers with persistent storage
š§ System Requirements
- Docker and Docker Compose
- 512MB RAM minimum (recommend 1GB+)
- 1GB disk space
- For direct installation: Python 3.11+
š Memory Layers
Samantha uses a multi-layered memory architecture:
- Identity Layer - Core user identity
- Learning Style Layer - VARK profile with weighted representations
- Knowledge Layer - Topics with mastery levels and relationships
- Preference Layer - Category-based preference tracking with scoring
- Interaction Layer - Conversation style preferences
- System Layer - Effective system prompts with effectiveness scores
š¾ Docker Memory Requirements
- Base Image: ~500MB
- Runtime Memory: 300-500MB (depends on number of active users)
- Storage: Minimal (~1KB per user profile)
- Total: ~1GB recommended allocation
š Quick Start
Using Docker (Recommended)
# Clone the repository
git clone https://github.com/yourusername/samantha-mcp.git
cd samantha-mcp
# Start the services
docker-compose up -d
# Access the dashboard
open http://localhost:8501
Manual Installation
# Clone the repository
git clone https://github.com/yourusername/samantha-mcp.git
cd samantha-mcp
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Download spaCy model
python -m spacy download en_core_web_md
# Run the server
python samantha.py
# In a separate terminal, run the dashboard
streamlit run dashboard.py
šļø System Architecture
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Claude Desktop ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāā¼āāāāāāāāāāāāāā
ā MCP Protocol ā
āāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Samantha Server ā
ā ā
ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā ā
ā ā Memory ā ā Memory ā ā MCP ā ā
ā ā Extractor āāāāā⤠Store āāāāā⤠Interface ā ā
ā āāāāāāāā¬āāāāāāā āāāāāāāā¬āāāāāāā āāāāāāāā¬āāāāāāā ā
ā ā ā ā ā
ā āāāāāāāā¼āāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāā¼āāāāāāā ā
ā ā Data Models ā ā
ā ā (Learning Style, Topics, Preferences, etc.) ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā āāāāāāā¼āāāāā ā
ā ā JSON ā ā
ā ā Storage ā ā
ā āāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāā¼āāāāāāāāā
ā Streamlit ā
ā Dashboard ā
āāāāāāāāāāāāāāāāāāāā
š¦ File Structure
samantha-mcp/
āāā samantha.py # Core MCP server implementation
āāā dashboard.py # Streamlit dashboard
āāā Dockerfile # Container definition
āāā docker-compose.yml # Container orchestration
āāā requirements.txt # Python dependencies
āāā setup.sh # Setup script
āāā data/ # Persistent storage directory
āāā docs/ # Documentation
š MCP Integration
Resources
| Resource Path | Description |
|---|---|
memory://{user_id}/profile |
Complete user memory profile |
memory://{user_id}/learning_style |
VARK learning style with recommendations |
memory://{user_id}/topics |
Knowledge topics and mastery levels |
memory://{user_id}/system_prompts |
Effective system prompts |
memory://{user_id}/preferences/{category} |
Specific preference category |
memory://{user_id}/conversation_style |
Communication style preferences |
Tools
| Tool Name | Description |
|---|---|
extract_memory |
Extract memory from a conversation |
add_system_prompt |
Add a new system prompt |
update_system_prompt_effectiveness |
Update system prompt effectiveness rating |
update_topic_mastery |
Update topic mastery level |
relate_topics |
Establish relationships between topics |
update_learning_style |
Manually update learning style |
export_memory |
Export user memory in specified format |
import_memory |
Import user memory from specified format |
delete_user_memory |
Delete a user's memory |
š Memory Extraction Process
The memory extraction process involves:
- Conversation Analysis: Processing text for learning style indicators, topic mentions, and preferences
- Pattern Matching: Identifying learning patterns using NLP techniques
- Weighted Updates: Incorporating new insights with a 30/70 weighted model (new/existing)
- Profile Construction: Building a comprehensive user profile
- Persistent Storage: Saving memory in JSON format for retrieval
š® Dashboard Features
The interactive Streamlit dashboard provides:
- User Profile Overview: Summary of all memory components
- Learning Style Management: Visual editors for VARK profiles
- Topic Network Visualization: Interactive graph of knowledge areas
- System Prompt Library: Create and rate effective prompts
- Preference Management: Track and organize user likes
- Import/Export Tools: Data backup and transfer functionality
š§ Production Deployment
For production deployment, consider:
Docker Swarm/Kubernetes
# Deploy to Docker Swarm
docker stack deploy -c docker-compose.yml samantha
# Or with Kubernetes
kubectl apply -f k8s-deployment.yml
Multiple Instances with Load Balancing
# Example docker-compose.override.yml
services:
samantha:
deploy:
replicas: 3
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- samantha
Data Volume Management
The data directory contains all user profiles and should be backed up regularly:
# Backup data
tar -czf samantha-data-backup.tar.gz data/
# Restore data
tar -xzf samantha-data-backup.tar.gz
š Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| Port conflicts | Modify port mappings in docker-compose.yml |
| Memory errors | Increase container memory limits |
| Missing dependencies | Ensure all requirements are installed |
| Data persistence issues | Check volume mounts and permissions |
| spaCy model errors | Manually download with python -m spacy download en_core_web_md |
Logs
# View container logs
docker-compose logs -f
# Check specific container
docker logs samantha
š Performance Monitoring
For production deployments, add monitoring:
# With Prometheus/Grafana
docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d
š¤ Contributing
Contributions welcome! Please see CONTRIBUTING.md for details.
š License
Samantha is released under the MIT License. See LICENSE for details.
š Acknowledgments
- The Model Context Protocol team for the MCP specification
- Streamlit for the dashboard framework
- spaCy for NLP capabilities
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.