{"_id":"@awesome-ai/elasticsearch-mcp","_rev":"8-3ea7add9cbc54ffa2f8347033d44ac7a","name":"@awesome-ai/elasticsearch-mcp","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.0","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.0","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"e8b486c5f7aa50facd3875e8e7d4cd4b71a900fc","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.0.tgz","fileCount":16,"integrity":"sha512-h9N3UtmuqOdljz8UdAj4m3mR+SdrQ3nI3YghvH1KQSPM41k+0MvYQX6XEHgap5NXy/N93CDhR1P6QjkUdZmdXQ==","signatures":[{"sig":"MEQCID/O6x6H7oqiUbH1iC36RT1wChMYb43Ecwa1TTlmUhizAiAFZRfxw/YQMagraoe85ZM6Gsls7XmQpUwSMhkSeRuRvQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23007},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"1cff7f320968771059216ef59dfc2fc483457999","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.0_1743607165589_0.8741850063236709","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.1","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.1","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"d64da770f28ae28847ed89248ca22850ea6e7b6e","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.1.tgz","fileCount":24,"integrity":"sha512-50xZEib7yPJdmQMNeaN2BQ4yObn4+rNYpJ6/Th7JcPwRutSUisQB7MArwnwBvCLP321bJhHpV+JkB/fBRoYYXQ==","signatures":[{"sig":"MEUCIQCmZ2monjXtHi3Z/FvBXPSnmhCevod+Ttqp5He+aFjLdwIgT/h+b3f7XfBapOLFamGIZkGCWmbO8d8HwafW3Lc38/o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36057},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"1c961600cc6f1a97ed50338748d9aee280e2d649","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.1_1743610361607_0.3136752108068155","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.2","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.2","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"e8f78eb357ce2af9e274bbfcf7d7931fee741571","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.2.tgz","fileCount":24,"integrity":"sha512-wEgq0X8d14HQlANoBDmy2uyxTfvkvWAQWKAMn5wCTGDfE/MCGKxY0Z0dZYya4OJUWvWJjWklmQJp+Ud7vX2mjw==","signatures":[{"sig":"MEYCIQCO90ohTrMG5IjSt1/8JuG/NGL+yoVKsIk+cIClFIfygQIhAN8pVL0fq+L0owDmayX4C4mQUB/V2NSjilmeJuCIKRCo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36719},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"fb0dbfb2b7a706818315355d8d64575916ad7883","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.2_1743676868654_0.3753328855515041","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.3","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.3","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"97a9eff225bc66ac630d5dca2cd79ead6e73cdd3","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.3.tgz","fileCount":24,"integrity":"sha512-9brZvu0sgxScs/YeK+8mJO8DCIfCRPojsUr2nufMkfW/IkRvpW7YzCLBBWy5zat3xAIpp963Fvsssi7sbdFMbg==","signatures":[{"sig":"MEUCIHYOj2E8ma2THp2if2mgPojtKmeeyn4JNW5I8c7HN6WAAiEA9tNjbA6IaKzFer27SmKe81jzPCFvPNq5zTSJB9UtkbY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36859},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"3e0affec611d149994e31613e62247a36a72b648","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.3_1743696692464_0.617452196451389","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.4","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.4","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"639cbfde9a415469358827755c1461c6bfc1ce33","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.4.tgz","fileCount":30,"integrity":"sha512-bbPV7/1BROtL282zWEgjfbUIb4Txh69mRlDp2/zjvUdW664B7n1wdqtKmdWbWCo6r/aKDYAdTwUTBHZgquI1Uw==","signatures":[{"sig":"MEUCIQCzE+2yE8MHr9bAXuaVEF8uvdIs19SX/9GAKfaeZu6ffgIgRPtC1Jx5EtphTsw0AW/qRf5O98MqO2RHz2Hb84fcjUc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50535},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"00c8d058d8b467e30672341181af36e77f88276a","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.4_1743698021624_0.21314532299307842","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.5","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.5","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"4b7d9723904e686ad97ec436b17c9d1ac3526df4","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.5.tgz","fileCount":28,"integrity":"sha512-A8rUxqFCjBinXTezZO9vsrPSX+SJbWqcvA43fmkko14FdLn5qmJ9NXYfOb7cPdS3OZz1OIPRiRgWqfILmVu0hA==","signatures":[{"sig":"MEUCIQCo1bDi3qLfxRoxfoisqHIGgD0/dEmsToETlhkw3H1gvgIgfDvZUmVFRMBdMiUGFXctXe0UFcXmw+mL+gAId9aRPko=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47402},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"61337513b5430f72963c3bf2129b17b07f5b76b1","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.5_1744104269170_0.8087603884176295","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.6","keywords":["elasticsearch","search","mcp","mcp-server"],"author":{"name":"Simon"},"license":"MIT","_id":"@awesome-ai/elasticsearch-mcp@1.0.6","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"bin":{"elasticsearch-mcp":"dist/index.js"},"dist":{"shasum":"1a590b01f59b21b43ec2194e69f6b1259d181f07","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.6.tgz","fileCount":28,"integrity":"sha512-uoNf+dHMxLPN96vYr4sJx5RcaKlxtol7s+QO/bRzf4YDudmvcGvu/VTKZyRhEOGUTxlLBWWuAb7YHAouvHMxXg==","signatures":[{"sig":"MEUCIQCoxKmo3GByl8dufrWlLvLpu/vbAT73vf/mareMcpNsRwIgbAo5Kaz82nVaphd6+I/OOt4FYELCAjt7bzuhhPQvj+I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47900},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"dfe8d5c8fe63e44b8fdae5da356f4fd5af1c0768","scripts":{"test":"npm run build","build":"tsc && shx chmod +x dist/*.js","start":"node dist/index.js","watch":"tsc --watch","prepare":"npm run build","inspector":"npx @modelcontextprotocol/inspector node dist/index.js"},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"repository":{"url":"git+https://github.com/awesimon/elasticsearch-mcp.git","type":"git"},"_npmVersion":"11.1.0","description":"Elasticsearch MCP Server","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"shx":"0.4.0","typescript":"5.8.2","@types/node":"22.13.15"},"_npmOperationalInternal":{"tmp":"tmp/elasticsearch-mcp_1.0.6_1744106995616_0.7466678735684205","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@awesome-ai/elasticsearch-mcp","version":"1.0.7","description":"Elasticsearch MCP Server","keywords":["elasticsearch","search","mcp","mcp-server"],"homepage":"https://github.com/awesimon/elasticsearch-mcp","bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"repository":{"type":"git","url":"git+https://github.com/awesimon/elasticsearch-mcp.git"},"license":"MIT","author":{"name":"Simon"},"type":"module","main":"dist/index.js","types":"./dist/index.d.ts","bin":{"elasticsearch-mcp":"dist/index.js"},"scripts":{"build":"tsc && shx chmod +x dist/*.js","prepare":"npm run build","watch":"tsc --watch","start":"node dist/index.js","inspector":"npx @modelcontextprotocol/inspector node dist/index.js","test":"npm run build"},"dependencies":{"@elastic/elasticsearch":"^8.17.1","@modelcontextprotocol/sdk":"1.8.0"},"devDependencies":{"@types/node":"22.13.15","shx":"0.4.0","typescript":"5.8.2"},"publishConfig":{"access":"public"},"module":"dist/index.js","_id":"@awesome-ai/elasticsearch-mcp@1.0.7","gitHead":"218cd8ce723365ab27b327b6c70d53ad406f9a10","_nodeVersion":"22.13.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-+AD57dqcY1voPPa5XGs3sTPXJdSH2oDF5l3+LSLSL9mbOhU0qt+batozpljswHuEYwYD7i+7yLusNMUpgYUT/g==","shasum":"8ed946844c7437618d759ef8da7ea0e7b7ad7e5b","tarball":"https://registry.npmjs.org/@awesome-ai/elasticsearch-mcp/-/elasticsearch-mcp-1.0.7.tgz","fileCount":28,"unpackedSize":51038,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC2E4LUriqjGuhOM38bZK7uigkt4Renvwm666RU6yQKRQIhAL8RUVcqaI0uFaLq1wlbrKuJGefx4EN4YmCIg1XSbA7m"}]},"_npmUser":{"name":"awesome-ai","email":"simmonn@sina.com"},"directories":{},"maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/elasticsearch-mcp_1.0.7_1754308594423_0.8395504536022154"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-02T15:19:25.468Z","modified":"2025-08-04T11:56:34.849Z","1.0.0":"2025-04-02T15:19:25.807Z","1.0.1":"2025-04-02T16:12:41.803Z","1.0.2":"2025-04-03T10:41:08.840Z","1.0.3":"2025-04-03T16:11:32.662Z","1.0.4":"2025-04-03T16:33:41.904Z","1.0.5":"2025-04-08T09:24:29.350Z","1.0.6":"2025-04-08T10:09:55.795Z","1.0.7":"2025-08-04T11:56:34.658Z"},"bugs":{"url":"https://github.com/awesimon/elasticsearch-mcp/issues"},"author":{"name":"Simon"},"license":"MIT","homepage":"https://github.com/awesimon/elasticsearch-mcp","keywords":["elasticsearch","search","mcp","mcp-server"],"repository":{"type":"git","url":"git+https://github.com/awesimon/elasticsearch-mcp.git"},"description":"Elasticsearch MCP Server","maintainers":[{"name":"awesome-ai","email":"simmonn@sina.com"}],"readme":"# Elasticsearch MCP 服务器\n\n[English](./README.md) | [中文](./README.zh-CN.md)\n\n[![smithery badge](https://smithery.ai/badge/@awesimon/elasticsearch-mcp)](https://smithery.ai/server/@awesimon/elasticsearch-mcp)\n\nMCP 服务器用于从任何 MCP 客户端（如 Claude Desktop、Cursor）直接连接到您的 Elasticsearch 集群。\n\n该服务器使用模型上下文协议（Model Context Protocol）将智能体连接到您的 Elasticsearch 数据。它允许您通过自然语言对话与 Elasticsearch 索引进行交互。\n\n## 演示\n\n[![Elasticsearch MCP Demo](https://img.youtube.com/vi/iJ1NPzAQ3bU/0.jpg)](https://www.youtube.com/watch?v=iJ1NPzAQ3bU \"Elasticsearch MCP Demo\")\n\n## 功能概述\n\n### 可用工具\n\n#### 集群管理\n* `elasticsearch_health`: 获取 Elasticsearch 集群健康状态，可选择包括索引级别的详细信息\n\n#### 索引操作\n* `list_indices`: 列出可用的 Elasticsearch 索引，支持正则表达式\n* `create_index`: 创建 Elasticsearch 索引，可选择设置和映射\n* `reindex`: 将数据从源索引重新索引到目标索引，支持可选的查询和脚本\n\n#### 映射管理\n* `get_mappings`: 获取特定 Elasticsearch 索引的字段映射\n* `create_mapping`: 为 Elasticsearch 索引创建或更新映射结构\n\n#### 搜索与数据操作\n* `search`: 使用提供的查询 DSL 执行 Elasticsearch 搜索\n* `bulk`: 批量导入数据到 Elasticsearch 索引\n\n#### 模板管理\n* `create_index_template`: 创建或更新索引模板\n* `get_index_template`: 获取索引模板信息\n* `delete_index_template`: 删除索引模板\n\n### 工作原理\n\n1. MCP 客户端分析您的请求并确定需要哪些 Elasticsearch 操作。\n2. MCP 服务器执行这些操作（列出索引、获取映射、执行搜索）。\n3. MCP 客户端处理结果并以用户友好的格式呈现。\n\n## 入门指南\n\n### 前提条件\n\n* Elasticsearch 实例\n* Elasticsearch 认证凭据（API 密钥或用户名/密码）\n* MCP 客户端（如 Claude Desktop、Cursor）\n\n### 安装与设置\n\n#### 使用已发布的 NPM 包\n\n> [!TIP]\n> 使用 Elasticsearch MCP 服务器最简单的方法是通过已发布的 npm 包。\n\n1. **配置 MCP 客户端**\n   - 打开您的 MCP 客户端。查看 [MCP 客户端列表](https://modelcontextprotocol.io/clients)，这里我们配置的是 Claude Desktop。\n   - 转到 **Settings > Developer > MCP Servers**\n   - 点击 `Edit Config` 并添加一个新的 MCP 服务器，配置如下：\n\n   ```json\n   {\n     \"mcpServers\": {\n       \"elasticsearch-mcp\": {\n         \"command\": \"npx\",\n         \"args\": [\n           \"-y\",\n           \"@awesome-ai/elasticsearch-mcp\"\n         ],\n         \"env\": {\n           \"ES_HOST\": \"your-elasticsearch-host\",\n           \"ES_API_KEY\": \"your-api-key\"\n         }\n       }\n     }\n   }\n   ```\n\n2. **开始对话**\n   - 在 MCP 客户端中打开新对话。\n   - MCP 服务器应自动连接。\n   - 现在您可以询问关于 Elasticsearch 数据的问题。\n\n### 配置选项\n\nElasticsearch MCP 服务器支持以下配置选项来连接到您的 Elasticsearch：\n\n> [!NOTE]\n> 您必须提供 API 密钥或同时提供用户名和密码进行身份验证。\n\n| 环境变量 | 描述 | 必需 |\n|---------------------|-------------|----------|\n| `ES_HOST` | 您的 Elasticsearch 实例 URL(s) - 支持单个 URL 或逗号分隔的多个 URL（兼容旧版 `HOST`） | 是 |\n| `ES_API_KEY` | 用于身份验证的 Elasticsearch API 密钥（兼容旧版 `API_KEY`） | 否 |\n| `ES_USERNAME` | 用于基本身份验证的 Elasticsearch 用户名（兼容旧版 `USERNAME`） | 否 |\n| `ES_PASSWORD` | 用于基本身份验证的 Elasticsearch 密码（兼容旧版 `PASSWORD`） | 否 |\n| `ES_CA_CERT` | Elasticsearch SSL/TLS 的自定义 CA 证书路径（兼容旧版 `CA_CERT`） | 否 |\n\n### 多URL配置\n\n您可以配置多个 Elasticsearch 节点以实现高可用性和负载均衡：\n\n```json\n{\n  \"mcpServers\": {\n    \"elasticsearch-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@awesome-ai/elasticsearch-mcp\"\n      ],\n      \"env\": {\n        \"ES_HOST\": \"https://es-node1:9200,https://es-node2:9200,https://es-node3:9200\",\n        \"ES_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\n客户端将自动处理配置节点之间的故障转移和负载均衡。\n\n## 本地开发\n\n> [!NOTE]\n> 如果您想修改或扩展 MCP 服务器，请按照以下本地开发步骤操作。\n\n1. **使用正确的 Node.js 版本**\n   ```bash\n   nvm use\n   ```\n\n2. **安装依赖**\n   ```bash\n   npm install\n   ```\n\n3. **构建项目**\n   ```bash\n   npm run build\n   ```\n\n4. **在 Claude Desktop 应用中本地运行**\n   - 打开 **Claude Desktop 应用**\n   - 转到 **Settings > Developer > MCP Servers**\n   - 点击 `Edit Config` 并添加一个新的 MCP 服务器，配置如下：\n   ```json\n   {\n     \"mcpServers\": {\n       \"elasticsearch-mcp\": {\n         \"command\": \"node\",\n         \"args\": [\n           \"/path/to/your/project/dist/index.js\"\n         ],\n         \"env\": {\n           \"ES_HOST\": \"your-elasticsearch-host\",\n           \"ES_API_KEY\": \"your-api-key\"\n         }\n       }\n     }\n   }\n   ```\n\n5. **在 Cursor 编辑器中本地运行**\n   - 打开 **Cursor 编辑器**\n   - 转到 **Cursor Settings > MCP**\n   - 点击 `Add new global MCP Server` 并添加一个新的 MCP 服务器，配置如下：\n   ```json\n   {\n     \"mcpServers\": {\n       \"elasticsearch-mcp\": {\n         \"command\": \"node\",\n         \"args\": [\n           \"/path/to/your/project/dist/index.js\"\n         ],\n         \"env\": {\n           \"ES_HOST\": \"your-elasticsearch-host\",\n           \"ES_API_KEY\": \"your-api-key\"\n         }\n       }\n     }\n   }\n   ```\n\n6. **使用 MCP Inspector 进行调试**\n   ```bash\n   ES_HOST=your-elasticsearch-url ES_API_KEY=your-api-key npm run inspector\n   ```\n\n   这将启动 MCP Inspector，允许您调试和分析请求。您应该会看到：\n\n   ```bash\n   Starting MCP inspector...\n   ⚙️ Proxy server listening on port 6277\n   🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀\n   ```\n\n## 使用示例\n\n> [!TIP]\n> 以下是您可以在 MCP 客户端中尝试的一些自然语言查询示例。\n\n#### 集群管理\n* \"我的 Elasticsearch 集群的健康状态如何？\"\n* \"集群中有多少个活跃节点？\"\n\n#### 索引操作\n* \"我的 Elasticsearch 集群中有哪些索引？\"\n* \"创建一个名为 'users' 的新索引，有 3 个分片和 1 个副本。\"\n* \"将数据从 'old_index' 重新索引到 'new_index'。\"\n\n#### 映射管理\n* \"显示 'products' 索引的字段映射。\"\n* \"向 'products' 索引添加一个名为 'tags' 的关键字类型字段。\"\n\n#### 搜索与数据操作\n* \"查找上个月超过 500 美元的所有订单。\"\n* \"哪些产品收到了最多的五星评价？\"\n* \"将这些客户记录批量导入到 'customers' 索引中。\"\n\n#### 模板管理\n* \"为日志创建模式为 'logs-*' 的索引模板。\"\n* \"显示我所有的索引模板。\"\n* \"删除 'outdated_template' 索引模板。\"\n\n如果您遇到问题，请随时在 GitHub 仓库上提出 issue。 ","readmeFilename":"README.zh-CN.md"}