Home / MCP / Elasticsearch MCP Server
Provides MCP access to Elasticsearch data, enabling index discovery, mappings, searches, and shard information.
Configuration
View docs{
"mcpServers": {
"elasticsearch_mcp": {
"url": "http://<host>:8080/mcp"
}
}
}Connect to your Elasticsearch data directly from any MCP Client using the Model Context Protocol. This MCP server lets you interact with Elasticsearch indices through natural language conversations, enabling you to list indices, inspect mappings, run searches, perform ES|QL queries, and view shard information.
You connect using an MCP client and your MCP server endpoints. Start a stdio server locally with Docker to talk directly to Elasticsearch, or run a streamable HTTP endpoint to access the server over HTTP. The HTTP endpoint is preferred when your client supports streamable HTTP.
Available actions you can perform through the MCP interface include listing indices, getting field mappings, issuing searches with a DSL, running ES|QL queries, and retrieving shard information. Use these actions to explore your Elasticsearch data with conversational queries.
Prerequisites you need before starting include Docker and access to an Elasticsearch instance with credentials. You will provide the Elasticsearch URL and credentials to the MCP server via environment variables.
Install and run the stdio MCP server locally using Docker. This starts a stdio endpoint that your MCP client can connect to.
# Run the Elasticsearch MCP server in stdio mode using Docker
docker run -i --rm -e ES_URL -e ES_API_KEY docker.elastic.co/mcp/elasticsearch stdioPrerequisites details and environment variables are shown here so you can configure your client and the MCP server correctly.
For the streamable HTTP endpoint, start the server in http mode. This exposes a streamable HTTP endpoint suitable for clients that support the streamable-HTTP protocol.
# Run the Elasticsearch MCP server in http mode using Docker
docker run --rm -e ES_URL -e ES_API_KEY -p 8080:8080 docker.elastic.co/mcp/elasticsearch httpThe following examples show how to configure clients to connect to the MCP server. Use the stdio or http configuration depending on your client support.
{
"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>"
}
}
}
}Optionally, you can enable SSL verification skip by setting ES_SSL_SKIP_VERIFY to true if your Elasticsearch server uses a self-signed certificate. This is not enabled by default and should be used with awareness of security implications.
List all available Elasticsearch indices
Get field mappings for a specific Elasticsearch index
Perform an Elasticsearch search with the provided query DSL
Perform an ES|QL query
Get shard information for all or specific indices