๐ง Elasticsearch Memory MCP
A powerful Model Context Protocol (MCP) server that provides persistent, intelligent memory using Elasticsearch with hierarchical categorization and semantic search capabilities.
โจ Features
๐ฏ V6.2 - Latest Release
-
๐ท๏ธ Hierarchical Memory Categorization
- 5 category types:
identity,active_context,active_project,technical_knowledge,archived - Automatic category detection with confidence scoring
- Manual reclassification support
- 5 category types:
-
๐ค Intelligent Auto-Detection
- Accumulative scoring system (0.7-0.95 confidence range)
- 23+ specialized keyword patterns
- Context-aware categorization
-
๐ฆ Batch Review System
- Review uncategorized memories in batches
- Approve/reject/reclassify workflows
- 10x faster than individual categorization
-
๐ Backward Compatible Fallback
- Seamlessly loads v5 uncategorized memories
- No data loss during upgrades
- Graceful degradation
-
๐ Optimized Context Loading
- Hierarchical priority loading (~30-40 memories vs 117)
- 60-70% token reduction
- Smart relevance ranking
-
๐พ Persistent Memory
- Vector embeddings for semantic search
- Session management with checkpoints
- Conversation snapshots
๐ ๏ธ Installation
Prerequisites
- Python 3.8+
- Elasticsearch 8.0+
- Git
Step 1: Clone the Repository
git clone https://github.com/fredac100/elasticsearch-memory-mcp.git
cd elasticsearch-memory-mcp
Step 2: Install Dependencies
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install requirements
pip install -r requirements.txt
Step 3: Start Elasticsearch
# Using Docker
docker run -d -p 9200:9200 -e "discovery.type=single-node" elasticsearch:8.0.0
# Or install locally
# https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
Step 4: Configure MCP
For Claude Desktop
Add to ~/.config/Claude/claude_desktop_config.json:
{
"mcpServers": {
"elasticsearch-memory": {
"command": "/path/to/elasticsearch-memory-mcp/venv/bin/python",
"args": [
"/path/to/elasticsearch-memory-mcp/mcp_server.py"
],
"env": {
"ELASTICSEARCH_URL": "http://localhost:9200"
}
}
}
}
For Claude Code CLI
claude mcp add elasticsearch-memory "/path/to/venv/bin/python /path/to/mcp_server.py" \
-e ELASTICSEARCH_URL=http://localhost:9200
๐ Usage
Available Tools
1. save_memory
Save a new memory with automatic categorization.
{
"content": "Fred prefers direct, brutal communication style",
"type": "user_profile",
"importance": 9,
"tags": ["communication", "preference"]
}
2. load_initial_context (Resource)
Loads hierarchical context with:
- Identity memories (who you are)
- Active context (current work)
- Active projects (ongoing)
- Technical knowledge (relevant facts)
3. review_uncategorized_batch ๐ V6.2
Review uncategorized memories in batches.
{
"batch_size": 10,
"min_confidence": 0.6
}
Returns suggestions with auto-detected categories and confidence scores.
4. apply_batch_categorization ๐ V6.2
Apply categorizations in batch after review.
{
"approve": ["id1", "id2"], // Auto-categorize
"reject": ["id3"], // Skip
"reclassify": {"id4": "archived"} // Force category
}
5. search_memory
Semantic search with filters.
{
"query": "SAE project details",
"limit": 5,
"category": "active_project"
}
6. auto_categorize_memories
Batch auto-categorize uncategorized memories.
{
"max_to_process": 50,
"min_confidence": 0.75
}
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ
โ Claude (MCP) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server (v6.2) โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Auto-Detection โ โ
โ โ - Keyword matching โ โ
โ โ - Confidence score โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Batch Review โ โ
โ โ - Review workflow โ โ
โ โ - Bulk operations โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Elasticsearch โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ memories (index) โ โ
โ โ - embeddings (vector) โ โ
โ โ - memory_category โ โ
โ โ - category_confidence โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Category System
| Category | Description | Examples |
|---|---|---|
| identity | Core identity, values, preferences | "Fred prefers brutal honesty" |
| active_context | Current work, recent conversations | "Working on SAE implementation" |
| active_project | Ongoing projects | "Mirror architecture design" |
| technical_knowledge | Facts, configs, tools | "Elasticsearch index settings" |
| archived | Completed, deprecated, old migrations | "Refactored old auth system" |
๐ฏ Auto-Detection Examples
High Confidence (0.8-0.95)
"Fred prefere comunicaรงรฃo brutal" โ identity (0.9)
"Refatoraรงรฃo do sistema SAE concluรญda" โ archived (0.85)
"Prรณximos passos: implementar dashboard" โ active_context (0.8)
Multiple Keywords (Accumulative Scoring)
"Fred prefere comunicaรงรฃo brutal. Primeira vez usando este estilo."
โ Match 1: "Fred prefere" (+0.9)
โ Match 2: "primeira vez" (+0.8)
โ Total: 0.95 (normalized)
๐ Migration from V5
The v6.2 system includes automatic fallback for v5 memories:
- Uncategorized memories โ Loaded via type/tags fallback
- Visual separation โ Categorized vs. fallback sections
- Batch review โ Categorize old memories efficiently
# Review and categorize v5 memories
review_uncategorized_batch(batch_size=20)
apply_batch_categorization(approve=[...])
๐ Performance
- Load initial context: ~10-15s (includes embedding model load)
- Save memory: <1s
- Search: <500ms
- Batch review (10 items): ~2s
- Auto-categorize (50 items): ~5s
๐งช Testing
# Run quick test
python test_quick.py
# Expected output:
# โ
Elasticsearch connected
# โ
Context loaded
# โ
Identity memories found
# โ
Projects separated from fallback
๐ Changelog
V6.2 (Latest)
- โ Improved auto-detection (0.4 โ 0.9 confidence)
- โ 23 new specialized keywords
- โ Batch review tools (review_uncategorized_batch, apply_batch_categorization)
- โ Visual separation (categorized vs fallback)
- โ Accumulative confidence scoring
V6.1
- โ Fallback mechanism for uncategorized memories
- โ Backward compatibility with v5
V6.0
- โ Memory categorization system
- โ Hierarchical context loading
- โ Auto-detection with confidence
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add 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 with Model Context Protocol (MCP)
- Powered by Elasticsearch
- Embeddings by Sentence Transformers
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with โค๏ธ for the Claude ecosystem
Metadata
Release files for elasticsearch-memory-mcp 6.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| elasticsearch_memory_mcp-6.2.0.tar.gz | 35.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| elasticsearch_memory_mcp-6.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.3 kB
Release files / elasticsearch_memory_mcp-6.2.0.tar.gz
| Download URL | elasticsearch_memory_mcp-6.2.0.tar.gz |
|---|---|
| Size | 35.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ae9ae6746d2abf12ce0a6361e7ab607e0c0dba1546dc278d2f91152d9ad01e9
|
|
BLAKE2b-256 checksum How to use checksums |
959d4bd58fa68cd9ccfdec6fbf0e08347592fc179a6a0ad3423b2b34f9e519c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / elasticsearch_memory_mcp-6.2.0-py3-none-any.whl
| Download URL | elasticsearch_memory_mcp-6.2.0-py3-none-any.whl |
|---|---|
| Size | 39.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd3165642a907873b5d2475bf0a60d6e38888b8272c8b03663f430fc6e590ecf
|
|
BLAKE2b-256 checksum How to use checksums |
24bbd2ae52c934652a12ecfc08df1de1ed6435f278496633acc7d81f31689c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|