Perplexity API Platform MCP Server
Perplexity API 平台 MCP 服务器
这是 Perplexity API 平台的官方 MCP 服务器实现,通过 Sonar 模型和搜索 API 为 AI 助手提供实时网络搜索、推理和研究能力。
可用工具
perplexity_search
使用 Perplexity 搜索 API 进行直接网络搜索。返回带有元数据的排名搜索结果,非常适合查找最新信息。
perplexity_ask
使用 sonar-pro 模型进行实时网络搜索的通用对话式 AI。非常适合快速提问和日常搜索。
perplexity_research
使用 sonar-deep-research 模型进行深入、全面的研究。非常适合彻底的分析和详细的报告。
perplexity_reason
使用 sonar-reasoning-pro 模型进行高级推理和问题解决。非常适合复杂的分析任务。
[!TIP] 可作为 perplexity_reason 和 perplexity_research 的可选参数:
strip_thinking设置为
true可从响应中删除<think>...</think>标签,从而节省上下文 token。默认值:false
Related MCP server: Perplexity Web-Search MCP
配置
获取您的 API 密钥
从 API 门户 获取您的 Perplexity API 密钥
将下方配置中的
your_key_here替换为您的 API 密钥(可选) 设置超时:
PERPLEXITY_TIMEOUT_MS=600000(默认:5 分钟)(可选) 设置自定义基础 URL:
PERPLEXITY_BASE_URL=https://your-custom-url.com(默认:https://api.perplexity.ai)(可选) 设置日志级别:
PERPLEXITY_LOG_LEVEL=DEBUG|INFO|WARN|ERROR(默认:ERROR)
Claude Code
claude mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server或者通过插件安装:
export PERPLEXITY_API_KEY="your_key_here"
claude
# Then run: /plugin marketplace add perplexityai/modelcontextprotocol
# Then run: /plugin install perplexityCodex
codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-serverCursor, Claude Desktop, Kiro, Windsurf 和 VS Code
大多数客户端可以使用相同的 mcpServers 包装器在客户端配置中手动配置(如 Cursor 所示)。如果客户端具有不同的架构,请查看其文档以获取确切的包装器格式。
对于手动设置,这些客户端都使用相同的 mcpServers 结构:
客户端 | 配置文件 |
Cursor |
|
Claude Desktop |
|
Kiro |
|
Windsurf |
|
VS Code |
|
{
"mcpServers": {
"perplexity": {
"command": "npx",
"args": ["-y", "@perplexity-ai/mcp-server"],
"env": {
"PERPLEXITY_API_KEY": "your_key_here"
}
}
}
}代理设置(针对企业网络)
如果您在工作环境中运行此服务器(特别是在公司防火墙或代理之后),您可能需要告诉程序如何通过网络代理发送其互联网流量。请按照以下步骤操作:
1. 获取您的代理详细信息
向您的 IT 部门询问您的 HTTPS 代理地址和端口。
您可能还需要用户名和密码。
2. 设置代理环境变量
对于 Perplexity MCP,最简单且最可靠的方法是使用 PERPLEXITY_PROXY。例如:
export PERPLEXITY_PROXY=https://your-proxy-host:8080如果您的代理需要用户名和密码,请使用:
export PERPLEXITY_PROXY=https://username:password@your-proxy-host:80803. 替代方案:标准环境变量
如果您更喜欢使用标准变量,我们支持 HTTPS_PROXY 和 HTTP_PROXY。
[!NOTE] 服务器按以下顺序检查代理设置:
PERPLEXITY_PROXY→HTTPS_PROXY→HTTP_PROXY。如果未设置任何内容,它将直接连接到互联网。 URL 必须包含https://。典型端口为8080、3128和80。
HTTP 服务器部署
对于云端或共享部署,请以 HTTP 模式运行服务器。
环境变量
变量 | 描述 | 默认值 |
| 您的 Perplexity API 密钥 | 必需 |
| API 请求的自定义基础 URL |
|
| HTTP 服务器端口 |
|
| 要绑定的网络接口 |
|
| CORS 来源(逗号分隔) |
|
Docker
docker build -t perplexity-mcp-server .
docker run -p 8080:8080 -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-serverNode.js
export PERPLEXITY_API_KEY=your_key_here
npm install && npm run build && npm run start:http服务器将可以通过 http://localhost:8080/mcp 访问
故障排除
API 密钥问题:确保
PERPLEXITY_API_KEY设置正确连接错误:检查您的互联网连接和 API 密钥有效性
找不到工具:确保已安装该软件包且命令路径正确
超时错误:对于非常长的研究查询,请将
PERPLEXITY_TIMEOUT_MS设置为更高的值代理问题:验证您的
PERPLEXITY_PROXY或HTTPS_PROXY设置,并确保api.perplexity.ai未被您的防火墙阻止。EOF / 初始化错误:一些严格的 MCP 客户端会失败,因为
npx会将安装消息写入 stdout。使用npx -yq代替npx -y来抑制此输出。
如需支持,请访问 community.perplexity.ai 或 提交问题。
Available Tools
4 toolsperplexity_askAsk PerplexityBRead-only
Engages in a conversation using the Sonar API. Accepts an array of messages (each with a role and content) and returns a chat completion response from the Perplexity model.
| Name | Required | Description | Default |
|---|---|---|---|
| messages | Yes | Array of conversation messages |
Output Schema
| Name | Required | Description |
|---|---|---|
| response | Yes | The response from Perplexity |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate readOnlyHint=true and openWorldHint=true, which the description doesn't contradict. The description adds that it 'engages in a conversation' and uses the 'Sonar API', providing some context beyond annotations, but lacks details on rate limits, authentication needs, or specific behavioral traits like response format or error handling.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded, consisting of two sentences that directly state the tool's action and parameters without unnecessary details. Every sentence contributes essential information, making it efficient and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (a conversational AI tool with one parameter), the description covers the basic purpose and input. With annotations providing safety hints and an output schema presumably detailing the response, the description is reasonably complete, though it could benefit from more behavioral context or sibling differentiation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the single parameter 'messages' fully documented in the schema. The description mentions 'accepts an array of messages (each with a role and content)', which aligns with but doesn't add meaningful semantics beyond the schema, such as usage examples or constraints on message structure.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'engages in a conversation using the Sonar API' and 'returns a chat completion response from the Perplexity model', which specifies the verb (engages/returns) and resource (conversation/response). However, it doesn't explicitly differentiate from sibling tools like perplexity_reason or perplexity_search, which likely have similar conversational purposes but different scopes or behaviors.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings (perplexity_reason, perplexity_research, perplexity_search). It mentions the general action but offers no context about appropriate scenarios, exclusions, or alternatives, leaving the agent to guess based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
perplexity_reasonAdvanced ReasoningBRead-only
Performs reasoning tasks using the Perplexity API. Accepts an array of messages (each with a role and content) and returns a well-reasoned response using the sonar-reasoning-pro model.
| Name | Required | Description | Default |
|---|---|---|---|
| messages | Yes | Array of conversation messages | |
| strip_thinking | No | If true, removes <think>...</think> tags and their content from the response to save context tokens. Default is false. |
Output Schema
| Name | Required | Description |
|---|---|---|
| response | Yes | The response from Perplexity |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate readOnlyHint=true and openWorldHint=true, which the description doesn't contradict. The description adds value by specifying the model (sonar-reasoning-pro) and the purpose (reasoning tasks), but it lacks details on behavioral traits like rate limits, error handling, or response format beyond what annotations provide. No contradiction is present.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded, consisting of two sentences that efficiently convey the core functionality and model used. Every sentence adds value without redundancy, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (reasoning tasks with an API), annotations cover safety (readOnlyHint) and scope (openWorldHint), and an output schema exists, the description is reasonably complete. It specifies the model and purpose, but could improve by differentiating from siblings or adding more context on use cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents the parameters (messages array and strip_thinking boolean). The description adds no additional meaning beyond what's in the schema, such as examples or usage tips for parameters. Baseline 3 is appropriate as the schema handles the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'performs reasoning tasks using the Perplexity API' and 'returns a well-reasoned response using the sonar-reasoning-pro model,' which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like perplexity_ask, perplexity_research, or perplexity_search, leaving some ambiguity about when to choose this tool over others for reasoning tasks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings (perplexity_ask, perplexity_research, perplexity_search). It mentions the model (sonar-reasoning-pro) but doesn't specify use cases, exclusions, or alternatives, leaving the agent without clear context for selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
perplexity_researchDeep ResearchBRead-only
Performs deep research using the Perplexity API. Accepts an array of messages (each with a role and content) and returns a comprehensive research response with citations.
| Name | Required | Description | Default |
|---|---|---|---|
| messages | Yes | Array of conversation messages | |
| strip_thinking | No | If true, removes <think>...</think> tags and their content from the response to save context tokens. Default is false. |
Output Schema
| Name | Required | Description |
|---|---|---|
| response | Yes | The response from Perplexity |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations indicate read-only and open-world hints, which the description doesn't contradict. It adds value by specifying that it 'returns a comprehensive research response with citations', providing context on output behavior. However, it lacks details on rate limits, authentication needs, or response format beyond citations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose, uses two concise sentences with zero waste, and efficiently conveys key information without redundancy. Every sentence earns its place by adding distinct value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of annotations and an output schema, the description is reasonably complete for a research tool. It covers the basic action and output type, though it could benefit from more context on when to use versus siblings or behavioral traits like response structure.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents parameters. The description adds minimal semantics by mentioning 'array of messages' and 'comprehensive research response', but doesn't elaborate on parameter usage beyond what's in the schema. Baseline 3 is appropriate given high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Performs deep research') and resource ('using the Perplexity API'), and distinguishes from siblings by specifying 'deep research' rather than generic queries. However, it doesn't explicitly contrast with 'perplexity_reason' or 'perplexity_search' to fully differentiate purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'perplexity_ask' or 'perplexity_search'. The description mentions 'deep research' but doesn't clarify scenarios or prerequisites for choosing this over sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
perplexity_searchSearch the WebARead-only
Performs web search using the Perplexity Search API. Returns ranked search results with titles, URLs, snippets, and metadata. Perfect for finding up-to-date facts, news, or specific information.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string | |
| max_results | No | Maximum number of results to return (1-20, default: 10) | |
| max_tokens_per_page | No | Maximum tokens to extract per webpage (default: 1024) | |
| country | No | ISO 3166-1 alpha-2 country code for regional results (e.g., 'US', 'GB') |
Output Schema
| Name | Required | Description |
|---|---|---|
| results | Yes | Formatted search results |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, indicating safe, external data access. The description adds valuable behavioral context beyond this by specifying the return format ('ranked search results with titles, URLs, snippets, and metadata') and the tool's strength for 'up-to-date' information, which helps the agent understand output structure and timeliness without contradicting annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured in two sentences: the first states the core functionality and output, and the second provides usage context. Every phrase adds value without redundancy, making it front-loaded and appropriately sized for a search tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity, rich annotations (readOnlyHint, openWorldHint), 100% schema coverage, and the presence of an output schema (implied by context signals), the description is complete enough. It covers purpose, output format, and ideal use cases, leaving technical details to structured fields.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, providing full documentation for all 4 parameters. The description doesn't add any parameter-specific details beyond what the schema already covers, such as explaining how 'country' affects results or typical 'query' formats. This meets the baseline of 3 when schema coverage is high.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Performs web search') and resource ('using the Perplexity Search API'), and distinguishes it from siblings by emphasizing web search functionality rather than conversational or analytical approaches. The phrase 'Perfect for finding up-to-date facts, news, or specific information' further clarifies its distinct use case.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('Perfect for finding up-to-date facts, news, or specific information'), which implicitly suggests it's for factual retrieval rather than reasoning or research tasks handled by siblings. However, it doesn't explicitly name alternatives or state when not to use it, which prevents a perfect score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.6.1- First observed
perplexity_ask - First observed
perplexity_reason - First observed
perplexity_research - First observed
perplexity_search
TDQS
Scored across 4 tools
The tools are mostly distinct with clear primary purposes: 'ask' for general conversation, 'reason' for reasoning tasks, 'research' for deep research with citations, and 'search' for web search results. However, 'ask' and 'reason' could be confused as both involve chat completions with similar inputs, potentially leading to misselection in ambiguous scenarios.
All tool names follow a consistent 'perplexity_' prefix with descriptive suffixes (ask, reason, research, search), using snake_case uniformly. This predictable pattern makes it easy for an agent to understand and navigate the tool set without confusion.
With 4 tools, the count is well-scoped for a server focused on interacting with the Perplexity API. Each tool serves a distinct function (conversation, reasoning, research, search), and there are no redundant or unnecessary tools, making the set efficient and appropriate for the domain.
The tool set covers core functionalities of the Perplexity API, including general chat, reasoning, research, and web search, which aligns well with the server's purpose. A minor gap is the lack of tools for managing conversations (e.g., clearing history or handling follow-ups), but agents can work around this using the provided message arrays.
Maintenance
Related MCP Connectors
Enable AI assistants to perform web searches using Perplexity's Sonar Pro.
Real-time web search, reasoning, and research through Perplexity's API
Give AI assistants access to real-time data. Search the web, compare flights, find hotels, and more.
Agent-native search engine with live web research optimized for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI-powered search, research, and reasoning capabilities through integration with Perplexity.ai, offering three specialized tools: general conversational AI, deep research with citations, and advanced reasoning.18 npm2MIT
- FlicenseBqualityDmaintenanceEnables AI assistants to perform real-time web and academic searches using Perplexity's Sonar API.2-
- AlicenseAqualityDmaintenanceEnables AI assistants to perform web searches and retrieve real-time information using Perplexity AI's Sonar models, with support for multiple search modes and easy integration with MCP clients.51MIT
- AlicenseAqualityCmaintenanceEnables web search and deep research using Perplexity Sonar models through MCP clients like Cursor or Claude Desktop.2MIT