Elasticsearch Knowledge Graph for MCP
This server is an Elasticsearch Knowledge Graph for MCP that provides persistent memory for AI conversations, enabling structured storage, retrieval, and management of knowledge across interactions.
You can:
Create, update, and delete entities (people, concepts, projects) with attributes and relevance scores
Manage relationships between entities with support for automatic entity creation
Search using powerful Elasticsearch queries with fuzzy matching and wildcards
Add observations to existing entities and mark important ones for relevance scoring
Organize memory into distinct zones with capabilities to create, delete, merge, and copy entities between zones
Retrieve recent entities and detailed information about specific entities and their relationships
Get statistics about entities and relationships in specific zones
Automate maintenance with features like cascading deletions and conflict resolution during merges
Uses Elasticsearch as the backend for the knowledge graph, providing distributed, scalable storage for entities and relations with advanced search capabilities
Provides a TypeScript interface to Elasticsearch with all core operations for interacting with the knowledge graph
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Elasticsearch Knowledge Graph for MCP what do we know about Emma's upcoming birthday?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-brain-tools
An MCP server that gives AI agents persistent memory with built-in freshness tracking and spaced repetition. Backed by Elasticsearch.
Unlike simple key-value memory stores, mcp-brain-tools tracks how old each piece of knowledge is, flags what needs review, and lets agents verify information to keep it fresh — inspired by how spaced repetition helps humans retain knowledge.
Features
Spaced repetition freshness — each entity has a review interval that doubles on verification (capped at 365 days). Confidence labels (fresh/normal/aging/stale/archival) tell agents what to trust.
Progressive search — queries return fresh results first, automatically widening to include older data only when needed.
Observations as entities — each observation gets its own freshness lifecycle, so "build is broken" (1-day review) and "founded in 2015" (365-day review) age independently.
Memory zones — isolate knowledge by project, team, or domain.
AI-powered filtering — optional Groq integration scores search results by relevance.
DRY by design — tool descriptions guide agents not to store what's already in code, git, or docs.
Related MCP server: Elastic Brain ZH
Setup
Prerequisites
Node.js >= 18
Docker (for Elasticsearch) or a remote Elasticsearch instance
Install and build
npm install
npm run buildStart Elasticsearch
npm run es:startOr point to your own instance via ES_NODE environment variable.
Configure your MCP client
Add to your Claude Code, Claude Desktop, or other MCP client config:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/path/to/mcp-brain-tools/dist/index.js"],
"env": {
"ES_NODE": "http://localhost:9200",
"GROQ_API_KEY": "your-key-here"
}
}
}
}GROQ_API_KEY is optional — enables AI-powered search filtering and zone relevance scoring.
Install the auto-memory hook (Claude Code only)
The memory hook runs on every user message and automatically injects relevant context — no agent cooperation needed.
Add to ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "node /path/to/mcp-brain-tools/dist/memory-hook.js"
}
]
}
]
}
}The hook uses the same ES_NODE, AI_API_KEY/GROQ_API_KEY, AI_API_BASE, and AI_MODEL env vars (set them in the env block of your settings, or export them in your shell profile).
AI_API_BASE defaults to Groq's endpoint but accepts any OpenAI-compatible API URL.
How it works
Entities and observations
Entities represent anything worth remembering — people, projects, decisions, facts. Each entity has:
A name and type
Spaced repetition fields:
verifiedAt,reviewInterval,nextReviewAtA confidence label computed from freshness:
1 - (daysSinceVerified / reviewInterval)
Observations are stored as separate entities linked via is_observation_of relations. Each observation has its own review cadence:
Entity: "iaptic-server" (type: Project, reviewInterval: 30 days)
<- "iaptic-server: uses TypeScript" (reviewInterval: 180 days)
<- "iaptic-server: migration in progress" (reviewInterval: 7 days)Freshness lifecycle
Entity created —
confidence: "fresh", default review in 7 daysReview date passes —
confidence: "aging",needsReview: trueAgent verifies (via
verify_entity) — interval doubles, confidence resets to freshLong overdue —
confidence: "stale"then"archival", excluded from default search
Progressive search
When searching, the server uses three passes:
freshness >= 0— fresh and normal entitiesfreshness >= -2— adds aging and staleNo filter — adds archival
This keeps results clean while ensuring nothing is permanently lost.
MCP Tools
Tool | Description |
| Create entities with optional observations and reviewInterval |
| Update existing entities |
| Delete entities (with optional cascade) |
| Add observations as separate entities with own freshness |
| Confirm entity is still accurate, extend review interval |
| Search with progressive freshness filtering |
| Get specific entities by name with freshness metadata |
| Get recently accessed entities |
| Create relationships between entities |
| Remove relationships |
| AI-powered entity retrieval with tentative answers |
| AI-powered file content inspection |
| List memory zones (with AI relevance scoring) |
| Manage memory zones |
| Transfer entities between zones |
| Merge zones with conflict resolution |
| Get entity/relation counts for a zone |
| Boost entity relevance score |
| Get current UTC time |
Environment variables
Variable | Default | Description |
|
| Elasticsearch URL |
| — | Elasticsearch username |
| — | Elasticsearch password |
| — | Groq API key for AI filtering |
|
| Comma-separated model list |
|
| Elasticsearch index prefix |
|
| Default memory zone |
|
| Enable debug logging |
Recommended agent instructions
For agents to actively use the memory server, add something like this to your CLAUDE.md (or equivalent instructions file):
## Memory
Use MCP Memory (`mcp__memory__*` tools) — a shared knowledge graph across all agents, projects, and computers.
**When to SAVE (immediately, before moving on):**
- Something you tried didn't work (non-transient) → save what failed and why, so no agent repeats it
- A decision was made (architectural, design, workflow) → save the decision and the reason
- The user corrects you or gives explicit instructions → save the rule
- You learn something non-obvious that took effort to discover → save it
**When to SEARCH (before starting, not after failing):**
- **At the start of every non-trivial task** — search before thinking, not after hitting a wall
- About to try an approach that might have been attempted before → search first
- User references something from a past session → search before asking
**Rules:**
- Skip anything easy to find in code, git log, or docs
- Use the project name as the zone for project-specific knowledge; `default` for general knowledge
- Keep entries short — the AI filters server-side, so be generous rather than selective
- Short `reviewInterval` (e.g. 3–7 days) for volatile facts; longer (30–180) for stable onesThe key insight: agents need explicit trigger-based instructions ("when X, do Y"), not just descriptions of what the tool does.
Development
npm run build # Compile TypeScript
npm run dev # Watch mode
npm run test:jest # Run Jest tests
npm run es:start # Start Elasticsearch
npm run es:stop # Stop Elasticsearch
npm run es:reset # Wipe data and restart
npm run import # Import from JSON
npm run export # Export to JSONLicense
MIT
Available Tools
20 toolsadd_observationsC
Add observations to an existing entity in knowledge graph (memory)
Inputs: memory_zone (required), name (required), observations (required).
copy_entitiesC
Copy entities between zones with optional relation handling.
Inputs: names (required), source_zone (required), target_zone (required), copy_relations, +1 more.
create_entitiesC
Create entities in knowledge graph (memory)
Inputs: entities (required), memory_zone (required).
create_relationsC
Create relationships between entities in knowledge graph (memory)
Inputs: relations (required), auto_create_missing_entities, memory_zone.
create_zoneC
Create a new memory zone with optional description.
Inputs: name (required), description, shortDescription.
delete_entitiesC
Delete entities from knowledge graph (memory)
Inputs: memory_zone (required), names (required), cascade_relations.
delete_relationsC
Delete relationships from knowledge graph (memory)
Inputs: relations (required), memory_zone.
delete_zoneA
Delete a memory zone and all its entities/relations.
Inputs: confirm (required), name (required).
get_recentB
Get recently accessed entities from knowledge graph (memory) and their relations
Inputs: memory_zone (required), includeObservations, limit.
get_time_utcA
Get the current UTC time in YYYY-MM-DD hh:mm:ss format
Inputs: no named parameters.
inspect_filesC
Agent driven file inspection that uses AI to retrieve relevant content from multiple files.
Inputs: file_paths (required), include_lines (required), information_needed (required), keywords (required), +1 more.
inspect_knowledge_graphC
Agent driven knowledge graph inspection that uses AI to retrieve relevant entities and relations based on a query.
Inputs: information_needed (required), keywords (required), entity_types, include_entities, +3 more.
list_zonesA
List all available memory zones with metadata. When a reason is provided, zones will be filtered and prioritized based on relevance to your needs.
Inputs: reason.
mark_importantB
Mark entity as important in knowledge graph (memory) by boosting its relevance score
Inputs: important (required), memory_zone (required), name (required), auto_create.
merge_zonesC
Merge multiple zones with conflict resolution options.
Inputs: source_zones (required), target_zone (required), delete_source_zones, overwrite_conflicts.
move_entitiesC
Move entities between zones (copy + delete from source).
Inputs: names (required), source_zone (required), target_zone (required), move_relations, +1 more.
open_nodesB
Get details about specific entities in knowledge graph (memory) and their relations
Inputs: memory_zone (required), names (required).
search_nodesA
Search entities using ElasticSearch query syntax. Supports boolean operators (AND, OR, NOT), fuzzy matching (~), phrases ("term"), proximity ("terms"N), wildcards (*, ?), and boosting (^N). Examples: 'meeting AND notes', 'Jon', '"project plan"~2'. All searches respect zone isolation.
Inputs: informationNeeded (required), memory_zone (required), query (required), reason (required), +4 more.
update_entitiesC
Update entities in knowledge graph (memory)
Inputs: entities (required), memory_zone (required).
zone_statsC
Get statistics for entities and relationships in a zone.
Inputs: zone (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Most tools have distinct purposes, such as create_entities vs. update_entities or list_zones vs. zone_stats. However, some overlap exists: open_nodes and get_recent both retrieve entity details, and copy_entities vs. move_entities could be confused, though descriptions clarify differences.
Tool names follow a consistent verb_noun pattern throughout, such as create_entities, delete_relations, and inspect_files. All use snake_case with clear, descriptive verbs, making the set predictable and easy to navigate.
With 20 tools, the count is slightly high but reasonable for managing a knowledge graph with zones, entities, and relations. It covers operations like CRUD, inspection, and zone management, though it might feel heavy compared to simpler servers.
The toolset provides comprehensive coverage for a knowledge graph domain, including entity and relation CRUD, zone management (create, delete, merge, list), search capabilities, and utilities like time retrieval. No obvious gaps are present; agents can perform full lifecycle operations.
Maintenance
Related MCP Connectors
Intelligent context infrastructure for AI teams: knowledge graph, sessions, tasks, documents.
Shared long-term memory for AI agents: save and recall context as a searchable knowledge graph.
Persistent knowledge graph for AI agents. Remember, recall, and forget facts.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Related MCP Servers
- AlicenseAqualityDmaintenanceA comprehensive Model Context Protocol server that integrates Elasticsearch search with file operations, document validation, and version control to transform AI assistants into powerful knowledge management systems.27201 PyPI27MIT
- AlicenseBqualityDmaintenanceAn Elasticsearch-based AI memory system optimized for Chinese that enables persistent knowledge storage and complex entity relationship management via the Model Context Protocol. It features advanced semantic search using the IK analyzer and supports multi-zone memory isolation for specialized knowledge graphs.20MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent, intelligent memory using Elasticsearch with hierarchical categorization and semantic search for LLM contexts.12 PyPI8MIT

LogicMem MCP Serverofficial
AlicenseBqualityCmaintenanceProvides persistent memory, reasoning, agent-to-agent sharing, and immutable audit trail for AI agents via the Model Context Protocol.121MIT