返回市场
麦克佩服务器开放搜索

麦克佩服务器开放搜索

作者:ibrooksSDX4 星标更新:2025-02-19

项目介绍

mcp-server-opensearch: 一个用于OpenSearch的MCP服务器

smithery徽章

模型上下文协议(MCP)是一个开放协议,它使得大型语言模型应用程序与外部数据源和工具之间的无缝集成成为可能。无论您是在构建AI驱动的IDE、增强聊天界面,还是创建自定义AI工作流,MCP都提供了一种标准化的方法来连接LLMs与其所需的上下文。

此仓库展示了如何为分布式搜索和分析引擎OpenSearch创建一个MCP服务器。

正在建设中

image1 image2

当前障碍 - OpenSearch异步客户端无法安装

Open Search异步客户端文档

pip install opensearch-py[async]
zsh: 没有找到匹配项:opensearch-py[async]

概览

这是一个基本的模型上下文协议服务器,用于在OpenSearch引擎中存储和检索记忆。 它作为OpenSearch数据库之上的语义记忆层。

组件

工具

  1. search-openSearch
    • 在OpenSearch数据库中存储一条记忆
    • 输入:
      • query (json): 准备好的json查询消息
    • 返回:确认消息

安装

通过Smithery安装

要通过Smithery自动安装mcp-server-opensearch到Claude Desktop:

npx -y @smithery/cli install @ibrooksSDX/mcp-server-opensearch --client claude

使用uv(推荐)

当使用uv时,无需特定安装即可直接运行mcp-server-opensearch

uv run mcp-server-opensearch \
  --opensearch-url "http://localhost:9200" \
  --index-name "my_index" \

uv run fastmcp run demo.py:main

测试 - 本地Open Search客户端

image4

uv run python src/mcp-server-opensearch/test_opensearch.py

测试 - MCP服务器连接到Open Search客户端

image1 image2

cd src/mcp-server-opensearch
uv run fastmcp dev demo.py

与Claude Desktop一起使用

要在Claude Desktop应用中使用此服务器,请在您的claude_desktop_config.json文件的“mcpServers”部分添加以下配置:

{
  "opensearch": {
    "command": "uvx",
    "args": [
      "mcp-server-opensearch",
      "--opensearch-url",
      "http://localhost:9200",
      "--opensearch-api-key",
      "your_api_key",
      "--index-name",
      "your_index_name"
    ]
  }, "Demo": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "--with",
        "opensearch-py",
        "fastmcp",
        "run",
        "/Users/ibrooks/Documents/GitHub/mcp-server-opensearch/src/mcp-server-opensearch/demo.py"
      ]
    }
}

或者使用FastMCP UI将服务器安装到Claude

uv run fastmcp install demo.py

环境变量

服务器的配置也可以通过环境变量进行设置:

  • OPENSEARCH_HOST: OpenSearch服务器的URL,例如http://localhost
  • OPENSEARCH_HOSTPORT: OpenSearch服务器主机的端口9200
  • INDEX_NAME: 要使用的索引名称