Elasticsearch 7.x MCP 服务器
为 Elasticsearch 7.x 提供兼容的 MCP 协议接口,支持多种高级搜索功能。
快速入门
安装
- 使用 Smithery 自动安装:
npx -y @smithery/cli install @imlewc/elasticsearch7-mcp-server --client claude
- 手动安装:
pip install -e .
配置环境变量
设置以下环境变量:
ELASTIC_HOST
: Elasticsearch 主机地址。ELASTIC_USERNAME
: 用户名。ELASTIC_PASSWORD
: 密码。MCP_PORT
(可选): 默认端口 9999。
启动服务
使用 Docker Compose:
- 创建
.env
文件并设置密码。 - 启动服务:
docker-compose up -d
使用客户端连接
Python 示例:
from mcp import MCPClient
client = MCPClient("localhost:9999")
response = client.call("es-ping")
print(response)