Skip the install. Get this working in under 2 minutes.
Start a free trial on cloud.anythingmcp.com, add the Elasticsearch in one click, then point your AI client (Claude, ChatGPT, Copilot or Cursor) at the generated MCP endpoint. No Docker, no git clone, zero engineering experience required.
Summary
Let your AI explore and query your Elasticsearch cluster on Elastic Cloud, Serverless or your own servers: list indices and data streams, read mappings, search, aggregate, count, run ES|QL and, with your confirmation, write documents.
Try asking
Example prompts for Elasticsearch
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → Elasticsearch, paste your credentials, mint an MCP API key and you're done. No Docker, no
git clone, no local server.
Elasticsearch + Cursor
Let your AI explore and query your Elasticsearch cluster on Elastic Cloud, Serverless or your own servers: list indices and data streams, read mappings, search, aggregate, count, run ES|QL and, with your confirmation, write documents.
Prerequisites
See the full setup instructions baked into the connector (visible in the in-app store when you select the connector). The required environment variables for this connector are:
ELASTICSEARCH_URL, ELASTICSEARCH_API_KEY
Step 1 — Get credentials
- Find your Elasticsearch endpoint. Elastic Cloud Hosted: open the deployment at
https://cloud.elastic.coand copy the Elasticsearch endpoint, e.g.https://my-deployment.es.europe-west3.gcp.cloud.es.io. Serverless: open the project and copy its Elasticsearch endpoint. Self-managed: the HTTPS address and port your cluster answers on, e.g.https://search.example.com:9200. Paste it intoELASTICSEARCH_URLwithout a trailing slash. Use the Elasticsearch endpoint, not the Kibana address. - Create an API key in Kibana under Stack Management → API keys → Create API key (Serverless: project settings → API keys). Name it, for example
anythingmcp, set an expiry and turn on Control security privileges to limit it (see below). - Copy the Encoded value (base64): Elastic shows it only once. Paste it into
ELASTICSEARCH_API_KEYand install the connector. Theidandapi_keyvalues on their own do not work, and username and password are not supported. - Check the setup with
elasticsearch_whoami: it needs no privileges and shows who the key belongs to.
Where your cluster runs: Elastic Cloud Hosted, Elastic Cloud Serverless and self-managed clusters, version 8 or later. AnythingMCP Cloud needs a cluster it can reach over the internet; a self-hosted AnythingMCP can also reach a cluster in your own network once an admin allows that host.
Read-only key (recommended): use these role descriptors in the Kibana form, or run the request in Kibana Dev Tools and copy encoded from the answer:
POST /_security/api_key
{
"name": "anythingmcp-read",
"expiration": "365d",
"role_descriptors": {
"anythingmcp_read": {
"cluster": ["monitor"],
"indices": [
{ "names": ["*"], "privileges": ["read", "view_index_metadata", "monitor"] }
]
}
}
}
Replace "*" with the index patterns the AI may see, e.g. ["products", "logs-*"]. read covers search, count, aggregations, ES|QL and single documents; view_index_metadata covers mappings, aliases and data streams; monitor covers the index list and cluster health. A key never has more rights than the user who creates it.
What the AI can do: list indices, aliases and data streams; read an index's field mapping before querying it; search with the Query DSL (10 hits by default, at most 100 per call); run aggregations such as counts per value, sums, averages and date histograms; count matches; run ES|QL queries for tabular answers (at most 500 rows); and read single documents. Common vector fields are left out of search results. Cluster health is not available on Serverless, where Elastic runs the cluster.
Writes ask first: elasticsearch_index_document creates or replaces a whole document, and elasticsearch_update_document changes some fields of one. Before each, the AI shows you the index, the _id and the content and waits for your yes. Both need the write privilege, so with the read-only key above they fail with 403, which is the intended safety net.
Switched off at install: elasticsearch_delete_document and elasticsearch_delete_by_query. Deletes cannot be undone, and a delete by query can remove millions of documents. An administrator turns them on deliberately; the AI then counts the matching documents first and asks before deleting.
Common errors: 401: the key is wrong, expired or invalidated, or the id was pasted instead of the Encoded value. 403 security_exception: the key lacks the privilege named in the message. 404 index_not_found_exception: unknown index name. 400 parsing_exception or verification_exception: the query has a mistake; the message names the field or position. 429: the cluster is overloaded; wait and retry.
The connector talks to Elasticsearch only, not to Kibana. It does not create or delete indices, change mappings or settings, or cover snapshots, ingest pipelines, security administration or the bulk API.
Step 2 — Install the adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
Step 3 — Add the connector in Cursor
Your server URL: in AnythingMCP, open MCP Servers → the server this connector is on, and copy its URL (
https://cloud.anythingmcp.com/mcp/…). Use it wherever this guide showsYOUR_SERVER_ID.
Cursor reads MCP servers from ~/.cursor/mcp.json. Add this entry:
{
"mcpServers": {
"anythingmcp": {
"url": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- Create an MCP API key in AnythingMCP under MCP Servers → your server → API keys, and paste it in place of
YOUR_MCP_API_KEY. - Save the file and restart Cursor.
- Open Cursor → Settings → MCP and check that
anythingmcpis listed and connected. - Start chatting: the agent can now call the
Elasticsearchtools.
Available tools
| Tool | What it does |
|---|---|
elasticsearch_whoami | Show who the connector is signed in as: the user behind the API key, the key's name and id and the authentication type |
elasticsearch_cluster_info | Get basic information about the cluster: name, uuid, Elasticsearch version and build flavor (serverless on Elastic Cloud Serverless) |
elasticsearch_cluster_health | Get the cluster health: status (green, yellow or red), node counts, active, relocating, initializing and unassigned shards and pending tasks |
elasticsearch_list_indices | List indices with their health, status, document count, store size, primary and replica shard counts and creation date, sorted by name (at… |
elasticsearch_get_mapping | Get the field mapping of an index or data stream: every field with its type (text, keyword, date, long, dense_vector...) |
elasticsearch_search | Search an index, data stream or alias with the Query DSL and get the matching documents (total, and per hit _index, _id, _score, _source… |
elasticsearch_aggregate | Run aggregations over an index or data stream without returning documents: counts per value (terms), sums and averages, date histograms… |
elasticsearch_count | Count the documents in an index, data stream or alias that match a query (all documents without a query) |
elasticsearch_esql_query | Run an ES|QL query, a piped language for filtering, aggregating and joining (Elasticsearch 8.11 or later, and Serverless) |
elasticsearch_get_document | Get one document by its _id from an index: found, _version and the _source, optionally only some fields |
elasticsearch_list_aliases | List index aliases: alias name, the index it points to, whether it has a filter and whether it is the write index |
elasticsearch_list_data_streams | List data streams (time series such as logs and metrics): name, health status, index template, generation, number of backing indices… |
elasticsearch_index_document | Create or replace a whole document under a given _id in an index |
elasticsearch_update_document | Change some fields of an existing document by _id, leaving the others as they are (a partial update with doc) |
elasticsearch_delete_document | Delete one document by _id |
elasticsearch_delete_by_query | Delete every document that matches a query |
Example prompts
- "Which indices do we have, how many documents does each hold and how big are they?"
- "Search the products index for wireless headphones under 100 euros and show name, brand and price."
- "With ES|QL, count the errors per host in logs- over the last 24 hours and show the top 10."*
- "How many orders per day did we get in September? Use a date histogram on the orders index."
- "Set the stock field of product 4711 in the products index to 0. Show me the change before you make it."
FAQ
Does Cursor support custom MCP servers on the free tier? Yes, MCP is available on Hobby, Pro and Business plans.
Next steps
Was this guide helpful?