搜索研究服务器

Perplexity MCP服务器提供基于Perplexity AI的网页搜索和研究功能,所有工具直接从Perplexity API返回JSON响应。

  • by format37
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 format37/mcp-perplexity

使用说明

困惑度MCP服务器

MCP服务器提供由Perplexity AI驱动的网页搜索和研究功能。所有工具均直接从Perplexity API返回JSON响应。

可用工具

基本工具

  • save_tool_notes - 保存任何MCP工具的使用说明
  • read_tool_notes - 阅读该工具的历史备注

困惑度搜索工具

  • perplexity_sonar - 快速搜索并引用(128K上下文)
  • perplexity_sonar_pro - 高级搜索,结果数量翻倍(20万条上下文信息)
  • perplexity_sonar_reasoning - 带有CoT分析的快速推理(128K上下文)
  • perplexity_sonar_reasoning_pro - 高级推理,结果数量翻倍(128K上下文)
  • perplexity_sonar_deep_research - 对数百个来源进行了详尽的研究(支持 reasoning_effort 参数)

安装

要求

  • Docker 和 Docker Compose
  • 来自https://www.perplexity.ai/settings/api的Perplexity API密钥

配置

创造 .env.local:

PERPLEXITY_API_KEY=your_perplexity_api_key_here
MCP_NAME=perplexity
PORT=8011
CONTAINER_NAME=mcp-perplexity-local

跑步

# Start server
./compose.local.sh

# View logs
./logs.sh

# Stop server
docker compose -f docker-compose.local.yml down

服务器运行于 http://localhost:8011/perplexity/

Claude 桌面版安装

添加到Claude桌面配置中:

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:8011/perplexity/"]
    }
  }
}

响应格式

所有工具返回的JSON包含:

  • choices[0].message.content - 人工智能回复文本
  • citations - 来源URL
  • search_results - 搜索元数据
  • usage - 代币数量和成本

发展

项目结构

backend/
├── main.py              # Main MCP server
├── mcp_service.py       # Core utilities
├── mcp_resources.py     # Documentation
└── requirements.txt     # Dependencies

添加工具

  1. 实施于 backend/
  2. 注册于 backend/main.py
  3. 更新文档中的内容 backend/mcp_resources.py

许可证

麻省理工学院(MIT)