mcp-server-elasticsearch

by @elastic

Elasticsearch MCP Server

Connect AI agents to Elasticsearch 8.x and 9.x clusters to inspect indices, field mappings, shards, Query DSL searches, and ES|QL analytics via Docker. Note: Elastic has officially deprecated this standalone server in favor of the Elastic Agent Builder MCP endpoint in Elastic 9.2.0+ and Serverless.

Databases737rustApache-2.0

Server facts

mcp-server-elasticsearch

GitHub stars

737

Last commit

Nov 25, 2026

Runtime

rust

License

Apache-2.0

Tech

Runtime
rust
Transports
stdiostreamable-http
Remote access
No
Authentication
Elasticsearch API Key or Basic Auth (ES_API_KEY / ES_USERNAME+ES_PASSWORD)

Activity

GitHub stars
737
Last commit
Data as of

Tags

  • elasticsearch
  • mcp
  • mcp server
  • vector database

Overview

Anyone evaluating elasticsearch mcp should note Elastic's prominent deprecation banner first: `elastic/mcp-server-elasticsearch` now receives critical security fixes only and is superseded by the built-in Elastic Agent Builder MCP endpoint on Elastic 9.2.0+ and Elasticsearch Serverless. For teams still operating Elasticsearch 8.x or self-managed 9.x clusters that need a standalone Apache-2.0 container bridge, version 0.4.0+ ships as the `docker.elastic.co/mcp/elasticsearch` image and runs in either direct `stdio` mode or multi-client `streamable-HTTP` mode (SSE is deprecated).

Agents interact with cluster data through 5 focused tools—`list_indices`, `get_mappings`, `search` (Query DSL), `esql`, and `get_shards`—working cleanly in Claude Desktop, Cursor, VS Code, or containerized AWS EC2/ECS/EKS deployments. Authentication passes strictly through runtime environment variables (`ES_URL` paired with `ES_API_KEY`, or `ES_USERNAME` and `ES_PASSWORD`, plus optional dev-only `ES_SSL_SKIP_VERIFY=true`) so credentials are never written to disk or logged. Start the Elastic container image in `stdio` mode with those credentials passed through Docker flags for local desktop clients, or launch `http` mode on port `8080` to serve `/mcp` alongside the `/ping` health probe (`pong`).

Install & configure

Requirements

  • Docker runtime capable of pulling `docker.elastic.co/mcp/elasticsearch` (or AWS Marketplace container image)
  • Reachable Elasticsearch 8.x or 9.x cluster URL (`ES_URL`)
  • Elasticsearch `ES_API_KEY` (recommended with minimal read-only index permissions) or `ES_USERNAME` + `ES_PASSWORD`
Documented launch / install command
docker pull docker.elastic.co/mcp/elasticsearch

Launch in stdio mode with `docker run -i --rm -e ES_URL -e ES_API_KEY docker.elastic.co/mcp/elasticsearch stdio`, or swap `stdio` for `http` and expose `-p 8080:8080` to serve Streamable HTTP at `/mcp` and health checks at `/ping`. Free-tier Claude Desktop users bridging to HTTP mode can pair it with `mcp-proxy`.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "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": "<elasticsearch-cluster-url>",
        "ES_API_KEY": "<elasticsearch-API-key>"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "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": "<elasticsearch-cluster-url>",
        "ES_API_KEY": "<elasticsearch-API-key>"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "elasticsearch-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "ES_URL",
        "-e",
        "ES_API_KEY",
        "docker.elastic.co/mcp/elasticsearch",
        "stdio"
      ],
      "env": {
        "ES_URL": "<elasticsearch-cluster-url>",
        "ES_API_KEY": "<elasticsearch-API-key>"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "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": "<elasticsearch-cluster-url>",
        "ES_API_KEY": "<elasticsearch-API-key>"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "elasticsearch-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "ES_URL",
        "-e",
        "ES_API_KEY",
        "docker.elastic.co/mcp/elasticsearch",
        "stdio"
      ],
      "env": {
        "ES_URL": "<elasticsearch-cluster-url>",
        "ES_API_KEY": "<elasticsearch-API-key>"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
list_indicesLists all Elasticsearch indices visible to the configured API key or basic-auth user.
get_mappingsReturns the field mapping schema for a specified Elasticsearch index before constructing queries.
searchExecutes an Elasticsearch search query using standard Query DSL against cluster indices.
esqlRuns an Elasticsearch Query Language (ES|QL) analytical query against indexed data.
get_shardsRetrieves shard status and allocation metadata for all indices or targeted indices.

Use cases

  • Inspect index schemas (`get_mappings`) and run ad-hoc ES|QL or Query DSL investigations against Elasticsearch 8.x/9.x logs from Claude Desktop, Cursor, or VS Code.
  • Check cluster health and shard placement across indices using `list_indices` and `get_shards` during incident triage.
  • Deploy a shared Streamable HTTP MCP container on AWS EC2, ECS, or EKS backed by AWS Secrets Manager for `ES_API_KEY` injection.

Strengths

  • Official Elastic Docker image (`docker.elastic.co/mcp/elasticsearch`) supporting both local stdio and concurrent Streamable HTTP (`/mcp` + `/ping`).
  • Supports both Elasticsearch Query DSL (`search`) and modern `esql` queries alongside schema and shard inspection.
  • Stores no data on disk and reads `ES_API_KEY` or username/password strictly from runtime environment variables.

Limitations

  • Officially deprecated by Elastic—only critical security updates are planned, with Elastic Agent Builder MCP replacing it on Elastic 9.2.0+ and Serverless.
  • Requires Elasticsearch 8.x or 9.x; older major Elasticsearch clusters are not listed as supported.
  • Containerized delivery requires Docker rather than a lightweight `npx` or `uvx` binary.

mcp-server-elasticsearch setup notes

  • Check ES_API_KEY, ES_URL in the mcp-server-elasticsearch configuration if startup or authentication fails.
  • mcp-server-elasticsearch's example uses stdio, while its catalog transports are stdio / streamable-http; use the example's connection type.

Frequently asked questions

No, Elastic has marked this standalone server deprecated and limits ongoing work to critical security fixes. Teams on Elastic 9.2.0+ or Elasticsearch Serverless are advised to migrate to the native Elastic Agent Builder MCP endpoint, though this container remains usable for Elasticsearch 8.x and earlier 9.x deployments.

Related MCP servers