elasticsearch-mcp
elasticsearch-mcp
Elasticsearch용 MCP 서버로, REST API를 직접 기반으로 구축되었습니다(elasticsearch-py 의존성이 없으므로 HTTP만 노출하는 OpenSearch 및 관리형 클러스터에서도 작동합니다).
쿼리, 진단, 매핑, 클러스터 작업을 다루는 21개의 도구를 제공합니다. 기본적으로 읽기 전용이며, 모든 쓰기 경로는 게이트로 보호됩니다.
Install
git clone <your-repo> elasticsearch-mcp && cd elasticsearch-mcp
uv sync # or: pip install -e ".[dev]"
cp .env.example .env
pytest -qRelated MCP server: OpenSearch MCP Server
Register with Claude Code / Claude Desktop
Claude Code / Claude Desktop에 등록
{
"mcpServers": {
"elasticsearch": {
"command": "uv",
"args": ["--directory", "/abs/path/elasticsearch-mcp", "run", "elasticsearch-mcp"],
"env": {
"ES_MCP_HOSTS": "https://es.internal:9200",
"ES_MCP_API_KEY": "base64-encoded-api-key",
"ES_MCP_INDEX_ALLOW": "logs-*,metrics-*",
"ES_MCP_READ_ONLY": "true"
}
}
}
}stdio 대신 원격/공유 배포:
elasticsearch-mcp --transport streamable-httpTools
도구
Query
Tool | 기능 |
| Query DSL을 실행합니다. 크기 상한 적용, 타임아웃 주입, deep paging 거부, |
| 구조화된 사양을 유효한 DSL로 변환하고 인덱스에 대해 검증하며 필드 카탈로그를 반환합니다. |
|
|
| 히트를 가져오지 않고 매칭 개수 계산 |
Diagnostics
Tool | 기능 |
| 상태, 샤드 개수, 대기 중인 작업, 선택적으로 노드별 힙/디스크/CPU/거부 정보 |
| 인덱스별: 문서 수, 저장소, 세그먼트, 평균 쿼리 및 인덱싱 지연, 머지 |
|
|
| 평균 쿼리 지연 기준 인덱스 순위, 실행 중인 검색 작업, 스레드 풀 거부, slowlog 임계값 |
Mapping
Tool | 기능 |
| 문서 개수와 크기가 포함된 인덱스 및 별칭 |
| multi-field를 포함한 플랫하게 정리된 |
| 애널라이저의 토큰 출력, 제로 히트 match 쿼리 디버깅용 |
| 추가적 매핑 변경 (쓰기 게이트 적용) |
Operations
Tool | 기능 |
| 스냅샷 인벤토리 및 진행 상황 |
| 선택한 인덱스를 기본적으로 비동기 방식으로 스냅샷 생성 |
| 기존 열린 인덱스 사전 점검 및 rename 지원을 포함한 복원 |
| 쿼리, pipeline, script, slicing, throttling을 지원하는 비동기 reindex; task id 반환 |
| 장기 실행 작업 폴링 또는 중단 |
| 버전, 배포판 및 활성화된 안전 정책 |
Configuration
모든 변수는 ES_MCP_ 접두사를 사용하며 환경 변수 또는 .env에서 읽습니다.
Variable | Default | Purpose |
|
| 쉼표로 구분; 장애 조치 대상 |
| – | 인증 모드 하나 선택 |
|
| TLS |
|
| 429/502/503/504 및 연결 오류에 대한 재시도, 지터가 있는 백오프 및 |
|
| 모든 쓰기 도구에 대한 마스터 스위치 |
|
| restore, reindex, put_mapping 이중 게이트 |
|
| 글로브 허용 목록 |
|
| 글로브 거부 목록; 거부가 우선 |
|
| 히트 상한 |
|
| bucket 폭주 거부 |
|
| 쿼리별 안전장치 |
|
| 토큰 제어 |
| 미설정 | 모든 도구 호출과 결과를 기록하는 JSONL |
|
| 로그는 stderr로만 출력되며, 절대 stdout으로 출력되지 않음 (stdio 전송) |
Safety model
네 가지 독립된 레이어가 모두 fail-closed 방식으로 동작합니다:
인덱스 정책 — 모든 호출에서 허용 목록과 거부 목록을 확인하며, 거부가 우선 적용됩니다. 전체 클러스터에 대한 와일드카드 쓰기는 거부됩니다.
읽기 전용 — 변경 도구는
READ_ONLY=false가 아닌 한 거부됩니다.파괴적 작업 게이트 — restore, reindex, put_mapping은 추가로
ALLOW_DESTRUCTIVE=true와 호출 자체에 명시적인confirm=true인수가 필요합니다.쿼리 제한 — 크기 상한, agg bucket 상한, agg 중첩 깊이 상한, deep paging 거부, 검색 타임아웃 주입.
도구는 예외를 던지는 대신 오류를 읽을 수 있는 텍스트(ERROR (run_query): ...)로 반환하므로, 모델이 멈추지 않고 스스로 수정할 수 있습니다.
권장 프로덕션 구성: 허용된 인덱스에 정확히 read 권한이 있는 전용 ES API 키를 사용하고, READ_ONLY=true를 유지하며, 어시스턴트에서 reindex/restore가 실제로 필요할 때만 별도의 쓰기 가능 인스턴스를 사용하세요.
Extending
src/es_mcp/tools/ 아래에 모듈을 추가하고, register(server, ctx)를 노출하며, server.build_server에서 연결하세요. 정책 확인에는 ctx.guard를, 출력에는 ctx.render를 사용하면 제한이 자동으로 적용됩니다.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server that enables interaction with Elasticsearch and OpenSearch clusters for searching documents and managing indices. It provides tools for cluster health monitoring, index configuration, and general API requests.16Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with OpenSearch clusters to monitor cluster health, manage indices, and perform data searches. It provides a standardized interface for real-time OpenSearch operations within MCP-compatible environments like Open WebUI.
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with OpenSearch clusters for searching indices, retrieving mappings, and managing shards through the MCP protocol.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server for exploring and searching OpenSearch clusters, enabling log analysis, index exploration, and query execution.MIT
Related MCP Connectors
Search, document and execute authenticated API calls across 700+ apps via one MCP server
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Read-only Remote MCP for externally grounded AI agent trust receipts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/baburajr/elasticsearch_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server