Perplexity MCP Server
Perplexity MCP 服务器
MCP 服务器使用 Perplexity 的 API 提供网络搜索功能,并根据查询意图自动选择模型。
先决条件
Node.js(v14 或更高版本)
Perplexity API 密钥(在https://www.perplexity.ai/settings/api获取)
克劳德桌面应用程序
Related MCP server: Perplexity MCP Server
安装
通过 Git 安装
克隆此存储库:
git clone https://github.com/RossH121/perplexity-mcp.git cd perplexity-mcp安装依赖项:
npm install构建服务器:
npm run build
配置
从https://www.perplexity.ai/settings/api获取您的 Perplexity API 密钥
将服务器添加到 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 搜索工具查找并返回相关信息。服务器会根据你的查询意图自动选择最合适的模型。
如果出于某种原因它决定不使用搜索工具,您可以通过在提示前加上“搜索网络”来强制解决问题。
智能模型选择
服务器会根据您的查询自动选择最合适的 Perplexity 模型:
使用“深入研究”、“全面”或“深入”等研究导向的术语来触发声纳深入研究
使用“解决”、“弄清楚”或“复杂问题”等推理术语来触发 sonar-reasoning-pro
使用“快速”、“简短”或“基本”等简单术语来触发轻量级声纳模型
为了实现平衡的性能,一般搜索词默认使用 sonar-pro
每个搜索响应都包含有关使用哪种模型以及原因的信息。
域名过滤
此服务器支持域名过滤,方便您定制搜索体验。您可以使用以下命令允许或屏蔽特定域名:
添加允许的域:“使用 domain_filter 工具允许 wikipedia.org”
添加被阻止的域名:“使用 domain_filter 工具阻止 pinterest.com”
查看当前过滤器:“使用 list_filters 工具”(显示域和新近度过滤器)
清除所有过滤器:“使用 clear_filters 工具”(清除域和新近度过滤器)
注意:Perplexity API 最多支持 3 个域名,并会优先处理允许的域名。域名过滤功能需要支持此功能的 Perplexity API 层级。
使用流程示例:
“使用 domain_filter 工具允许 wikipedia.org”
“使用 domain_filter 工具允许 arxiv.org”
“使用 list_filters 工具”(验证您的设置)
“搜索量子计算进展”(结果将优先考虑 wikipedia.org 和 arxiv.org)
最近过滤
您可以使用最近过滤器将搜索结果限制在特定的时间范围内:
设置最近过滤器:“使用带有过滤器=小时的 recency_filter 工具”(选项:小时、天、周、月)
禁用最近过滤器:“使用带有 filter=none 的 recency_filter 工具”
这对于时事或突发新闻等时间敏感的查询特别有用。
模型选择控制
虽然自动模型选择在大多数情况下都能很好地发挥作用,但您可以手动控制使用哪种模型:
查看模型信息:“使用model_info工具”
设置特定模型:“使用 model_info 工具和 model=sonar-deep-research”
恢复自动选择:将模型设置回默认模型
使用示例:
“使用 model_info 工具”(查看可用模型和当前状态)
“使用 model_info 工具和 model=sonar-reasoning-pro”(强制使用推理模型)
“寻找勾股定理的数学证明”(将使用 sonar-reasoning-pro)
“使用 model_info 工具和 model=sonar-pro”(返回自动选择)
发展
修改服务器:
编辑
src/index.ts使用
npm run build重建重新启动 Claude 以加载更改
执照
麻省理工学院
Available Tools
6 toolsclear_filtersA
Remove all domain filters (both allowed and blocked). Use when switching search contexts or starting fresh. Does not affect recency filter.
Inputs: no named parameters.
domain_filterA
Configure domain filtering for search results. Use 'allow' to prioritize trusted sources (e.g., documentation sites, academic domains) or 'block' to exclude unreliable sources. Maximum 20 domains total. Filters persist across searches until cleared.
Inputs: domain (required), action (required).
list_filtersA
Display current filter configuration including allowed domains, blocked domains, and active recency setting. Useful for debugging search behavior.
Inputs: no named parameters.
model_infoA
View available Perplexity models and their specializations, or manually override model selection. By default, models are auto-selected based on query intent (research, reasoning, general search).
Inputs: model.
recency_filterA
Control the time window for search results. Essential for time-sensitive queries like news, updates, or recent developments. Filter persists until changed.
Inputs: filter (required).
searchA
Web search via Perplexity AI with automatic model selection. Returns cited sources with summaries. The search uses only the query text (not conversation history). Best for: current events, factual research, technical documentation, comparative analysis.
Inputs: query (required), stream.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: clear_filters removes filters, domain_filter configures domains, list_filters displays current settings, model_info shows models, recency_filter controls time windows, and search performs web searches. The descriptions reinforce these unique roles, making misselection unlikely.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., clear_filters, domain_filter, list_filters, model_info, recency_filter, search). The naming is predictable and readable throughout, with no deviations or mixed conventions.
With 6 tools, this server is well-scoped for its purpose of configuring and executing Perplexity AI searches. Each tool earns its place by covering essential aspects like filtering, model selection, and search execution, without being overly sparse or bloated.
The tool set provides complete coverage for the domain of Perplexity AI search configuration and execution. It includes setup (filters, model info), control (recency, domain filters), status (list_filters), and core functionality (search), with no obvious gaps that would cause agent failures.
Maintenance
Related MCP Connectors
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Web search API and MCP server for developers building AI agents.
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Related MCP Servers
AlicenseAqualityCmaintenanceAn MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.2566MIT- AlicenseAqualityDmaintenanceMCP server that enables Claude to request chat completions with citations from the Perplexity API.1MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that integrates with Sonar API to provide Claude with real-time web search capabilities for comprehensive research.MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to perform web searches on Perplexity.ai using browser automation instead of an official API. It supports persistent authenticated sessions and returns search results along with cited sources directly to the client.380 npm13MIT