Perplexity MCP Server

Perplexity MCP Server

一个 MCP 服务器,它使 Claude 能够使用 Perplexity 的 API 执行网络搜索,并根据查询意图进行智能模型选择,同时支持领域和时效性过滤。

Category
访问服务器

Tools

search

Search the web using Perplexity AI

domain_filter

Add a domain to allow or block in search results (max 3 domains per type)

recency_filter

Set the time recency for search results

clear_filters

Clear all domain filters

list_filters

List all current domain filters

model_info

Get information about available models and optionally set a specific model

README

Perplexity MCP 服务器

一个 MCP 服务器,它使用 Perplexity 的 API 提供网络搜索功能,并根据查询意图自动选择模型。

<a href="https://glama.ai/mcp/servers/6qmvjay9z5"> <img width="380" height="200" src="https://glama.ai/mcp/servers/6qmvjay9z5/badge" alt="Perplexity Server MCP server" /> </a>

前提条件

安装

通过 Git 安装

  1. 克隆此仓库:

    git clone https://github.com/RossH121/perplexity-mcp.git
    cd perplexity-mcp
    
  2. 安装依赖项:

    npm install
    
  3. 构建服务器:

    npm run build
    

配置

  1. https://www.perplexity.ai/settings/api 获取您的 Perplexity API 密钥

  2. 将服务器添加到 Claude 的配置文件 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "perplexity-server": {
      "command": "node",
      "args": [
        "/absolute/path/to/perplexity-mcp/build/index.js"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "your-api-key-here",
        "PERPLEXITY_MODEL": "sonar"
      }
    }
  }
}

/absolute/path/to 替换为您克隆仓库的实际路径。

可用模型

该服务器现在支持基于查询意图的自动模型选择,但您也可以使用 PERPLEXITY_MODEL 环境变量指定默认模型。可用选项:

  • sonar-deep-research - 专门用于跨领域的广泛研究和专家级分析
  • sonar-reasoning-pro - 针对高级逻辑推理和复杂问题解决进行了优化
  • sonar-reasoning - 专为具有平衡性能的推理任务而设计
  • sonar-pro - 通用模型,具有出色的搜索能力和引用密度
  • sonar - 快速高效,适用于简单的查询

默认模型(在环境变量中指定)将用作自动模型选择的基线。

有关最新的模型定价和可用性,请访问:https://docs.perplexity.ai/guides/pricing

用法

配置服务器并重启 Claude 后,您可以简单地要求 Claude 搜索信息。例如:

  • "SpaceX 的最新消息是什么?"
  • "搜索芝加哥最好的餐厅"
  • "查找有关爵士乐历史的信息"
  • "我需要对最近的人工智能发展进行深入的研究分析" (使用 sonar-deep-research)
  • "帮我推理解决这个复杂的问题" (使用 sonar-reasoning-pro)

Claude 将自动使用 Perplexity 搜索工具来查找并返回相关信息。服务器将根据您的查询意图自动选择最合适的模型。

如果由于任何原因它决定不使用搜索工具,您可以通过在提示前加上 "Search the web" 来强制执行。

智能模型选择

服务器会根据您的查询自动选择最合适的 Perplexity 模型:

  • 使用研究导向的术语,如 "deep research"(深入研究)、"comprehensive"(全面的)或 "in-depth"(深入的)来触发 sonar-deep-research
  • 使用推理术语,如 "solve"(解决)、"figure out"(弄清楚)或 "complex problem"(复杂问题)来触发 sonar-reasoning-pro
  • 使用简单的术语,如 "quick"(快速的)、"brief"(简短的)或 "basic"(基本的)来触发轻量级的 sonar 模型
  • 一般搜索术语默认为 sonar-pro,以实现平衡的性能

每个搜索响应都包含有关使用哪个模型以及原因的信息。

域名过滤

此服务器支持域名过滤,以自定义您的搜索体验。您可以使用以下命令允许或阻止特定域名:

  • 添加允许的域名:"Use the domain_filter tool to allow wikipedia.org" (使用 domain_filter 工具允许 wikipedia.org)
  • 添加阻止的域名:"Use the domain_filter tool to block pinterest.com" (使用 domain_filter 工具阻止 pinterest.com)
  • 查看当前过滤器:"Use the list_filters tool" (使用 list_filters 工具) (显示域名和时间范围过滤器)
  • 清除所有过滤器:"Use the clear_filters tool" (使用 clear_filters 工具) (清除域名和时间范围过滤器)

注意: Perplexity API 最多支持 3 个域名,并优先考虑允许的域名。域名过滤需要支持此功能的 Perplexity API 层。

使用流程示例:

  1. "Use the domain_filter tool to allow wikipedia.org" (使用 domain_filter 工具允许 wikipedia.org)
  2. "Use the domain_filter tool to allow arxiv.org" (使用 domain_filter 工具允许 arxiv.org)
  3. "Use the list_filters tool" (使用 list_filters 工具) (验证您的设置)
  4. "Search for quantum computing advances" (搜索量子计算进展) (结果将优先考虑 wikipedia.org 和 arxiv.org)

时间范围过滤

您可以使用时间范围过滤器将搜索结果限制在特定的时间窗口内:

  • 设置时间范围过滤器:"Use the recency_filter tool with filter=hour" (使用 recency_filter 工具,filter=hour) (选项:hour, day, week, month)
  • 禁用时间范围过滤器:"Use the recency_filter tool with filter=none" (使用 recency_filter 工具,filter=none)

这对于时间敏感的查询(如时事或突发新闻)特别有用。

模型选择控制

虽然自动模型选择在大多数情况下都运行良好,但您可以手动控制使用哪个模型:

  • 查看模型信息:"Use the model_info tool" (使用 model_info 工具)
  • 设置特定模型:"Use the model_info tool with model=sonar-deep-research" (使用 model_info 工具,model=sonar-deep-research)
  • 返回自动选择:将模型设置回默认模型

使用示例:

  1. "Use the model_info tool" (使用 model_info 工具) (查看可用模型和当前状态)
  2. "Use the model_info tool with model=sonar-reasoning-pro" (使用 model_info 工具,model=sonar-reasoning-pro) (强制使用推理模型)
  3. "Search for a mathematical proof of the Pythagorean theorem" (搜索勾股定理的数学证明) (将使用 sonar-reasoning-pro)
  4. "Use the model_info tool with model=sonar-pro" (使用 model_info 工具,model=sonar-pro) (返回自动选择)

开发

要修改服务器:

  1. 编辑 src/index.ts
  2. 使用 npm run build 重新构建
  3. 重新启动 Claude 以加载更改

许可证

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选