Elasticsearch MCP Server

Enables interaction with Elasticsearch clusters using natural language commands through a Model Context Protocol (MCP) server.

Local serverstdio 301

What is the Elasticsearch MCP server?

Enables interaction with Elasticsearch clusters using natural language commands through a Model Context Protocol (MCP) server. Exposed over MCP by the elasticsearch mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

A Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.

Adding it to your client

Using on PyPI is all you need. Most clients run it directly, so configuration is a few lines and a restart.

Its toolset

Everything the assistant can do here goes through one of these:

  • ELASTICSEARCH_API_KEY — API key for Elasticsearch or [Elastic

Configuration

You will need 8 environment variables: ELASTICSEARCH_CLUSTERS, DEFAULT_CLUSTER, ELASTICSEARCH_CLUSTERS_FILE, ELASTICSEARCH_HOSTS, ELASTICSEARCH_USERNAME, ELASTICSEARCH_PASSWORD, ELASTICSEARCH_API_KEY, OPENSEARCH_HOSTS. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the elasticsearch mcp server does with a few real requests.

When to reach for it

Plenty of cloud and infrastructure servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Elasticsearch's toolset — ELASTICSEARCH_API_KEY — is a fair guide to whether it matches your workflow. It is maintained by cr7258; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Available tools

ToolWhat it does
ELASTICSEARCH_API_KEYAPI key for [Elasticsearch](https://www.elastic.co/docs/deploy-manage/api-keys/elasticsearch-api-keys) or [Elastic Cloud](https://www.elastic.co/docs/deploy-manage/api-keys/elastic-cloud-api-keys) Authentication.

How to install the Elasticsearch MCP server

{
  "mcpServers": {
    "elasticsearch-mcp-server": {
      "command": "uvx",
      "args": [
        "elasticsearch-mcp-server"
      ],
      "env": {
        "ELASTICSEARCH_CLUSTERS": "{\"prod\": {\"hosts\": [\"https://prod-es:9200\"], \"api_key\": \"<PROD_API_KEY>\", \"verify_certs\": true}, \"staging\": {\"hosts\": [\"https://staging-es:9200\"], \"username\": \"elastic\", \"password\": \"<STAGING_PASSWORD>\"}}",
        "DEFAULT_CLUSTER": "prod"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
ELASTICSEARCH_CLUSTERSConfiguration value read at startup.Optional
DEFAULT_CLUSTERConfiguration value read at startup.Optional
ELASTICSEARCH_CLUSTERS_FILEConfiguration value read at startup.Optional
ELASTICSEARCH_HOSTSEndpoint or connection string the server talks to.Optional
ELASTICSEARCH_USERNAMEConfiguration value read at startup.Optional
ELASTICSEARCH_PASSWORDConfiguration value read at startup.Optional
ELASTICSEARCH_API_KEYCredential the server authenticates with.Yes
OPENSEARCH_HOSTSEndpoint or connection string the server talks to.Optional

Example prompts to try

  • Use Elasticsearch to ELASTICSEARCH API KEY.

Frequently asked questions

The server enables you to list indices, retrieve mapping and settings, search documents using Elasticsearch Query DSL, and get the health status and statistics of your cluster.