Elasticsearch
Byelastic·503
MCP server for connecting to Elasticsearch data and indices. Supports search queries, mappings, ES|QL, and shard information through natural language interactions.
Caution
WARNING: this MCP server is EXPERIMENTAL.
Connect to your Elasticsearch data directly from any MCP Client using the Model Context Protocol (MCP).
This server connects agents to your Elasticsearch data using the Model Context Protocol. It allows you to interact with your Elasticsearch indices through natural language conversations.
list_indices
: List all available Elasticsearch indicesget_mappings
: Get field mappings for a specific Elasticsearch indexsearch
: Perform an Elasticsearch search with the provided query DSLesql
: Perform an ES|QL queryget_shards
: Get shard information for all or specific indices
- An Elasticsearch instance
- Elasticsearch authentication credentials (API key or username/password)
- An MCP Client (e.g.Claude Desktop,Goose)
Supported Elasticsearch versions
This works with Elasticsearch versions8.x
and9.x
.
Note
Versions 0.3.1 and earlier were installed vianpm
. These versions are deprecated and no longer supported. The following instructions only apply to 0.4.0 and later.
To view instructions for versions 0.3.1 and earlier, see theREADME for v0.3.1.
This MCP server is provided as a Docker image atdocker.elastic.co/mcp/elasticsearch
that supports MCP's stdio, SSE and streamable-HTTP protocols.
Running this container without any argument will output a usage message:
docker run docker.elastic.co/mcp/elasticsearch
Usage: elasticsearch-mcp-server <COMMAND>Commands: stdio Start a stdio server http Start a streamable-HTTP server with optional SSE support help Print this message or the help of the given subcommand(s)Options: -h, --help Print help -V, --version Print version
The MCP server needs environment variables to be set:
ES_URL
: the URL of your Elasticsearch cluster- For authentication use either an API key or basic authentication:
- API key:
ES_API_KEY
- Basic auth:
ES_USERNAME
andES_PASSWORD
- API key:
- Optionally,
ES_SSL_SKIP_VERIFY
set totrue
skips SSL/TLS certificate verification when connectingto Elasticsearch. The ability to provide a custom certificate will be added in a later version.
The MCP server is started in stdio mode with this command:
docker run -i --rm -e ES_URL -e ES_API_KEY docker.elastic.co/mcp/elasticsearch stdio
The configuration for Claude Desktop is as follows:
{"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>" } } }}
Note: streamable-HTTP is recommended, asSSE is deprecated.
The MCP server needs environment variables to be set:
ES_URL
, the URL of your Elasticsearch cluster- For authentication use either an API key or basic authentication:
- API key:
ES_API_KEY
- Basic auth:
ES_USERNAME
andES_PASSWORD
- API key:
- Optionally,
ES_SSL_SKIP_VERIFY
set totrue
skips SSL/TLS certificate verification when connectingto Elasticsearch. The ability to provide a custom certificate will be added in a later version.
The MCP server is started in http mode with this command:
docker run --rm -e ES_URL -e ES_API_KEY -p 8080:8080 docker.elastic.co/mcp/elasticsearch http
If for some reason your execution environment doesn't allow passing parameters to the container, they can be passedusing theCLI_ARGS
environment variable:docker run --rm -e ES_URL -e ES_API_KEY -e CLI_ARGS=http -p 8080:8080...
The streamable-HTTP endpoint is athttp:<host>:8080/mcp
. There's also a health check athttp:<host>:8080/ping
Configuration for Claude Desktop (free edition that only supports the stdio protocol).
Install
mcp-proxy
(or an equivalent), that will bridge stdio to streamable-http. The executablewill be installed in~/.local/bin
:uv tool install mcp-proxy
Add this configuration to Claude Desktop:
{"mcpServers": {"elasticsearch-mcp-server": {"command":"/<home-directory>/.local/bin/mcp-proxy","args": ["--transport=streamablehttp","--header","Authorization","ApiKey <elasticsearch-API-key>","http://<mcp-server-host>:<mcp-server-port>/mcp" ] } }}
About
Elasticsearch
Byelastic·503
MCP server for connecting to Elasticsearch data and indices. Supports search queries, mappings, ES|QL, and shard information through natural language interactions.