Skip to main content
Glama
baburajr

elasticsearch-mcp

by baburajr

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 -q

Related 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-http

Tools

도구

Query

Tool

기능

run_query

Query DSL을 실행합니다. 크기 상한 적용, 타임아웃 주입, deep paging 거부, search_after 지원

generate_dsl

구조화된 사양을 유효한 DSL로 변환하고 인덱스에 대해 검증하며 필드 카탈로그를 반환합니다.

explain_query

_validate?rewrite=true + profile 타이밍 분석 + 문서별 _explain

count_documents

히트를 가져오지 않고 매칭 개수 계산

Diagnostics

Tool

기능

cluster_health

상태, 샤드 개수, 대기 중인 작업, 선택적으로 노드별 힙/디스크/CPU/거부 정보

index_health

인덱스별: 문서 수, 저장소, 세그먼트, 평균 쿼리 및 인덱싱 지연, 머지

shard_allocation

_cat/shards_cluster/allocation/explain의 미할당 샤드 결정 사유

find_slow_queries

평균 쿼리 지연 기준 인덱스 순위, 실행 중인 검색 작업, 스레드 풀 거부, slowlog 임계값

Mapping

Tool

기능

list_indices

문서 개수와 크기가 포함된 인덱스 및 별칭

get_mapping

multi-field를 포함한 플랫하게 정리된 field path -> type 카탈로그

analyze_text

애널라이저의 토큰 출력, 제로 히트 match 쿼리 디버깅용

put_mapping

추가적 매핑 변경 (쓰기 게이트 적용)

Operations

Tool

기능

list_snapshot_repositories, list_snapshots, snapshot_status

스냅샷 인벤토리 및 진행 상황

create_snapshot

선택한 인덱스를 기본적으로 비동기 방식으로 스냅샷 생성

restore_snapshot

기존 열린 인덱스 사전 점검 및 rename 지원을 포함한 복원

reindex

쿼리, pipeline, script, slicing, throttling을 지원하는 비동기 reindex; task id 반환

get_task, cancel_task

장기 실행 작업 폴링 또는 중단

cluster_info

버전, 배포판 및 활성화된 안전 정책

Configuration

모든 변수는 ES_MCP_ 접두사를 사용하며 환경 변수 또는 .env에서 읽습니다.

Variable

Default

Purpose

HOSTS

http://localhost:9200

쉼표로 구분; 장애 조치 대상

API_KEY / USERNAME+PASSWORD / BEARER_TOKEN

인증 모드 하나 선택

VERIFY_CERTS, CA_CERTS, CLIENT_CERT, CLIENT_KEY

true

TLS

REQUEST_TIMEOUT, CONNECT_TIMEOUT, MAX_RETRIES

30, 10, 3

429/502/503/504 및 연결 오류에 대한 재시도, 지터가 있는 백오프 및 Retry-After 포함

READ_ONLY

true

모든 쓰기 도구에 대한 마스터 스위치

ALLOW_DESTRUCTIVE

false

restore, reindex, put_mapping 이중 게이트

INDEX_ALLOW

*

글로브 허용 목록

INDEX_DENY

.*,security-*

글로브 거부 목록; 거부가 우선

DEFAULT_SIZE, MAX_RESULT_SIZE

10, 200

히트 상한

MAX_AGG_BUCKETS

1000

bucket 폭주 거부

SEARCH_TIMEOUT, TERMINATE_AFTER

30s, 미설정

쿼리별 안전장치

MAX_RESPONSE_CHARS, MAX_SOURCE_CHARS

60000, 2000

토큰 제어

AUDIT_LOG_PATH

미설정

모든 도구 호출과 결과를 기록하는 JSONL

LOG_LEVEL

INFO

로그는 stderr로만 출력되며, 절대 stdout으로 출력되지 않음 (stdio 전송)

Safety model

네 가지 독립된 레이어가 모두 fail-closed 방식으로 동작합니다:

  1. 인덱스 정책 — 모든 호출에서 허용 목록과 거부 목록을 확인하며, 거부가 우선 적용됩니다. 전체 클러스터에 대한 와일드카드 쓰기는 거부됩니다.

  2. 읽기 전용 — 변경 도구는 READ_ONLY=false가 아닌 한 거부됩니다.

  3. 파괴적 작업 게이트 — restore, reindex, put_mapping은 추가로 ALLOW_DESTRUCTIVE=true와 호출 자체에 명시적인 confirm=true 인수가 필요합니다.

  4. 쿼리 제한 — 크기 상한, 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를 사용하면 제한이 자동으로 적용됩니다.

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    B
    quality
    C
    maintenance
    An 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.
    16
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI assistants to interact with OpenSearch clusters for searching indices, retrieving mappings, and managing shards through the MCP protocol.
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Read-only MCP server for exploring and searching OpenSearch clusters, enabling log analysis, index exploration, and query execution.
    MIT

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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