Elasticsearch MCP Server
Lets your AI agent search, analyze and manage Elasticsearch and OpenSearch indices, documents and cluster health.
315 stars on GitHubby cr7258License Apache-2.0Updated 18 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add elasticsearch -- uvx elasticsearch-mcp-server
What to fill in
| Name | What it is | Required |
|---|---|---|
ELASTICSEARCH_HOSTS | Comma-separated list of Elasticsearch hosts (e.g., https://localhost:9200) | No |
ELASTICSEARCH_API_KEY | API key for Elasticsearch or Elastic Cloud authentication (recommended) | No |
ELASTICSEARCH_USERNAME | Username for basic authentication (alternative to API key) | No |
ELASTICSEARCH_PASSWORD | Password for basic authentication (used with ELASTICSEARCH_USERNAME) | No |
ELASTICSEARCH_VERIFY_CERTS | Whether to verify SSL certificates (true/false) | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
List all indices and tell me which are largest.
Search the logs-* index for errors in the last hour.
What it is
This server connects your agent to an Elasticsearch or OpenSearch cluster. It can search documents, list and manage indices, aliases and data streams, check cluster health and analyze how text is tokenized. You can switch off all write operations for safety.
What it can do
search_documents: search for documentslist_indicesandget_index: see indices, mappings and settingsindex_document,get_documentanddelete_document: work with documentsget_cluster_healthandget_cluster_stats: cluster statuslist_aliasesandput_alias: manage aliasesanalyze_text: see how text is tokenizedgeneral_api_request: call any other API
When to use
- βΊWhen you want to explore what is in your search index in plain language
- βΊWhen you need to check cluster health
- βΊWhen you want to debug why a query does not match
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
elasticsearchHelps your agent write Elasticsearch queries, set up index mappings and run aggregations for search and log analytics.implementing-log-forwarding-with-fluentdConfigures Fluent Bit and Fluentd for centralized log collection. Routes, filters, and enriches logs from various sources to destinations like Elasticsearch and Splunk.sql-optimization-patternsHelps your agent find problems with slow SQL queries. It checks query plans and index changes to ensure everything runs smoothly.Frequently asked questions
Does it work with OpenSearch?
Yes. It supports both Elasticsearch and OpenSearch.
How do I sign in?
Use username and password, or an API key for Elasticsearch, which the readme recommends.
Can I stop it from writing?
Yes. Set DISABLE_HIGH_RISK_OPERATIONS to true to hide all write tools, or list specific ones in DISABLE_OPERATIONS.
Can it use more than one cluster?
Yes. Set ELASTICSEARCH_CLUSTERS or a clusters file, and tools take an optional cluster parameter.
Should I protect the HTTP mode?
Yes. Set MCP_API_KEY for sse or streamable-http, or the server is open without authentication.
Is there a test cluster?
The readme includes docker-compose files to start Elasticsearch or OpenSearch with Kibana or Dashboards.
If it does not work
- βΊCheck the hosts value and credentials; the default host is https://localhost:9200.
- βΊIf you hit certificate errors, check VERIFY_CERTS, which defaults to false.
- βΊCheck that uvx is installed.
5 new skills a week. 1 minute to read.