使用说明
项目简介
Researcher-MCP Server 是一款 MCP 服务器实现,旨在为 LLM 客户端(如 Cline)提供研究辅助能力。它利用 Perplexity AI 的 Sonar Pro API 作为后端,集成了多种实用工具,帮助用户在 LLM 环境中更有效地进行信息检索、技术文档查询、API 探索和代码维护等任务。该服务器通过 Model Context Protocol 与客户端通信,提供标准化的接口和易于扩展的功能。
主要功能点
- 通用搜索 (Search): 执行广泛的搜索查询,获取任何主题的综合信息。支持多种详细程度(简要、普通、详细)的搜索结果。
- 获取文档 (Get Documentation): 检索特定技术、库或 API 的文档和使用示例,帮助开发者快速了解和使用各种技术资源。
- 查找 API (Find APIs): 发现和评估可集成到项目中的 API,为开发者提供 API 选型和评估的参考。
- 检查过时代码 (Check Deprecated Code): 分析代码中已弃用的特性或模式,并提供迁移指南,帮助开发者维护代码的现代性和兼容性。
- 与 Perplexity AI 对话 (chat_perplexity): 维护与 Perplexity AI 的持续对话,支持创建新对话或继续现有对话,并保留完整的对话历史。
安装步骤
- 安装 Node.js: 如果尚未安装 Node.js,请访问 nodejs.org 下载并安装。
- 克隆仓库: 使用 Git 克隆仓库到本地:
git clone https://github.com/DaInfernalCoder/researcher-mcp perplexity-server cd perplexity-server - 安装依赖: 在项目目录下运行以下命令安装项目依赖:
npm install - 获取 Perplexity API 密钥: 访问 https://www.perplexity.ai/settings/api 获取您的 Perplexity API 密钥。
- 配置 MCP 设置文件: 根据您的操作系统,创建或编辑 MCP 客户端的设置文件 'cline_mcp_settings.json',通常位于以下路径:
- 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'
- 配置服务器: 将以下服务器配置信息添加到 MCP 客户端的配置文件中,例如 Cline 的 'claude_desktop_config.json' 或 'mcpServers' 配置项中。
服务器配置
以下为 MCP 客户端(如 Cline)需要配置的服务器信息,用于启动和连接 Researcher-MCP Server。
{ "mcpServers": { "perplexity-server": { "command": "node", // 启动服务器的命令,这里使用 Node.js 运行 JavaScript 文件 "args": [ "[path/to/researcher-mcp/index.js]" // 服务器入口文件 index.js 的绝对路径,请替换为实际路径 ], "env": { "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY" // Perplexity API 密钥,请替换为您在 Perplexity AI 官网获取的密钥 }, "disabled": false, // 设置为 false 表示启用该服务器 "autoApprove": [ // 自动批准的工具列表,客户端调用这些工具时无需用户手动批准 "search", "get_documentation", "find_apis", "check_deprecated_code", "chat_perplexity" ] } } }
请注意替换以下内容:
- '[path/to/researcher-mcp/index.js]':替换为 'index.js' 文件的实际绝对路径。例如,如果您将仓库克隆到 '~/perplexity-server' 目录,则路径可能为 '~/perplexity-server/index.js'。
- 'YOUR_PERPLEXITY_API_KEY':替换为您在 Perplexity AI 官网获取的 API 密钥。
- 构建服务器: 在项目目录下运行以下命令构建服务器:
npm run build
基本使用方法
配置完成后,MCP 客户端(如 Cline)应该能够自动连接到 Researcher-MCP Server。您可以通过客户端的界面或命令调用服务器提供的工具,例如:
- 在 Cline 中,您可以使用 '@perplexity-server:search' 工具进行搜索,例如 '@perplexity-server:search query="最新的AI技术发展趋势"'。
- 使用 '@perplexity-server:get_documentation' 查询技术文档,例如 '@perplexity-server:get_documentation query="React Hooks" context="useEffect Hook 的使用方法"'。
- 使用 '@perplexity-server:find_apis' 发现 API,例如 '@perplexity-server:find_apis requirement="支付处理" context="电商网站"'。
- 使用 '@perplexity-server:check_deprecated_code' 检查代码,例如 '@perplexity-server:check_deprecated_code code="componentWillMount()"' technology="React"'。
- 使用 '@perplexity-server:chat_perplexity' 与 Perplexity AI 对话,例如 '@perplexity-server:chat_perplexity message="你好,请问今天天气怎么样?"'。
具体工具的使用方法和参数可以参考仓库中 'examples' 目录下的示例文件。
信息
分类
网页与API