# cr7258/elasticsearch-mcp-server [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/cr7258/elasticsearch-mcp-server  
**GitHub Stars:** 320  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cr7258-elasticsearch-mcp-server

## Description
MCP Server implementation that provides Elasticsearch interaction

## Tools
Capabilities this server exposes over MCP:

- **list_indices** — List all indices.
- **get_index** — Returns information (mappings, settings, aliases) about one or more indices.
- **create_index** — Create a new index.
- **delete_index** — Delete an index.
- **search_documents** — Search for documents.
- **index_document** — Creates or updates a document in the index.
- **get_document** — Get a document by ID.
- **delete_document** — Delete a document by ID.
- **delete_by_query** — Deletes documents matching the provided query.
- **get_cluster_health** — Returns basic information about the health of the cluster.
- **get_cluster_stats** — Returns high-level overview of cluster statistics.
- **list_aliases** — List all aliases.
- **get_alias** — Get alias information for a specific index.
- **put_alias** — Create or update an alias for a specific index.
- **delete_alias** — Delete an alias for a specific index.
- **create_data_stream** — Create a new data stream.

This creates a new data stream with the specified name.
The data stream must have a matching index template before creation.
- **get_data_stream** — Get information about one or more data streams.

Retrieves configuration, mappings, settings, and other information
about the specified data streams.
- **delete_data_stream** — Delete one or more data streams.

Permanently deletes the specified data streams and all their backing indices.
- **general_api_request** — Perform a general HTTP API request.
   Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
- **analyze_text** — Analyze text to see how it would be tokenized.

Use this tool to understand how Elasticsearch/OpenSearch tokenizes and
transforms text using analyzers. This is essential for debugging search
queries and understanding why certain documents match or don't match.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "elasticsearch-mcp-server": {
    "command": "uvx",
    "args": ["elasticsearch-mcp-server"],
    "env": {
      "ELASTICSEARCH_HOSTS": "",
      "ELASTICSEARCH_USERNAME": "",
      "ELASTICSEARCH_PASSWORD": "",
      "ELASTICSEARCH_API_KEY": "",
      "OPENSEARCH_HOSTS": "",
      "OPENSEARCH_USERNAME": "",
      "OPENSEARCH_PASSWORD": "",
      "MCP_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `ELASTICSEARCH_HOSTS`, `ELASTICSEARCH_USERNAME`, `ELASTICSEARCH_PASSWORD`, `ELASTICSEARCH_API_KEY`, `OPENSEARCH_HOSTS`, `OPENSEARCH_USERNAME`, `OPENSEARCH_PASSWORD`, `MCP_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What cr7258/elasticsearch-mcp-server does

cr7258/elasticsearch-mcp-server exposes Elasticsearch and OpenSearch operations through the Model Context Protocol. It covers index discovery and management, document reads and writes, aliases, data streams, cluster status, and analyzer inspection. The server also includes `general_api_request`, which lets an MCP client call an Elasticsearch or OpenSearch HTTP endpoint that is not represented by another tool.

The server is suitable for agents that need to inspect search infrastructure, retrieve or modify indexed data, diagnose query behavior, or perform routine administration through an MCP client. It supports both single-cluster and named multi-cluster configurations.

## How it works

The server connects to hosts specified through Elasticsearch or OpenSearch connection settings. A tool call can optionally include a cluster name when multiple named clusters are configured. If no cluster is selected, the configured default is used; otherwise, the first configured cluster serves as the fallback.

Authentication can use Elasticsearch API keys, Elasticsearch basic authentication, or OpenSearch basic authentication. Requests can also be routed through HTTP, HTTPS, SOCKS5, or SOCKS5H proxies. SSL certificate verification, request timeouts, and cluster-specific proxy settings are configurable.

The server can run over stdio, SSE, or Streamable HTTP. Bearer-token protection through `MCP_API_KEY` applies to the HTTP transports. Stdio uses local process communication instead.

## Setup and configuration

A stdio MCP client can launch the package with `uvx` and the `elasticsearch-mcp-server` package name. Set `ELASTICSEARCH_HOSTS` or `OPENSEARCH_HOSTS` for the target endpoint; the default host is `https://localhost:9200`. Add the matching credentials or API key for the selected backend.

For multiple clusters, provide a JSON object through `ELASTICSEARCH_CLUSTERS` or `OPENSEARCH_CLUSTERS`, or place that object in a file referenced by the corresponding `*_CLUSTERS_FILE` variable. `DEFAULT_CLUSTER` selects the cluster used when a tool call omits `cluster`. The file-based option avoids escaping nested JSON inside an MCP client configuration.

Set `DISABLE_HIGH_RISK_OPERATIONS=true` to hide write tools, or use `DISABLE_OPERATIONS` to disable selected operations such as index deletion or delete-by-query. For network-exposed HTTP transports, configure `MCP_API_KEY` so clients must send a bearer token.

## Tools and capabilities

- Inspect indices with `list_indices` and `get_index`, including mappings, settings, and aliases.
- Create or remove indices and data streams, and retrieve data-stream configuration and backing-index information.
- Search, insert or update, retrieve, and delete documents. `delete_by_query` removes documents matching a supplied query.
- Review cluster health and high-level cluster statistics.
- List, inspect, create, update, and remove aliases.
- Run `analyze_text` with a selected analyzer or custom analysis chain to examine tokenization and text transformation.
- Use `general_api_request` for Elasticsearch or OpenSearch APIs without a dedicated MCP tool.

Creating a data stream requires a matching index template. Deleting a data stream also removes its backing indices.

## Limitations and notes

Write access includes potentially destructive operations such as deleting indices, documents, data streams, aliases, and query matches. The server provides configuration controls to hide these tools, but access permissions on the connected Elasticsearch or OpenSearch deployment remain important.

HTTP authentication is optional by configuration. Leaving `MCP_API_KEY` unset exposes an HTTP transport without MCP-level authentication, so network deployments should configure it. Certificate verification defaults to disabled and should be enabled when the deployment requires TLS certificate validation.

_Full upstream README: https://allmcps.com/mcp/cr7258-elasticsearch-mcp-server/readme_

