Elasticsearch模型上下文协议服务器

一个为Elasticsearch集群设计的模型上下文协议服务器,使LLM能够管理索引并执行查询。

  • by da1y
  • JavaScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 da1y/mcp-server-elasticsearch

使用说明

弹性搜索

Elasticsearch集群的模型上下文协议服务器。使LLM能够管理索引和执行查询。

重要提示:这主要是通过从postgres-mcp服务器向claude提供示例来构建的。

组件

工具

  • 搜索

    • 根据索引执行搜索查询
    • 输入:
      • index (string):目标索引名称
      • query (对象):Elasticsearch查询DSL
    • 返回搜索结果
  • create_index

    • 创建新的Elasticsearch索引
    • 输入:
      • index (string):索引名称
      • mappings (对象,可选):索引映射配置
      • settings (对象,可选):索引设置配置
  • list_indices

    • 列出所有可用索引
    • 无需输入
    • 返回索引信息数组
  • 索引文档

    • 为文档建立索引
    • 输入:
      • index (string):目标索引名称
      • id (字符串,可选):文档ID
      • document (object):文档内容
    • 返回索引操作结果

资源

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

  • 索引映射 (elasticsearch://<host>/<index>/schema)
    • JSON映射信息
    • 字段名称、类型和配置
    • 从元数据中自动发现

使用Claude Desktop

添加到您的“mcpServers”部分 claude_desktop_config.json:

{
  "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端点。

许可证

根据MIT许可证获得许可。免费使用、修改和分发。有关详细信息,请参阅LICENSE文件。