Perplexity Agent MCP
这是一个专为编码优化的 Model Context Protocol (MCP) 服务器,旨在将 Perplexity AI 的 Sonar 模型集成到 Claude Code 或 Codex CLI 等 AI 编码助手中。它设计精简,仅向你的上下文添加极少量的 token。它提供了两个专用工具——用于快速核查 API 语法和文档细节的 lookup,以及用于进行综合研究并提供可操作建议的 answer。
设置
全局安装已发布的包:
npm install -g perplexity-agent-mcp然后将其添加到你的 Claude 配置文件(~/.claude.json 或 ~/.config/claude/config.json)中:
"mcpServers": {
"perplexity": {
"command": "perplexity-agent-mcp",
"env": {
"PERPLEXITY_API_KEY": "your-api-key-here"
}
}
}保存后重启 Claude Code,即可开始使用。
工作原理
该服务器仅公开两个带有简洁描述(约 1.3K token)的工具,从而保持你的上下文窗口精简高效:
lookup:从文档中获取快速事实(如 API 语法或配置键)
answer:进行更深入的研究以比较选项并提供建议
在底层,这两个工具都是经过精心设计的封装器,使用针对编码优化的系统提示词调用 Perplexity API。lookup 工具使用专注于代码/文档事实的紧凑型事实提取提示词(参见 src/index.ts 中的 LOOKUP_SYSTEM_PROMPT)。answer 工具使用针对迁移和架构选择量身定制的技术决策/分析提示词(参见 src/index.ts 中的 ANSWER_SYSTEM_PROMPT)。服务器还会选择适合任务的 Perplexity 模型——用于查找的 sonar-pro(参见 src/index.ts 中的 getLookupModel())以及用于更深入研究的 sonar-reasoning-pro(参见 src/index.ts 中的 getAnswerModel())。
触发 AI 代理使用此 MCP 并获得良好结果的示例提示词:
Please update the "foo" dependency to the latest version. Use Perplexity for the migration guide.要求
Node.js v22.19.0 或更高版本
Perplexity API 密钥
测试钩子
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jercik/perplexity-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
