使用说明

项目简介

MCP-researcher Server 是一个基于 Model Context Protocol (MCP) 构建的服务器,旨在为 LLM 客户端(如 Cline 或 Claude)提供强大的研究辅助功能。它集成了 Perplexity API,能够执行搜索查询、检索技术文档、发现可用 API 以及检查代码中已弃用的功能,帮助用户更高效地进行开发和研究工作。

主要功能点

  • 通用搜索 (Search): 根据用户查询,从 Perplexity 获取全面的搜索结果,支持简要、普通和详细三种结果级别。
  • 文档检索 (Get Documentation): 查找特定技术、库或 API 的文档和使用示例,帮助开发者快速上手和解决技术问题。
  • API 发现 (Find APIs): 根据用户需求,发现并评估可集成到项目中的 API,提供功能、定价、集成复杂度等多维度分析。
  • 代码弃用检查 (Check Deprecated Code): 分析代码片段,检测其中使用的已弃用特性或模式,并提供迁移建议,保持代码的现代性和兼容性。
  • 对话 Perplexity (chat_perplexity): 与 Perplexity AI 进行持续对话,支持创建新对话或继续现有对话,并保留完整的对话历史。

安装步骤

  1. 安装 Node.js: 如果尚未安装 Node.js,请访问 nodejs.org 下载并安装。
  2. 克隆仓库: 打开终端或命令提示符,执行以下命令克隆仓库到本地:
    git clone https://github.com/DaInfernalCoder/researcher-mcp perplexity-server
    cd perplexity-server
  3. 安装依赖: 在仓库目录下,运行以下命令安装项目依赖:
    npm install
  4. 获取 Perplexity API Key: 访问 https://www.perplexity.ai/settings/api 注册并获取 Perplexity API Key。
  5. 创建 MCP 配置文件: 根据你的操作系统,在指定路径创建 'cline_mcp_settings.json' 文件,用于 Claude Desktop 客户端识别 MCP 服务器。
    • macOS: '~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json'
    • Windows: '%APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json'
    • Linux: '~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json' 注意: 此步骤为可选,如果使用 Cline 客户端,则无需此步骤。
  6. 配置 Claude Desktop 客户端 (可选): 如果要与 Claude Desktop 客户端一起使用,需要编辑 Claude Desktop 的配置文件 'claude_desktop_config.json',添加服务器配置信息。
    • macOS: '~/Library/Application Support/Claude/claude_desktop_config.json'
    • Windows: '%APPDATA%/Claude/claude_desktop_config.json'
  7. 配置 Cline 客户端: 编辑 Cline 客户端的配置文件,将以下服务器配置信息添加到 'mcpServers' 字段中。

服务器配置 (JSON)

以下 JSON 配置信息用于配置 MCP 客户端 (如 Cline) 连接到 MCP-researcher Server。

{
  "mcpServers": {
    "perplexity-server": {  // 服务器名称,客户端内唯一标识
      "command": "node",    // 启动服务器的命令
      "args": [             // 命令参数
        "[path/to/perplexity-server/index.js]" // index.js 文件的绝对路径,请替换为实际路径
      ],
      "env": {               // 环境变量
        "PERPLEXITY_API_KEY": "your-api-key-here"  // 你的 Perplexity API Key,请替换为实际 Key
      },
      "disabled": false,      // 是否禁用该服务器,false 表示启用
      "autoApprove": [       // 自动批准的工具列表,客户端调用这些工具时无需用户确认
        "search",
        "get_documentation",
        "find_apis",
        "check_deprecated_code",
        "chat_perplexity"
      ]
    }
  }
}

注意:

  • 请将 '[path/to/perplexity-server/index.js]' 替换为 'index.js' 文件的实际绝对路径。
  • 请将 'your-api-key-here' 替换为你从 Perplexity 官网获取的 API Key。
  • 'autoApprove' 列表中的工具名称应与 'src/index.ts' 中 'ListToolsRequestSchema' 返回的工具名称一致。

基本使用方法

  1. 确保已正确安装和配置 MCP-researcher Server,并已配置到 MCP 客户端 (如 Cline 或 Claude)。
  2. 启动 MCP 客户端。
  3. 在 MCP 客户端中,即可通过自然语言指令调用 MCP-researcher Server 提供的工具,例如:
    • 在 Cline 中,可以使用 '@perplexity-server search "最新的React Hooks文档"' 来调用 'search' 工具查询 React Hooks 文档。
    • 可以使用 '@perplexity-server get_documentation "GraphQL"' 来调用 'get_documentation' 工具获取 GraphQL 的文档。
    • 其他工具的使用方法类似,根据工具名称和参数进行调用。

详细工具使用示例 请参考仓库 examples 目录下的 Markdown 文件,例如:

信息

分类

网页与API