Back to MCP directory
publicPublicdnsLocal runtime

opensearch-mcp-server-zf2

OpenSearch MCP服务是一个用于OpenSearch集成的模型上下文协议服务器,提供索引管理、集群管理和文档搜索等功能。

article

README

🚀 OpenSearch MCP 服务器

OpenSearch MCP 服务器是基于 elasticsearch-mcp-server 携手打造的,它集成了 MCP(模型上下文协议),为用户提供便捷的 OpenSearch 操作体验。

🚀 快速开始

安装

# 克隆仓库
git clone https://github.com/your-username/opensearch-mcp-server.git
cd opensearch-mcp-server

# 创建并激活虚拟环境
python -m venv .venv
source .venv/bin/activate  # Windows 系统请使用:.venv\Scripts\activate

# 安装包
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=<端口>

与 Cursor 集成

在 Cursor 中配置如下:

{
  "mcpServers": {
    "opensearch": {
      "url": "http://<主机>:<端口>/sse"
    }
  }
}

与 Claude Desktop APP 集成

{
  "mcpServers": {
    "opensearch": {
      "command": "uv",
      "args": [
          "--directory",
          "/absolute/path/to/opensearch-mcp-server",
          "run",
          "opensearch-mcp-server"
      ]
    }
  }
}

✨ 主要特性

  • 索引管理工具
    • 可列出 OpenSearch 集群中的所有索引。
    • 能够获取索引映射。
    • 可以获取索引设置。
  • 集群管理工具
    • 能获取集群健康状态。
    • 可获取集群统计信息。
  • 文档工具:支持搜索文档。

📦 安装指南

# 克隆仓库
git clone https://github.com/your-username/opensearch-mcp-server.git
cd opensearch-mcp-server

# 创建并激活虚拟环境
python -m venv .venv
source .venv/bin/activate  # Windows 系统请使用:.venv\Scripts\activate

# 安装包
pip install uv
uv pip install -e .

💻 使用示例

基础用法

启动 MCP 服务器

uv run opensearch-mcp-server --port=<端口>

与 Cursor 集成配置

{
  "mcpServers": {
    "opensearch": {
      "url": "http://<主机>:<端口>/sse"
    }
  }
}

与 Claude Desktop APP 集成配置

{
  "mcpServers": {
    "opensearch": {
      "command": "uv",
      "args": [
          "--directory",
          "/absolute/path/to/opensearch-mcp-server",
          "run",
          "opensearch-mcp-server"
      ]
    }
  }
}

📚 详细文档

配置指南

在项目根目录下创建一个名为 .env 的文件,并添加以下变量:

OPENSEARCH_HOST=https://localhost:9200
OPENSEARCH_USERNAME=xxxx
OPENSEARCH_PASSWORD=xxxx

请根据你的 OpenSearch 配置调整这些值。

开发指南

# 安装依赖
uv pip install -e .

# 运行测试
uv run pytest -vv -s test_opensearch.py

📄 许可证

MIT

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