Elasticsearch Knowledge Graph for MCP
mcp-brain-tools
내장된 신선도 추적 및 간격 반복(spaced repetition) 기능을 통해 AI 에이전트에게 지속적인 메모리를 제공하는 MCP 서버입니다. Elasticsearch를 기반으로 합니다.
단순한 키-값 메모리 저장소와 달리, mcp-brain-tools는 각 지식 조각이 얼마나 오래되었는지 추적하고, 검토가 필요한 항목을 표시하며, 에이전트가 정보를 확인하여 신선하게 유지할 수 있도록 합니다. 이는 간격 반복이 인간의 지식 유지에 도움을 주는 방식에서 영감을 받았습니다.
기능
간격 반복 신선도 — 각 엔티티에는 확인 시 두 배로 늘어나는(최대 365일) 검토 간격이 있습니다. 신뢰도 라벨(신선함/보통/노후화/오래됨/보관됨)은 에이전트에게 무엇을 신뢰해야 하는지 알려줍니다.
점진적 검색 — 쿼리는 신선한 결과를 먼저 반환하며, 필요할 때만 자동으로 더 오래된 데이터를 포함하도록 확장됩니다.
엔티티로서의 관찰 — 각 관찰은 고유한 신선도 수명 주기를 가지므로, "빌드 깨짐"(1일 검토)과 "2015년 설립"(365일 검토)은 독립적으로 노후화됩니다.
메모리 영역 — 프로젝트, 팀 또는 도메인별로 지식을 격리합니다.
AI 기반 필터링 — 선택적인 Groq 통합을 통해 관련성별로 검색 결과의 점수를 매깁니다.
DRY(Don't Repeat Yourself) 설계 — 도구 설명은 에이전트가 코드, git 또는 문서에 이미 있는 내용을 저장하지 않도록 안내합니다.
Related MCP server: Elastic Brain ZH
설정
사전 요구 사항
Node.js >= 18
Docker (Elasticsearch용) 또는 원격 Elasticsearch 인스턴스
설치 및 빌드
npm install
npm run buildElasticsearch 시작
npm run es:start또는 ES_NODE 환경 변수를 통해 자신의 인스턴스를 지정하십시오.
MCP 클라이언트 구성
Claude Code, Claude Desktop 또는 기타 MCP 클라이언트 구성에 추가하십시오:
{
"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는 선택 사항이며, AI 기반 검색 필터링 및 영역 관련성 점수 매기기를 활성화합니다.
자동 메모리 후크 설치 (Claude Code 전용)
메모리 후크는 모든 사용자 메시지에서 실행되며 관련 컨텍스트를 자동으로 삽입합니다. 에이전트의 협조가 필요하지 않습니다.
~/.claude/settings.json에 추가하십시오:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "node /path/to/mcp-brain-tools/dist/memory-hook.js"
}
]
}
]
}
}이 후크는 동일한 ES_NODE, AI_API_KEY/GROQ_API_KEY, AI_API_BASE 및 AI_MODEL 환경 변수를 사용합니다(설정의 env 블록에 설정하거나 셸 프로필에서 내보내십시오).
AI_API_BASE는 기본적으로 Groq의 엔드포인트로 설정되지만, 모든 OpenAI 호환 API URL을 허용합니다.
작동 방식
엔티티 및 관찰
엔티티는 사람, 프로젝트, 결정, 사실 등 기억할 가치가 있는 모든 것을 나타냅니다. 각 엔티티는 다음을 가집니다:
이름 및 유형
간격 반복 필드:
verifiedAt,reviewInterval,nextReviewAt신선도에서 계산된 신뢰도 라벨:
1 - (daysSinceVerified / reviewInterval)
관찰은 is_observation_of 관계로 연결된 별도의 엔티티로 저장됩니다. 각 관찰은 고유한 검토 주기를 가집니다:
Entity: "iaptic-server" (type: Project, reviewInterval: 30 days)
<- "iaptic-server: uses TypeScript" (reviewInterval: 180 days)
<- "iaptic-server: migration in progress" (reviewInterval: 7 days)신선도 수명 주기
엔티티 생성 —
confidence: "fresh", 기본 검토 7일검토 날짜 경과 —
confidence: "aging",needsReview: true에이전트 확인 (
verify_entity를 통해) — 간격이 두 배가 되고, 신뢰도가 신선함으로 재설정됨장기 연체 —
confidence: "stale"후"archival", 기본 검색에서 제외됨
점진적 검색
검색 시 서버는 세 단계를 사용합니다:
freshness >= 0— 신선하고 보통인 엔티티freshness >= -2— 노후화되고 오래된 엔티티 추가필터 없음 — 보관된 엔티티 추가
이렇게 하면 결과가 깔끔하게 유지되면서도 아무것도 영구적으로 손실되지 않습니다.
MCP 도구
도구 | 설명 |
| 선택적 관찰 및 reviewInterval을 포함하여 엔티티 생성 |
| 기존 엔티티 업데이트 |
| 엔티티 삭제 (선택적 캐스케이드 포함) |
| 고유한 신선도를 가진 별도의 엔티티로 관찰 추가 |
| 엔티티가 여전히 정확한지 확인하고 검토 간격 연장 |
| 점진적 신선도 필터링을 사용하여 검색 |
| 신선도 메타데이터와 함께 이름으로 특정 엔티티 가져오기 |
| 최근에 액세스한 엔티티 가져오기 |
| 엔티티 간의 관계 생성 |
| 관계 제거 |
| 잠정적인 답변을 포함한 AI 기반 엔티티 검색 |
| AI 기반 파일 내용 검사 |
| 메모리 영역 나열 (AI 관련성 점수 포함) |
| 메모리 영역 관리 |
| 영역 간 엔티티 전송 |
| 충돌 해결을 포함하여 영역 병합 |
| 영역의 엔티티/관계 수 가져오기 |
| 엔티티 관련성 점수 향상 |
| 현재 UTC 시간 가져오기 |
환경 변수
변수 | 기본값 | 설명 |
|
| Elasticsearch URL |
| — | Elasticsearch 사용자 이름 |
| — | Elasticsearch 비밀번호 |
| — | AI 필터링을 위한 Groq API 키 |
|
| 쉼표로 구분된 모델 목록 |
|
| Elasticsearch 인덱스 접두사 |
|
| 기본 메모리 영역 |
|
| 디버그 로깅 활성화 |
권장 에이전트 지침
에이전트가 메모리 서버를 적극적으로 사용하도록 하려면 CLAUDE.md(또는 동등한 지침 파일)에 다음과 같은 내용을 추가하십시오:
## 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 ones핵심 통찰력: 에이전트는 도구가 무엇을 하는지에 대한 설명뿐만 아니라 명시적인 트리거 기반 지침("X일 때 Y를 수행하라")이 필요합니다.
개발
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 JSON라이선스
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