EL

Elasticsearch MCP Server: Deprecated, Critical Security Updates Only

Migrate off this MCP server now; it is deprecated and will receive only critical security updates going forward.

Quick Install
npx -y @elastic/mcp-server-elasticsearch

Overview

The Elasticsearch MCP Server implements the Model Context Protocol (MCP) as a bridge between AI agents and Elasticsearch clusters. It lets MCP-compatible agents query, analyze, and retrieve data from Elasticsearch indices without you having to write a custom API layer. The server supports two transport modes: stdio (local client processes) and streamable-HTTP (web-friendly, concurrent clients).

Important: this MCP server is deprecated and will only receive critical security fixes going forward. Migrate off this project as soon as feasible — Elastic recommends using the Elastic Agent Builder MCP endpoint (available in Elastic 9.2.0+ and Elasticsearch Serverless) or another maintained MCP implementation.

Features

  • MCP-compatible server that exposes Elasticsearch data to AI agents
  • Two transport modes:
    • stdio for direct, local client connections
    • streamable-HTTP for web integrations and concurrent sessions
  • Supports Elasticsearch authentication via API key or basic username/password
  • Health endpoint for readiness checks (HTTP mode)
  • Configurable TLS verification (skip option for development)
  • Designed for connecting agents to:
    • search indices
    • vector/embedding indexes
    • ad-hoc retrieval workflows

Installation / Configuration

Prerequisites:

  • Elasticsearch cluster (8.x or 9.x) reachable from your environment
  • Docker runtime (EC2, container host, etc.)
  • MCP-compatible client (Claude Desktop, Cursor, VS Code extension, etc.)
  • Network connectivity to Elasticsearch

Environment variables (common to both modes):

VariableRequiredDescription
ES_URLyesElasticsearch URL (e.g. https://es-cluster.example.com:9200)
ES_API_KEYconditionalAPI key for Elasticsearch (use instead of basic auth)
ES_USERNAMEconditionalUsername for basic auth (use with ES_PASSWORD)
ES_PASSWORDconditionalPassword for basic auth
ES_SSL_SKIP_VERIFYnoSet to “true” to skip TLS verification (development only)

Note: provide either ES_API_KEY or ES_USERNAME/ES_PASSWORD, not both.

Run in stdio mode (direct client process):

docker run -i --rm \
  -e ES_URL \
  -e ES_API_KEY \
  -e ES_USERNAME \
  -e ES_PASSWORD \
  -e ES_SSL_SKIP_VERIFY \
  docker.elastic.co/mcp/elasticsearch \
  stdio

Run in streamable-HTTP mode (port 8080 exposed):

docker run --rm \
  -e ES_URL \
  -e ES_API_KEY \
  -e ES_USERNAME \
  -e ES_PASSWORD \
  -e ES_SSL_SKIP_VERIFY \
  -p 8080:8080 \
  docker.elastic.co/mcp/elasticsearch \
  http

Verify HTTP mode:

# Health check
curl -v http://localhost:8080/ping

# MCP endpoint
curl -v http://localhost:8080/mcp

Configure a local MCP client (example: Claude Desktop stdio wrapper):

{
  "mcpServers": {
    "elasticsearch-mcp-server": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "ES_URL", "-e", "ES_API_KEY", "docker.elastic.co/mcp/elasticsearch", "stdio"],
      "env": {
        "ES_URL": "https://es-cluster.example.com:9200",
        "ES_API_KEY": "your_api_key_here"
      }
    }
  }
}

If your client only supports stdio but the server runs HTTP, use mcp-proxy to bridge stdio → streamable-HTTP.

Use Cases

  • Natural-language retrieval: Allow agents to answer queries by searching Elasticsearch indices and returning relevant documents.
  • Vector search and reranking: Combine embeddings stored in Elasticsearch with agent reasoning for semantic retrieval scenarios.
  • Audit and analysis: Let agents inspect logs, metrics, or observability indices without bespoke APIs.
  • Multi-tenant or web integrations: Use streamable-HTTP to host a single server that serves many agent sessions concurrently.

Concrete example: an agent receives “Find errors for user X in the last 24h” → the agent issues MCP retrieval calls; the MCP server translates them to Elasticsearch queries against the logs index, returns hits and metadata for the agent to summarize.

Available Resources

  • Source repository: https://github.com/elastic/mcp-server-elasticsearch
  • MCP specification and docs: https://modelcontextprotocol.io
  • Elastic Agent Builder MCP endpoint (migration target): Elastic 9.2.0+ documentation

Migration & Security

This project is deprecated. It will only receive critical security updates going forward. Plan to migrate to a supported MCP endpoint (for example, the Elastic Agent Builder MCP endpoint available in Elastic 9.2.0+ or other maintained MCP servers). Keep secrets (API keys / passwords) out of checked-in configs and rotate credentials when decommissioning this server.

If you must continue using this server temporarily, restrict network access, monitor for CVEs, and apply recommended security updates promptly.