返回市场
困惑度-mcp

困惑度-mcp

作者:DaInfernalCoder268 星标更新:2025-11-02

项目介绍

Perplexity MCP Server

由Perplexity专门的人工智能模型驱动的智能研究助手。具有自动查询复杂度检测功能,可将请求路由到最适合的模型以获得最佳结果。与官方服务器不同,它具有适用于所有任务的搜索功能,实际上

它还强制使用MCP的代理必须具体化

工具

1. 搜索(Sonar Pro)

快速搜索简单查询和基本信息查找。最适合需要简洁、直接答案的直截了当的问题。

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "search",
  arguments: {
    query: "法国的首都是什么?",
    force_model: false // 可选:即使查询看起来复杂也强制使用此模型
  }
});

2. 推理(Sonar Reasoning Pro)

处理需要详细分析的复杂多步骤任务。非常适合解释、比较和解决问题。

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "reason",
  arguments: {
    query: "对比REST和GraphQL API,解释它们的优点和缺点",
    force_model: false // 可选:即使查询看起来简单也强制使用此模型
  }
});

3. 深度研究(Sonar Deep Research)

进行全面的研究并生成详细的报告。适合对复杂主题进行深入分析。

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "deep_research",
  arguments: {
    query: "量子计算对密码学的影响",
    focus_areas: [
      "后量子加密算法",
      "量子威胁的时间线",
      "实际缓解策略"
    ],
    force_model: false // 可选:即使查询看起来简单也强制使用此模型
  }
});

配置

  1. 前置条件

  2. 配置MCP设置

在您的MCP设置文件中添加以下内容(位置因平台而异):

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": ["/path/to/perplexity-server/build/index.js"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

或者使用NPX而不必本地安装(推荐用于macOS):

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "your_api_key"
      }
    }
  }
}

如果MCP客户端无法通过环境变量解析Perplexity API密钥,例如在现代AI编码代理(如Kiro)中常见的"${env:PERPLEXITY_API_KEY}"方法,有两种备用解决方案:

命令行参数:直接作为命令行参数传递API密钥,甚至可以尝试看看"${env:PERPLEXITY_API_KEY}"是否在那里有效。

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--api-key",
        "your_api_key_here"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

读取明确的.env文件:指定项目.env文件的位置,该文件包含当前项目的环境变量和API密钥,并使用--cwd命令行参数,MCP服务器将从目录中读取.env文件找到Perplexity API密钥。

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--cwd",
        "/path/to/your/project"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

优先级顺序:命令行参数 > 环境变量 > 使用--cwd的.env文件(需要路径)

星标历史

星标历史图表