Elasticsearch MCP Server for Cloudflare Workers
54 tools available in the Elasticsearch MCP server. Each tool can be called by AI assistants to perform specific actions.
elasticsearch_get_index_templateGet index templates.
Args:
Returns: Index template definitions.
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Template name or pattern"
}
}
}elasticsearch_get_aliasesGet index aliases.
Args:
Returns: Alias information for matching indices.
{
"type": "object",
"properties": {
"alias": {
"type": "string",
"description": "Alias name(s)"
},
"index": {
"type": "string",
"description": "Index name(s)"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
}
}
}elasticsearch_update_aliasesAtomically add, remove, or update index aliases.
Args:
Example: [ { "add": { "index": "logs-2024-01", "alias": "logs-current" } }, { "remove": { "index": "logs-2023-12", "alias": "logs-current" } } ]
Returns: Acknowledgment of the update.
{
"type": "object",
"required": [
"actions"
],
"properties": {
"actions": {
"type": "array",
"items": {
"type": "string"
},
"description": "Alias actions to perform"
}
}
}elasticsearch_add_aliasAdd an alias to an index.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"index",
"alias"
],
"properties": {
"alias": {
"type": "string",
"description": "Alias name"
},
"index": {
"type": "string",
"description": "Index name(s)"
},
"filter": {
"type": "object",
"description": "Filter query"
},
"routing": {
"type": "string",
"description": "Routing value"
},
"is_write_index": {
"type": "boolean",
"description": "Set as write index"
}
}
}elasticsearch_remove_aliasRemove an alias from an index.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"index",
"alias"
],
"properties": {
"alias": {
"type": "string",
"description": "Alias name"
},
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_alias_existsCheck if an alias exists for an index.
Args:
Returns: Boolean indicating whether the alias exists.
{
"type": "object",
"required": [
"index",
"alias"
],
"properties": {
"alias": {
"type": "string",
"description": "Alias name"
},
"index": {
"type": "string",
"description": "Index name"
}
}
}elasticsearch_cat_indicesList all indices with their health, status, document count, and size.
Args:
Returns: List of indices with details.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name or pattern"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
},
"health": {
"enum": [
"green",
"yellow",
"red"
],
"type": "string",
"description": "Filter by health"
}
}
}elasticsearch_cat_nodesList all nodes in the cluster with resource usage.
Returns: List of nodes with IP, heap, RAM, CPU, load, and role information.
{
"type": "object",
"properties": {
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
}
}
}elasticsearch_cat_shardsList all shards with their state and node assignment.
Args:
Returns: List of shards with index, shard number, type, state, docs, and node.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
}
}
}elasticsearch_cat_aliasesList all aliases.
Args:
Returns: List of aliases with their target indices and configuration.
{
"type": "object",
"properties": {
"alias": {
"type": "string",
"description": "Alias name or pattern"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
}
}
}elasticsearch_cat_healthGet cluster health in a compact format.
Returns: Cluster health status with node and shard counts.
{
"type": "object",
"properties": {}
}elasticsearch_cat_countGet document count for indices.
Args:
Returns: Document count.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name"
}
}
}elasticsearch_mgetGet multiple documents by ID from Elasticsearch.
Args:
Returns: Array of documents with their sources.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Default index"
}
}
}elasticsearch_cluster_healthGet the health status of the Elasticsearch cluster.
Args:
Returns: Cluster health information including status, nodes, and shards.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index(es) to check"
},
"level": {
"enum": [
"cluster",
"indices",
"shards"
],
"type": "string",
"description": "Detail level"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
},
"timeout": {
"type": "string",
"description": "Wait timeout"
},
"wait_for_status": {
"enum": [
"green",
"yellow",
"red"
],
"type": "string",
"description": "Wait for status"
}
}
}elasticsearch_cluster_statsGet comprehensive cluster statistics.
Returns information about:
Returns: Cluster statistics.
{
"type": "object",
"properties": {}
}elasticsearch_nodes_infoGet information about cluster nodes.
Args:
Returns: Node information including version, roles, OS, JVM, and plugins.
{
"type": "object",
"properties": {
"node_id": {
"type": "string",
"description": "Node ID(s)"
}
}
}elasticsearch_nodes_statsGet statistics for cluster nodes.
Args:
Returns: Node statistics including CPU, memory, disk, indexing, and search metrics.
{
"type": "object",
"properties": {
"node_id": {
"type": "string",
"description": "Node ID(s)"
}
}
}elasticsearch_allocation_explainExplain why a shard is unassigned or allocated to its current node.
Args:
If no args provided, explains the first unassigned shard found.
Returns: Explanation of shard allocation decisions.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name"
},
"shard": {
"type": "integer",
"description": "Shard number"
},
"primary": {
"type": "boolean",
"description": "Primary shard"
}
}
}elasticsearch_index_documentIndex (create or update) a document in Elasticsearch.
Args:
Returns: Index response with document ID, version, and result.
{
"type": "object",
"required": [
"index",
"document"
],
"properties": {
"id": {
"type": "string",
"description": "Document ID (optional, auto-generated if not provided)"
},
"index": {
"type": "string",
"description": "Index name"
},
"refresh": {
"enum": [
"true",
"false",
"wait_for"
],
"type": "string",
"description": "Refresh policy"
},
"document": {
"type": "object",
"description": "Document to index"
},
"pipeline": {
"type": "string",
"description": "Ingest pipeline name"
}
}
}elasticsearch_get_documentGet a document by ID from Elasticsearch.
Args:
Returns: The document with metadata and source.
{
"type": "object",
"required": [
"index",
"id"
],
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"index": {
"type": "string",
"description": "Index name"
},
"source_excludes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Fields to exclude from _source"
},
"source_includes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Fields to include in _source"
}
}
}elasticsearch_delete_documentDelete a document by ID from Elasticsearch.
Args:
Returns: Delete response with result.
{
"type": "object",
"required": [
"index",
"id"
],
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"index": {
"type": "string",
"description": "Index name"
},
"refresh": {
"enum": [
"true",
"false",
"wait_for"
],
"type": "string",
"description": "Refresh policy"
}
}
}elasticsearch_update_documentUpdate a document in Elasticsearch using partial doc or script.
Args:
Returns: Update response with result.
{
"type": "object",
"required": [
"index",
"id"
],
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"doc": {
"type": "object",
"description": "Partial document to merge"
},
"index": {
"type": "string",
"description": "Index name"
},
"upsert": {
"type": "object",
"description": "Document to insert if not exists"
},
"refresh": {
"enum": [
"true",
"false",
"wait_for"
],
"type": "string",
"description": "Refresh policy"
},
"retry_on_conflict": {
"type": "integer",
"minimum": 0,
"description": "Retries on conflict"
}
}
}elasticsearch_bulkExecute bulk operations (index, create, update, delete) in Elasticsearch.
Args:
Example operations: [ { "index": { "_index": "test", "_id": "1" } }, { "field1": "value1" }, { "delete": { "_index": "test", "_id": "2" } }, { "update": { "_index": "test", "_id": "3" } }, { "doc": { "field2": "value2" } } ]
Returns: Bulk response with results for each operation.
{
"type": "object",
"required": [
"operations"
],
"properties": {
"index": {
"type": "string",
"description": "Default index for operations"
},
"refresh": {
"enum": [
"true",
"false",
"wait_for"
],
"type": "string",
"description": "Refresh policy"
},
"pipeline": {
"type": "string",
"description": "Ingest pipeline"
},
"operations": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of bulk operations"
}
}
}elasticsearch_delete_by_queryDelete documents matching a query in Elasticsearch.
Args:
Returns: Delete by query response with deletion stats.
{
"type": "object",
"required": [
"index",
"query"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"query": {
"type": "object",
"description": "Query DSL to match documents"
},
"refresh": {
"type": "boolean",
"description": "Refresh after deletion"
},
"conflicts": {
"enum": [
"abort",
"proceed"
],
"type": "string",
"description": "Conflict handling"
},
"wait_for_completion": {
"type": "boolean",
"description": "Wait for completion"
}
}
}elasticsearch_update_by_queryUpdate documents matching a query in Elasticsearch.
Args:
Returns: Update by query response with update stats.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"query": {
"type": "object",
"description": "Query DSL to match documents"
},
"refresh": {
"type": "boolean",
"description": "Refresh after update"
},
"conflicts": {
"enum": [
"abort",
"proceed"
],
"type": "string",
"description": "Conflict handling"
},
"wait_for_completion": {
"type": "boolean",
"description": "Wait for completion"
}
}
}elasticsearch_reindexReindex documents from one index to another.
Args:
Returns: Reindex response with stats.
{
"type": "object",
"required": [
"source_index",
"dest_index"
],
"properties": {
"query": {
"type": "object",
"description": "Query to filter source documents"
},
"refresh": {
"type": "boolean",
"description": "Refresh after reindex"
},
"pipeline": {
"type": "string",
"description": "Ingest pipeline for destination"
},
"dest_index": {
"type": "string",
"description": "Destination index name"
},
"source_index": {
"type": "string",
"description": "Source index name(s)"
},
"wait_for_completion": {
"type": "boolean",
"description": "Wait for completion"
}
}
}elasticsearch_create_indexCreate a new index in Elasticsearch.
Args:
Returns: Create index response with acknowledgment.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name"
},
"aliases": {
"type": "object",
"description": "Aliases to create"
},
"mappings": {
"type": "object",
"description": "Field mappings"
},
"settings": {
"type": "object",
"description": "Index settings"
}
}
}elasticsearch_delete_indexDelete one or more indices.
Args:
Returns: Delete response with acknowledgment.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s) to delete"
}
}
}elasticsearch_get_indexGet index information including settings, mappings, and aliases.
Args:
Returns: Index information.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_index_existsCheck if an index exists.
Args:
Returns: Boolean indicating whether the index exists.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name"
}
}
}elasticsearch_get_mappingGet field mappings for one or more indices.
Args:
Returns: Field mappings for each index.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_put_mappingUpdate field mappings for an index.
Note: You can only add new fields or update specific field properties. You cannot change the type of an existing field.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"index",
"mappings"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"mappings": {
"type": "object",
"description": "Mapping definition"
}
}
}elasticsearch_get_settingsGet settings for one or more indices.
Args:
Returns: Index settings.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"include_defaults": {
"type": "boolean",
"description": "Include default settings"
}
}
}elasticsearch_put_settingsUpdate settings for an index.
Note: Some settings can only be changed on a closed index.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"index",
"settings"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"settings": {
"type": "object",
"description": "Settings to update"
}
}
}elasticsearch_refreshRefresh an index to make recent changes searchable.
Args:
Returns: Refresh result with shard info.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_flushFlush an index to persist changes to disk.
Args:
Returns: Flush result with shard info.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_forcemergeForce merge index segments to reduce their number.
Useful for read-only indices to optimize storage and search performance.
Args:
Returns: Force merge result.
{
"type": "object",
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"max_num_segments": {
"type": "integer",
"minimum": 1,
"description": "Target segments per shard"
},
"only_expunge_deletes": {
"type": "boolean",
"description": "Only expunge deletes"
}
}
}elasticsearch_close_indexClose an index to prevent read/write operations.
Closed indices consume minimal resources but cannot be searched or written to.
Args:
Returns: Close result with acknowledgment.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_open_indexOpen a closed index to allow read/write operations.
Args:
Returns: Open result with acknowledgment.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
}
}
}elasticsearch_clone_indexClone an index to a new index.
The source index must be set to read-only first.
Args:
Returns: Clone result with acknowledgment.
{
"type": "object",
"required": [
"source",
"target"
],
"properties": {
"source": {
"type": "string",
"description": "Source index name"
},
"target": {
"type": "string",
"description": "Target index name"
},
"aliases": {
"type": "object",
"description": "Aliases for new index"
},
"settings": {
"type": "object",
"description": "Settings for new index"
}
}
}elasticsearch_shrink_indexShrink an index to a new index with fewer shards.
The source index must be set to read-only and relocated to a single node.
Args:
Returns: Shrink result with acknowledgment.
{
"type": "object",
"required": [
"source",
"target"
],
"properties": {
"source": {
"type": "string",
"description": "Source index name"
},
"target": {
"type": "string",
"description": "Target index name"
},
"aliases": {
"type": "object",
"description": "Aliases for new index"
},
"settings": {
"type": "object",
"description": "Settings for new index"
}
}
}elasticsearch_split_indexSplit an index to a new index with more shards.
The source index must be set to read-only.
Args:
Returns: Split result with acknowledgment.
{
"type": "object",
"required": [
"source",
"target"
],
"properties": {
"source": {
"type": "string",
"description": "Source index name"
},
"target": {
"type": "string",
"description": "Target index name"
},
"aliases": {
"type": "object",
"description": "Aliases for new index"
},
"settings": {
"type": "object",
"description": "Settings for new index"
}
}
}elasticsearch_searchSearch for documents in Elasticsearch.
Args:
Returns: Search results with hits and optional aggregations.
{
"type": "object",
"required": [
"index"
],
"properties": {
"aggs": {
"type": "object",
"description": "Aggregations"
},
"from": {
"type": "integer",
"default": 0,
"minimum": 0,
"description": "Offset for pagination"
},
"size": {
"type": "integer",
"default": 10,
"maximum": 10000,
"minimum": 0,
"description": "Number of results"
},
"sort": {
"type": "array",
"items": {
"type": "string"
},
"description": "Sort specification"
},
"index": {
"type": "string",
"description": "Index name(s) to search"
},
"query": {
"type": "object",
"description": "Elasticsearch Query DSL"
},
"format": {
"enum": [
"json",
"markdown"
],
"type": "string",
"default": "json",
"description": "Response format"
},
"source": {
"type": "string",
"description": "Source filtering"
},
"highlight": {
"type": "object",
"description": "Highlight configuration"
},
"track_total_hits": {
"type": "string",
"description": "Track total hits"
}
}
}elasticsearch_msearchExecute multiple searches in a single request.
Args:
Returns: Array of search responses.
{
"type": "object",
"required": [
"body"
],
"properties": {
"body": {
"type": "object",
"description": "Search body"
},
"searches": {
"type": "array",
"items": {
"type": "string"
},
"description": "Index for this search"
}
}
}elasticsearch_countCount documents matching a query.
Args:
Returns: Document count.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"query": {
"type": "object",
"description": "Query to filter documents"
}
}
}elasticsearch_explainExplain why a document matches (or doesn't match) a query.
Args:
Returns: Explanation of the match.
{
"type": "object",
"required": [
"index",
"id",
"query"
],
"properties": {
"id": {
"type": "string",
"description": "Document ID"
},
"index": {
"type": "string",
"description": "Index name"
},
"query": {
"type": "object",
"description": "Query to explain"
}
}
}elasticsearch_field_capsGet field capabilities across indices.
Args:
Returns: Field capabilities per field per index.
{
"type": "object",
"required": [
"index",
"fields"
],
"properties": {
"index": {
"type": "string",
"description": "Index name(s)"
},
"fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "Field names or patterns"
},
"include_unmapped": {
"type": "boolean",
"description": "Include unmapped fields"
}
}
}elasticsearch_search_scroll_startStart a scrolling search for large result sets.
Args:
Returns: First batch of results and a scroll_id for continuation.
{
"type": "object",
"required": [
"index"
],
"properties": {
"size": {
"type": "integer",
"default": 100,
"maximum": 10000,
"minimum": 1,
"description": "Batch size"
},
"sort": {
"type": "array",
"items": {
"type": "string"
},
"description": "Sort specification"
},
"index": {
"type": "string",
"description": "Index name(s)"
},
"query": {
"type": "object",
"description": "Query DSL"
},
"scroll": {
"type": "string",
"default": "1m",
"description": "Scroll context timeout"
}
}
}elasticsearch_search_scroll_continueContinue a scrolling search.
Args:
Returns: Next batch of results.
{
"type": "object",
"required": [
"scroll_id"
],
"properties": {
"scroll": {
"type": "string",
"default": "1m",
"description": "Scroll context timeout"
},
"scroll_id": {
"type": "string",
"description": "Scroll ID from previous search"
}
}
}elasticsearch_search_scroll_clearClear one or more scroll contexts.
Args:
Returns: Clear result.
{
"type": "object",
"required": [
"scroll_ids"
],
"properties": {
"scroll_ids": {
"type": "string",
"description": "Scroll ID(s) to clear"
}
}
}elasticsearch_pit_openOpen a point-in-time for consistent search results.
Args:
Returns: PIT ID for use in subsequent searches.
{
"type": "object",
"required": [
"index"
],
"properties": {
"index": {
"type": "string",
"description": "Index name"
},
"keep_alive": {
"type": "string",
"default": "1m",
"description": "PIT timeout"
}
}
}elasticsearch_pit_closeClose a point-in-time.
Args:
Returns: Close result.
{
"type": "object",
"required": [
"pit_id"
],
"properties": {
"pit_id": {
"type": "string",
"description": "PIT ID to close"
}
}
}elasticsearch_put_index_templateCreate or update an index template.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "Template name"
},
"priority": {
"type": "integer",
"description": "Template priority"
},
"composed_of": {
"type": "array",
"items": {
"type": "string"
},
"description": "Component templates"
},
"index_patterns": {
"type": "array",
"items": {
"type": "string"
},
"description": "Index patterns"
}
}
}elasticsearch_delete_index_templateDelete an index template.
Args:
Returns: Acknowledgment.
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "Template name"
}
}
}