Hermes Search MCP Server

使用说明

项目简介

Hermes Search MCP Server 实现了 Model Context Protocol (MCP),作为一个 MCP 服务器,它允许 LLM 客户端(如 Cline, Cursor, Claude Desktop 等)通过标准化的协议访问 Azure Cognitive Search 提供的搜索和数据管理功能。该服务器旨在简化 LLM 应用与外部数据源的集成,提升 AI 助手的数据处理和检索能力。

主要功能点

  • 全文和语义搜索: 支持对 Azure Cognitive Search 索引中的文档进行高效的全文和语义搜索。
  • 文档索引管理: 允许 LLM 客户端向 Azure Cognitive Search 索引添加或更新文档。
  • 索引删除: 提供删除 Azure Cognitive Search 索引的功能。
  • 可配置的搜索参数: 支持自定义搜索参数,如返回结果数量、过滤器和选择字段。
  • 类型安全操作: 使用 TypeScript 开发,保证操作的类型安全。
  • 兼容多种 MCP 客户端: 兼容 Cline, Cursor, Claude Desktop 等多种 MCP 客户端。

安装步骤

  1. 前提条件:

    • 确保已安装 Node.js (v20 或更高版本) 和 npm.
    • 拥有 Azure Cognitive Search 服务 和相应的凭据(包括 Endpoint, API Key 和 Index Name)。
    • 已安装支持 MCP 协议的 LLM 客户端,如 Cline, Cursor, 或 Claude Desktop。
  2. 安装 Hermes Search MCP Server:

    • 使用 NPX 运行 (无需安装): 打开终端,运行以下命令即可启动服务器:
      npx -y hermes-search-mcp@latest

服务器配置 (MCP 客户端配置)

为了让 MCP 客户端连接到 Hermes Search MCP Server,您需要在客户端中配置 MCP 服务器信息。以下是 Cline, Cursor, 和 Claude Desktop 的配置示例。

注意: 在配置前,请将以下占位符替换为您的 Azure Cognitive Search 服务的真实信息:

  • 'your-search-endpoint': 您的 Azure Cognitive Search 服务的 Endpoint。
  • 'your-api-key': 您的 Azure Cognitive Search 服务的 API Key。
  • 'your-index-name': 您要使用的 Azure Cognitive Search 索引的名称。

1. Cline 配置:

打开 Cline 的 MCP 设置文件 ('cline_mcp_settings.json'),通常位于:

  • macOS: '~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json'
  • Windows: '%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json'

在 'mcpServers' 中添加以下配置:

{
  "mcpServers": {
    "hermes-search-mcp": {
      "command": "npx",
      "args": ["-y", "hermes-search-mcp@latest"],
      "env": {
        "AZURE_SEARCH_ENDPOINT": "your-search-endpoint",  // 替换为您的 Azure Search Endpoint
        "AZURE_SEARCH_API_KEY": "your-api-key",        // 替换为您的 Azure Search API Key
        "AZURE_SEARCH_INDEX_NAME": "your-index-name"   // 替换为您的 Azure Search Index Name
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

2. Cursor 配置:

打开 Cursor 设置 (Settings),导航到 Features > MCP Servers,点击 "+ Add New MCP Server"。

  • Name: 'hermes-search-mcp' (或您自定义的名称)
  • Type: 'command'
  • Command:
    env AZURE_SEARCH_ENDPOINT=your-search-endpoint AZURE_SEARCH_API_KEY=your-api-key AZURE_SEARCH_INDEX_NAME=your-index-name npx -y hermes-search-mcp@latest
    请务必替换 'your-search-endpoint', 'your-api-key', 和 'your-index-name' 为您的实际 Azure Cognitive Search 凭据。

3. Claude Desktop App 配置:

打开 Claude Desktop App 的配置文件 ('claude_desktop_config.json'),通常位于:

  • macOS: '~/Library/Application Support/Claude/claude_desktop_config.json'
  • Windows: '%APPDATA%\Claude\claude_desktop_config.json'

在 'mcpServers' 中添加以下配置:

{
  "mcpServers": {
    "hermes-search-mcp": {
      "command": "npx",
      "args": ["-y", "hermes-search-mcp@latest"],
      "env": {
        "AZURE_SEARCH_ENDPOINT": "your-search-endpoint",  // 替换为您的 Azure Search Endpoint
        "AZURE_SEARCH_API_KEY": "your-api-key",        // 替换为您的 Azure Search API Key
        "AZURE_SEARCH_INDEX_NAME": "your-index-name"   // 替换为您的 Azure Search Index Name
      }
    }
  }
}

配置完成后,重启您的 MCP 客户端。

基本使用方法

在 MCP 客户端中,您应该能够看到 Hermes Search MCP Server 提供的工具,例如 "search-documents", "index-content", "delete-index"。

您可以通过自然语言指令或客户端提供的界面来调用这些工具,例如:

  • 在 Cline 或 Cursor 中,您可以使用 '工具名(参数)' 的形式来调用工具,例如 'search-documents(query="machine learning", top=10)'.
  • 在 Claude Desktop App 中,您可能需要使用特定的提示词或操作方式来触发工具调用。

具体使用方法请参考您所使用的 MCP 客户端的文档。

服务器信息