Back to MCP directory
publicPublicdnsLocal runtime

elasticsearch-mcp-server

一个为Elasticsearch集群设计的模型上下文协议服务器,支持LLM管理索引和执行查询操作

article

README

🚀 Elasticsearch

本项目为Elasticsearch集群提供模型上下文协议(MCP)服务器,助力LLM管理索引并执行查询,有效提升数据管理与查询效率。

⚠️ 重要提示

此实现主要通过向Claude输入来自PostgreSQL MCP服务器的示例来完成。

🚀 快速开始

使用Claude Desktop方法

将以下内容添加到claude_desktop_config.json文件的mcpServers部分:

{
  "mcpServers": {
    "elasticsearch": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-elasticsearch",
        "http://localhost:9200"
      ]
    }
  }
}

Docker运行命令

docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:8.11.3

请将URL替换为您的Elasticsearch端点。

✨ 主要特性

工具

  • 搜索

    • 可对目标索引执行搜索查询。
    • 输入参数:
      • index(字符串):目标索引名称。
      • query(对象):Elasticsearch查询DSL。
    • 操作结果:返回搜索结果。
  • 创建索引

    • 能够创建新的Elasticsearch索引。
    • 输入参数:
      • index(字符串):索引名称。
      • mappings(对象,可选):索引映射配置。
      • settings(对象,可选):索引设置配置。
  • 列出索引

    • 可列出所有可用的索引。
    • 输入参数:无。
    • 操作结果:返回索引信息数组。
  • 索引文档

    • 能将文档索引到指定索引。
    • 输入参数:
      • index(字符串):目标索引名称。
      • id(字符串,可选):文档ID。
      • document(对象):文档内容。
    • 操作结果:返回索引操作结果。

资源

服务器为每个索引提供映射信息:

  • 索引映射 (elasticsearch://<主机>/<索引>/schema)
    • 以JSON格式呈现映射信息。
    • 包含字段名称、类型和配置。
    • 可自动从元数据中发现。

📄 许可证

本项目根据MIT许可证发布,您可以自由使用、修改和分发。详见LICENSE文件获取详细信息。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client