
Elasticsearch/OpenSearch MCP Server
Search, analyze, and manage Elasticsearch & OpenSearch clusters through MCP tools.
Add to your client
Copy the config for your MCP client and paste it into its config file.
uvx elasticsearch-mcp-serverPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"elasticsearch-opensearch-mcp-server": {
"command": "uvx",
"args": [
"elasticsearch-mcp-server"
],
"env": {
"ELASTICSEARCH_HOSTS": "https://localhost:9200",
"ELASTICSEARCH_USERNAME": "elastic",
"ELASTICSEARCH_PASSWORD": "test123"
}
}
}
}Requires `uv` (the Python package runner). Install it from https://docs.astral.sh/uv/ if `uvx` is not found.
Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- uv / uvx (or Docker) to run the server
- A reachable Elasticsearch or OpenSearch cluster (e.g. via the provided docker-compose files)
- Credentials: basic auth (username/password) or an Elasticsearch API key
About Elasticsearch/OpenSearch MCP Server
A Model Context Protocol server implementation that lets AI clients interact with Elasticsearch and OpenSearch clusters. It enables searching documents, analyzing indices, managing data streams/aliases/analyzers, and monitoring cluster health through a dedicated set of MCP tools, with support for multiple named clusters and configurable safety controls.
Tools & capabilities (20)
general_api_requestPerform a general HTTP API request for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
list_indicesList all indices.
get_indexReturn information (mappings, settings, aliases) about one or more indices.
create_indexCreate a new index.
delete_indexDelete an index.
create_data_streamCreate a new data stream (requires a matching index template).
get_data_streamGet information about one or more data streams.
delete_data_streamDelete one or more data streams and their backing indices.
search_documentsSearch for documents.
index_documentCreate or update a document in an index.
get_documentGet a document by ID.
delete_documentDelete a document by ID.
delete_by_queryDelete documents matching the provided query.
get_cluster_healthReturn basic information about the health of the cluster.
get_cluster_statsReturn a high-level overview of cluster statistics.
list_aliasesList all aliases.
get_aliasGet alias information for a specific index.
put_aliasCreate or update an alias for a specific index.
delete_aliasDelete an alias for a specific index.
analyze_textAnalyze text using a specified analyzer or custom analysis chain; useful for debugging search queries and understanding tokenization.
What this server can do
Elasticsearch/OpenSearch MCP Server provides tools for these capabilities — tap one to see every MCP server that does the same:
When to use it
- Let an AI assistant run full-text and structured searches over Elasticsearch/OpenSearch indices
- Inspect and manage indices, data streams, and aliases conversationally
- Monitor cluster health and statistics during operations
- Debug search relevance by analyzing how text is tokenized
- Operate across multiple named clusters (e.g. prod/staging) from one MCP client
Security notes
For HTTP transports (SSE/Streamable HTTP) set MCP_API_KEY to require a Bearer token; if unset, the server is accessible without authentication, which is a network security risk. The stdio transport uses local process communication and needs no auth. VERIFY_CERTS defaults to false. Use DISABLE_HIGH_RISK_OPERATIONS=true (or DISABLE_OPERATIONS) to hide write/delete tools for read-only deployments. Credentials (passwords / API keys) are passed via environment variables.
Elasticsearch/OpenSearch MCP Server FAQ
Which Elasticsearch/OpenSearch versions are supported?
Elasticsearch 7.x, 8.x, and 9.x via package variants (elasticsearch-mcp-server-es7, elasticsearch-mcp-server for 8.x, elasticsearch-mcp-server-es9), and OpenSearch 1.x/2.x/3.x via opensearch-mcp-server.
What transports are supported?
stdio (default), SSE, and Streamable HTTP. Use the --transport flag (sse or streamable-http) with optional --host, --port, and --path.
How do I make a deployment read-only?
Set DISABLE_HIGH_RISK_OPERATIONS=true to completely hide all write/delete tools from the client, or set DISABLE_OPERATIONS to a comma-separated list of specific operations to disable.
How is the HTTP server secured?
Set MCP_API_KEY and clients must send an Authorization: Bearer <MCP_API_KEY> header. Authentication applies only to HTTP transports; if MCP_API_KEY is unset the server is accessible without authentication.
Can I connect to more than one cluster?
Yes. Set ELASTICSEARCH_CLUSTERS (or OPENSEARCH_CLUSTERS) to a JSON object of named clusters, or point ELASTICSEARCH_CLUSTERS_FILE at a JSON file. Each tool accepts an optional cluster parameter, falling back to DEFAULT_CLUSTER.
Alternatives to Elasticsearch/OpenSearch MCP Server
Compare all alternatives →Official MCP reference server that fetches a URL and returns its content as clean Markdown, with chunking.
Official Firecrawl MCP server — scrape, crawl, map, search, and structured extraction for any LLM client.
Exa's neural web search and crawling MCP server — runs locally via npx or as a hosted remote endpoint.
Compare Elasticsearch/OpenSearch MCP Server with: