Elasticsearch MCP Server

Databasestdiohttp-streamingv0.4.0
代码仓库

Official Elastic MCP server that connects AI agents to Elasticsearch data using the Model Context Protocol. Enables natural language interactions with Elasticsearch indices — querying, analyzing, and retrieving data without custom APIs. Supports both stdio and streamable-HTTP transports, and works with Elasticsearch 8.x/9.x clusters including Elasticsearch Serverless. Distributed as a Docker container image from the Elastic registry.

连接

将此配置添加到 .claude/mcp.json

传输方式:
{
  "mcpServers": {
    "elasticsearch": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "ES_URL",
        "-e",
        "ES_API_KEY",
        "docker.elastic.co/mcp/elasticsearch",
        "stdio"
      ],
      "env": {
        "ES_URL": "<YOUR_ES_URL>",
        "ES_API_KEY": "<YOUR_ES_API_KEY>",
        "ES_USERNAME": "<YOUR_ES_USERNAME>",
        "ES_PASSWORD": "<YOUR_ES_PASSWORD>"
      }
    }
  }
}

工具 (5)

search

Execute a search query against one or more Elasticsearch indices using Query DSL or natural language. Returns matching documents with scores.

{
  "type": "object",
  "required": [
    "index",
    "query"
  ],
  "properties": {
    "size": {
      "type": "integer",
      "description": "Maximum number of results to return (default 10)"
    },
    "index": {
      "type": "string",
      "description": "Index name or pattern to search (e.g. \"logs-*\")"
    },
    "query": {
      "type": "object",
      "description": "Elasticsearch Query DSL object"
    }
  }
}

get_mappings

Retrieve the field mappings for one or more Elasticsearch indices, showing field names, types, and analyzer configurations.

{
  "type": "object",
  "required": [
    "index"
  ],
  "properties": {
    "index": {
      "type": "string",
      "description": "Index name or pattern"
    }
  }
}

list_indices

List all available Elasticsearch indices with their health status, document count, and storage size.

{
  "type": "object",
  "properties": {
    "pattern": {
      "type": "string",
      "description": "Optional index name pattern filter (e.g. \"logs-*\")"
    }
  }
}

get_cluster_info

Retrieve Elasticsearch cluster health, node count, and version information.

{
  "type": "object",
  "properties": {}
}

index_document

Index a new document or update an existing document in an Elasticsearch index.

{
  "type": "object",
  "required": [
    "index",
    "document"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Optional document ID (auto-generated if omitted)"
    },
    "index": {
      "type": "string",
      "description": "Target index name"
    },
    "document": {
      "type": "object",
      "description": "Document body to index"
    }
  }
}

资源

此服务器未提供任何资源。

提示词

此服务器未提供任何提示词。

服务器信息

作者
Elastic (@elastic)
代码仓库
https://github.com/elastic/mcp-server-elasticsearch
许可证
Apache-2.0
版本
0.4.0
星标
320
最后更新
2026年5月31日