enhanced-mcp-memory
An MCP server for intelligent memory and task management with semantic search, automatic task extraction, and knowledge graphs, enabling AI assistants to maintain context and learn project conventions.
README
Enhanced MCP Memory
An enhanced MCP (Model Context Protocol) server for intelligent memory and task management, designed for AI assistants and development workflows. Features semantic search, automatic task extraction, knowledge graphs, and comprehensive project management.
✨ Key Features
🧠 Intelligent Memory Management
- Semantic search using sentence-transformers for natural language queries
- Automatic memory classification with importance scoring
- Duplicate detection and content deduplication
- File path associations for code-memory relationships
- Knowledge graph relationships with automatic similarity detection
🧬 Sequential Thinking Engine
- Structured reasoning chains with 5-stage process (analysis, planning, execution, validation, reflection)
- Context management with automatic token optimization
- Conversation continuity across sessions with intelligent summarization
- Real-time token estimation and compression (30-70% reduction)
- Auto-extraction of key points, decisions, and action items
📋 Advanced Task Management
- Auto-task extraction from conversations and code comments
- Priority and category management with validation
- Status tracking (pending, in_progress, completed, cancelled)
- Task-memory relationships in knowledge graph
- Project-based organization
- Complex task decomposition into manageable subtasks
🏗️ Project Convention Learning
- Automatic environment detection - OS, shell, tools, and runtime versions
- Project type recognition - Node.js, Python, Rust, Go, Java, MCP servers, etc.
- Command pattern learning - Extracts npm scripts, Makefile targets, and project commands
- Tool configuration detection - IDEs, linters, CI/CD, build tools, and testing frameworks
- Dependency management - Package managers, lock files, and installation commands
- Smart command suggestions - Corrects user commands based on project conventions
- Windows-specific optimizations - Proper path separators and command formats
- Memory integration - Stores learned conventions for AI context and future reference
📊 Performance Monitoring
- Performance monitoring with detailed metrics
- Health checks and system diagnostics
- Automatic cleanup of old data and duplicates
- Database optimization tools
- Comprehensive logging and error tracking
- Token usage analytics and optimization recommendations
🚀 Easy Deployment
- uvx compatible for one-command installation
- Zero-configuration startup with sensible defaults
- Environment variable configuration
- Cross-platform support (Windows, macOS, Linux)
🏗️ Project Structure
enhanced-mcp-memory/
├── mcp_server_enhanced.py # Main MCP server with FastMCP integration
├── memory_manager.py # Core memory/task logic and project detection
├── sequential_thinking.py # Thinking chains and context optimization
├── database.py # Database operations with retry mechanisms
├── requirements.txt # Python dependencies
├── setup.py # Package configuration
├── data/ # SQLite database storage
├── logs/ # Application logs
🚀 Quick Start
Option 1: Using uvx (Recommended)
# Install and run with uvx
uvx enhanced-mcp-memory
Option 2: Manual Installation
# Clone and install
git clone https://github.com/cbuntingde/enhanced-mcp-memory.git
cd enhanced-mcp-memory
pip install -e .
# Run the server
enhanced-mcp-memory
Option 3: Development Setup
# Clone repository
git clone https://github.com/cbuntingde/enhanced-mcp-memory.git
cd enhanced-mcp-memory
# Install dependencies
pip install -r requirements.txt
# Run directly
python mcp_server_enhanced.py
⚙️ MCP Configuration
Add to your MCP client configuration:
For uvx installation:
{
"mcpServers": {
"memory-manager": {
"command": "uvx",
"args": ["enhanced-mcp-memory"],
"env": {
"LOG_LEVEL": "INFO",
"MAX_MEMORY_ITEMS": "1000",
"ENABLE_AUTO_CLEANUP": "true"
}
}
}
}
For local installation:
{
"mcpServers": {
"memory-manager": {
"command": "python",
"args": ["mcp_server_enhanced.py"],
"cwd": "/path/to/enhanced-mcp-memory",
"env": {
"LOG_LEVEL": "INFO",
"MAX_MEMORY_ITEMS": "1000",
"ENABLE_AUTO_CLEANUP": "true"
}
}
}
}
🛠️ Available Tools
Core Memory Tools
get_memory_context(query)- Get relevant memories and contextcreate_task(title, description, priority, category)- Create new tasksget_tasks(status, limit)- Retrieve tasks with filteringget_project_summary()- Get comprehensive project overview
Sequential Thinking Tools
start_thinking_chain(objective)- Begin structured reasoning processadd_thinking_step(chain_id, stage, title, content, reasoning)- Add reasoning stepsget_thinking_chain(chain_id)- Retrieve complete thinking chainlist_thinking_chains(limit)- List recent thinking chains
Context Management Tools
create_context_summary(content, key_points, decisions, actions)- Compress context for token optimizationstart_new_chat_session(title, objective, continue_from)- Begin new conversation with optional continuationconsolidate_current_session()- Compress current session for handoffget_optimized_context(max_tokens)- Get token-optimized contextestimate_token_usage(text)- Estimate token count for planning
Enterprise Auto-Processing
auto_process_conversation(content, interaction_type)- Extract memories and tasks automaticallydecompose_task(prompt)- Break complex tasks into subtasks
Project Convention Tools
auto_learn_project_conventions()- Automatically detect and learn project patternsget_project_conventions_summary()- Get formatted summary of learned conventionssuggest_correct_command(user_command)- Suggest project-appropriate command correctionsremember_project_pattern(pattern_type, pattern_name, pattern_content, importance)- Manually store project patternsupdate_memory_context(query)- Refresh memory context with latest project conventions
System Management Tools
health_check()- Check server health and connectivityget_performance_stats()- Get detailed performance metricscleanup_old_data(days_old)- Clean up old memories and tasksoptimize_memories()- Remove duplicates and optimize storageget_database_stats()- Get comprehensive database statistics
🏗️ Project Convention Learning
The Enhanced MCP Memory Server automatically learns and remembers project-specific conventions to prevent AI assistants from suggesting incorrect commands or approaches:
Automatic Detection
- Operating System: Windows vs Unix, preferred shell and commands
- Project Type: Node.js, Python, Rust, Go, Java, MCP servers, FastAPI, Django
- Development Tools: IDEs, linters, formatters, CI/CD configurations
- Package Management: npm, yarn, pip, poetry, cargo, go modules
- Build Systems: Vite, Webpack, Make, batch scripts, shell scripts
Smart Command Suggestions
# Instead of generic commands, suggests project-specific ones:
User types: "node server.js"
AI suggests: "Use 'npm run dev' instead for this project"
User types: "python main.py"
AI suggests: "Use 'uvicorn main:app --reload' for this FastAPI project"
Windows Optimization
- Automatically detects Windows environment
- Uses
cmd.exeand Windows-appropriate path separators - Suggests Windows-compatible commands (e.g.,
dirinstead ofls) - Handles Windows-specific Python and Node.js patterns
Memory Integration
All learned conventions are stored as high-importance memories that:
- Appear in AI context for every interaction
- Persist across sessions and project switches
- Include environment warnings and project-specific guidance
- Prevent repeated incorrect command suggestions
🔧 Configuration Options
Configure via environment variables:
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
INFO |
Logging level (DEBUG, INFO, WARNING, ERROR) |
MAX_MEMORY_ITEMS |
1000 |
Maximum memories per project |
MAX_CONTEXT_TOKENS |
8000 |
Token threshold for auto-compression |
CLEANUP_INTERVAL_HOURS |
24 |
Auto-cleanup interval |
ENABLE_AUTO_CLEANUP |
true |
Enable automatic cleanup |
MAX_CONCURRENT_REQUESTS |
5 |
Max concurrent requests |
REQUEST_TIMEOUT |
30 |
Request timeout in seconds |
MEMORY_ENABLE_SECRET_FILTER |
true |
Redact detected credentials (AWS keys, GitHub tokens, JWTs, etc.) before any DB write. Set false to disable. |
MEMORY_STRICT_SECRET_MODE |
false |
When true, refuse to persist any content containing a detected secret instead of saving the redacted version. |
DATA_DIR |
~/ClaudeMemory | Where to store data and logs |
🧪 Testing
The package ships with a pytest suite covering the secret filter, the task status update path, memory deduplication, and basic search. To run it:
pip install -e ".[dev]"
pytest
The suite is safe to run anywhere — every test uses tmp_path and never
touches the production data/ directory. Add new tests under tests/
next to any change in behaviour.
📊 Performance & Monitoring
The server includes built-in performance tracking:
- Response time monitoring for all tools
- Success rate tracking with error counts
- Memory usage statistics
- Database performance metrics
- Automatic health checks
Access via the get_performance_stats() and health_check() tools.
🗄️ Database
- SQLite for reliable, file-based storage
- Automatic schema migrations for updates
- Comprehensive indexing for fast queries
- Built-in backup and optimization tools
- Cross-platform compatibility
Default location: ./data/mcp_memory.db
🔍 Semantic Search
Powered by sentence-transformers for intelligent memory retrieval:
- Natural language queries - "Find memories about database optimization"
- Similarity-based matching using embeddings
- Configurable similarity thresholds
- Automatic model downloading (~90MB on first run)
🧠 Sequential Thinking
Structured reasoning system:
- 5-stage thinking process: Analysis → Planning → Execution → Validation → Reflection
- Token optimization: Real-time estimation and compression (30-70% reduction)
- Context continuity: Intelligent session handoffs with preserved context
- Auto-extraction: Automatically identifies key points, decisions, and action items
- Performance tracking: Monitor reasoning chains and optimization metrics
💼 Token Management
Advanced context optimization for high-scale deployments:
- Smart compression: Pattern-based extraction preserves essential information
- Token estimation: Real-time calculation for planning and budgeting
- Context summarization: Automatic conversion of conversations to actionable summaries
- Session consolidation: Seamless handoffs between conversation sessions
- Performance analytics: Detailed metrics on compression ratios and response times
📝 Logging
Comprehensive logging system:
- Daily log rotation in
./logs/directory - Structured logging with timestamps and levels
- Performance tracking integrated
- Error tracking with stack traces
🤝 Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
🆘 Support
- Issues: GitHub Issues
- Documentation: README
- Discussions: GitHub Discussions
🏷️ Version History
- v2.2.1 - Corrected maintainer identity on the published package
metadata, dropped unused
scipyandfilelockdependencies, removed dead imports, fixed Blacktarget-version, added Python 3.13 classifier, and shippedSECURITY.md/CONTRIBUTING.md/.github/workflows/test.yml. - v2.2.0 - Secret redaction (
SecretFilter) wired into every DB write path. Detects AWS keys, GitHub/GitLab PATs, OpenAI/Anthropic/Google keys, Stripe/Slack/SendGrid/Twilio tokens, JWTs, private keys, bearer headers, credentialed URLs, connection strings, and generic key/password assignments. Default-on; opt into strict mode viaMEMORY_STRICT_SECRET_MODE=true. - v2.1.0 - Production hardening: SQLite WAL + write locking, thread-safe state, structured error envelopes, lazy package imports, real pytest suite, removal of dead
call_toolblock and circular dependency, typed exception handling throughout. - v2.0.2 - Updated package build configuration and license compatibility fixes
- v2.0.1 - Enhanced features with sequential thinking and project conventions
- v1.2.0 - Enhanced MCP server with performance monitoring and health checks
- v1.1.0 - Added semantic search and knowledge graph features
- v1.0.0 - Initial release with basic memory and task management
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。