elasticsearch-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ES_MCP_HOSTS | No | Comma separated list of Elasticsearch hosts. Default: http://localhost:9200 | http://localhost:9200 |
| ES_MCP_API_KEY | No | API key for authentication (base64-encoded). Use this or username/password or bearer token. | |
| ES_MCP_CA_CERTS | No | Path to CA certificates file. | |
| ES_MCP_PASSWORD | No | Password for basic authentication. | |
| ES_MCP_USERNAME | No | Username for basic authentication. | |
| ES_MCP_LOG_LEVEL | No | Log level. Default: INFO | INFO |
| ES_MCP_READ_ONLY | No | Master switch for all write tools. Default: true | true |
| ES_MCP_CLIENT_KEY | No | Path to client key. | |
| ES_MCP_INDEX_DENY | No | Glob deny-list for indices; deny wins. Default: .*,security-* | .*,security-* |
| ES_MCP_CLIENT_CERT | No | Path to client certificate. | |
| ES_MCP_INDEX_ALLOW | No | Glob allow-list for indices. Default: * | * |
| ES_MCP_MAX_RETRIES | No | Maximum number of retries. Default: 3 | 3 |
| ES_MCP_BEARER_TOKEN | No | Bearer token for authentication. | |
| ES_MCP_DEFAULT_SIZE | No | Default number of hits to return. Default: 10 | 10 |
| ES_MCP_VERIFY_CERTS | No | Whether to verify TLS certificates. Default: true | true |
| ES_MCP_AUDIT_LOG_PATH | No | Path to JSONL audit log (optional). | |
| ES_MCP_SEARCH_TIMEOUT | No | Search timeout per query. Default: 30s | 30s |
| ES_MCP_CONNECT_TIMEOUT | No | Connection timeout in seconds. Default: 10 | 10 |
| ES_MCP_MAX_AGG_BUCKETS | No | Rejects bucket explosions over this limit. Default: 1000 | 1000 |
| ES_MCP_MAX_RESULT_SIZE | No | Maximum number of hits to return. Default: 200 | 200 |
| ES_MCP_REQUEST_TIMEOUT | No | Request timeout in seconds. Default: 30 | 30 |
| ES_MCP_TERMINATE_AFTER | No | Terminate after this many documents per shard (optional). | |
| ES_MCP_MAX_SOURCE_CHARS | No | Maximum characters of source content. Default: 2000 | 2000 |
| ES_MCP_ALLOW_DESTRUCTIVE | No | Second gate for restore, reindex, put_mapping. Default: false | false |
| ES_MCP_MAX_RESPONSE_CHARS | No | Maximum characters in response. Default: 60000 | 60000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| run_queryA | Execute an Elasticsearch search against an index or alias. Accepts a full Query DSL body (JSON string or object). Size is capped by server policy, a search timeout is injected, and deep paging is rejected. Returns hits, aggregations, timing and shard stats. Use search_after for pagination beyond 10k. |
| count_documentsA | Count matching documents without returning hits. Cheap way to size a query before running it. |
| generate_dslA | Build Elasticsearch Query DSL from a structured spec, then validate it against the real index. Supply spec as JSON with any of: text, text_fields, filters [{field, op, value}], must_not, should, time_field/time_from/time_to, sort, size, aggs [{name, type, field, size, interval}], highlight_fields, source_includes. Ops: eq, neq, in, not_in, gt, gte, lt, lte, exists, missing, prefix, wildcard, match, match_phrase. Returns the generated DSL plus validation result and a field catalog so you can correct field names before running it. |
| explain_queryA | Explain a query three ways: (1) _validate/query?rewrite=true shows how ES rewrites it and why it may be invalid, (2) profile=true gives per-component timing to find the slow clause, (3) if doc_id is given, _explain shows why that document matched or did not, with scoring detail. |
| open_pitA | Open a point-in-time (PIT) against an index and return its pit_id. A PIT freezes the data view so you can page through a large result set consistently with paged_search, past the 10000 deep-paging limit. Always close it with close_pit when done; keep_alive controls how long ES holds it open. |
| close_pitB | Close a point-in-time by its pit_id to free cluster resources. Call after paging finishes. |
| paged_searchA | Page through a large result set beyond the 10000 deep-paging limit using a point-in-time and search_after. First call: open_pit, then call this with the pit_id and a query; it returns one page plus next_search_after and the (possibly refreshed) pit_id. Pass both back on the next call to get the following page. A sort is required and an implicit _shard_doc tiebreak is added for stable ordering. No index argument: the PIT already binds the index. Close with close_pit at the end. |
| cluster_healthA | Cluster health overview: status, node counts, active/relocating/initializing/unassigned shards, pending tasks, and (optionally) per-index health. Start troubleshooting here. |
| index_healthB | Per-index health and size: status, docs, store size, primaries/replicas, segment count, refresh and merge stats, plus search/index throughput. Pass an index pattern to narrow it down. |
| shard_allocationA | Shard placement and why shards are unassigned. Returns _cat/shards, per-node disk usage, and for any UNASSIGNED shard the cluster allocation explanation (decider-level reasons: disk watermark, awareness, filtering, max_retries). This is the tool for a yellow/red cluster. |
| find_slow_queriesA | Find what is slow. Combines: indices ranked by average query latency (_stats), currently running search tasks with elapsed time (_tasks), search thread-pool queue/rejection counts per node, and the configured search slowlog thresholds per index (so you know whether slowlog is even on). Use top_n to control how many indices come back. |
| cat_nodesA | List cluster nodes with role, version, heap/RAM/CPU/load, and master flag. Use it to spot a hot node, a version mismatch across nodes, or which node is master. |
| field_capsA | Show the capabilities of one or more fields across indices via _field_caps: the type(s) each field has, whether it is searchable and aggregatable. The key use is catching a field mapped as different types in different indices (e.g. long in one, keyword in another), which breaks queries across an index pattern. Pass fields as a comma list or *. |
| list_indicesA | List indices, data streams and aliases matching a pattern, with doc counts and store size. |
| get_mappingA | Get the mapping for an index. Returns a flattened field catalog (field path -> type, including multi-fields like .keyword) which is what you need to write correct queries, plus dynamic templates and total field count. Set raw=true for the untouched mapping JSON. |
| analyze_textA | Run text through an analyzer and see the resulting tokens. Use it when a match query returns nothing: it shows exactly how the field's analyzer tokenizes the indexed text vs your search term. |
| put_mappingA | Add new fields to an existing index mapping. Only additive changes are possible in Elasticsearch; changing an existing field type requires reindex. Blocked unless the server runs with writes enabled, and requires confirm=true. |
| list_snapshot_repositoriesA | List registered snapshot repositories with their type and settings (bucket, base_path, ...). |
| list_snapshotsA | List snapshots in a repository with state, start/end time, duration, indices count, shard failures and size. Use this before restoring to pick the right snapshot. |
| snapshot_statusA | Detailed progress of running or recent snapshots: per-shard stage, bytes done vs total. |
| create_snapshotA | Create a snapshot of selected indices into a repository. Non-blocking by default: returns immediately, poll with snapshot_status. Requires writes enabled and confirm=true. |
| restore_snapshotA | Restore indices from a snapshot. DESTRUCTIVE: an index that already exists must be closed or renamed via rename_pattern/rename_replacement, otherwise the restore fails. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true. |
| reindexA | Copy documents from a source index to a destination, optionally filtered by a query and transformed by a pipeline or script. Runs asynchronously (wait_for_completion=false) and returns a task_id to poll with get_task. Use this to change a field type, reshard, or migrate data. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true. |
| get_taskA | Poll a long-running task (reindex, update_by_query, delete_by_query) for progress and errors. |
| cancel_taskA | Cancel a running task by id. Use for a runaway reindex or a search eating the cluster. |
| delete_by_queryA | Delete documents matching a query from an index. DESTRUCTIVE and irreversible. A query is mandatory: match_all is refused so you cannot wipe an index by accident. Runs asynchronously (wait_for_completion=false) and returns a task_id to poll with get_task. Reports how many documents match before deleting. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true. |
| update_settingsA | Update dynamic index settings such as number_of_replicas, refresh_interval, max_result_window, or blocks.*. Static settings (e.g. number_of_shards) cannot be changed on a live index and are refused. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true. |
| update_by_queryA | Update documents in place by query, using a painless script. DESTRUCTIVE and irreversible. A query is mandatory: match_all is refused so you cannot rewrite a whole index by accident. Runs asynchronously; returns a task_id to poll with get_task. Reports how many documents match before updating. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true. |
| alias_actionsA | Add or remove index aliases atomically in one request. Pass actions as a JSON array, e.g. [{"add": {"index": "logs-2026", "alias": "logs"}}, {"remove": {"index": "logs-2025", "alias": "logs"}}]. Use this to swap an alias from an old index to a new one with zero downtime after a reindex. Only add/remove are allowed. Every index touched is checked against the write policy. Requires writes enabled and confirm=true. |
| sql_queryA | Run an Elasticsearch SQL query via the _sql API. Good for quick aggregate/filter questions without hand-writing Query DSL, e.g. SELECT status, COUNT() FROM "logs-" WHERE code >= 500 GROUP BY status. Only SELECT is allowed. The index in FROM is checked against the allow/deny policy. Row count is capped by fetch_size (server result-size limit applies). Returns columns and rows; if there are more rows a cursor is returned to pass back as the cursor argument. |
| sql_translateA | Translate an Elasticsearch SQL SELECT into the equivalent native Query DSL via _sql/translate, without running it. Use this to learn the DSL for a query, then hand the DSL to run_query for full control (search_after, routing, profiling). |
| index_documentA | Index (create or overwrite) a single document into an index. Pass doc as a JSON object. Optional doc_id: given, it overwrites that id; omitted, ES assigns one. Set refresh=true to make it searchable immediately (slower). Requires writes enabled and confirm=true. |
| bulk_indexA | Bulk index many documents into one index in a single request. Pass documents as a JSON array of objects; each becomes an index action. Optional id_field names a field to use as the document id. Reports how many succeeded and the first few errors. Much faster than index_document in a loop. Requires writes enabled and confirm=true. |
| cluster_infoA | Cluster name, version, distribution, and the safety policy this server is running under. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/baburajr/elasticsearch_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server