使用说明
OpenSearch MCP服务器
用于OpenSearch集成的MCP(模型上下文协议)服务器,其灵感来自 elasticsearch mcp服务器.
特性
- 索引管理工具:
- 列出OpenSearch集群中的所有索引
- 获取索引映射
- 获取索引设置
- 群集管理工具:
- 获取群集运行状况
- 获取集群统计信息
- 文档工具:
- 搜索文档
安装
# Clone the repository
git clone https://github.com/your-username/opensearch-mcp-server.git
cd opensearch-mcp-server
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package
pip install uv
uv pip install -e .
配置
创建一个 .env 根目录中的文件,包含以下变量:
OPENSEARCH_HOST=https://localhost:9200
OPENSEARCH_USERNAME=xxxx
OPENSEARCH_PASSWORD=xxxx
调整这些值以匹配您的OpenSearch配置。
使用游标
运行MCP服务器:
uv run opensearch-mcp-server --port=<port>
与Cursor集成
{
"mcpServers": {
"opensearch": {
"url": "http://<host>:<port>>/sse"
}
}
}
使用克劳德桌面应用程序
{
"mcpServers": {
"opensearch": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/opensearch-mcp-server",
"run",
"opensearch-mcp-server"
]
}
}
}
发展
# Install dependencies
uv pip install -e .
# Run tests
uv run pytest -vv -s test_opensearch.py