remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Supports loading API keys from .env files, providing a secure way to configure the server without hardcoding sensitive information.
Includes specific configuration instructions for Claude Desktop on macOS, detailing the path to the configuration file.
Provides web search functionality through Perplexity's API, allowing for comprehensive search results with sources and citations, and filtering by time period (day, week, month, year).
Perplexity Web 搜索 MCP 服务器
一个简单的 MCP(模型上下文协议)服务器,使用 Perplexity API 提供网页搜索功能。该服务器允许 Claude 或其他兼容 MCP 的 AI 助手搜索网页并获取最新信息。
特征
- 使用 Perplexity 强大的搜索功能搜索网络
- 获得包含来源和引文的全面搜索结果
- 按时间段(日、周、月、年)过滤结果
- 包含一个可立即使用的网页搜索提示模板
- 支持从环境变量或.env 文件加载 API 密钥
安装
- 克隆此存储库
- 安装依赖项:或者CopyCopy
配置
您可以使用 Perplexity API 密钥设置PERPLEXITY_API_KEY
环境变量:
或者,您可以在项目根目录中创建一个包含以下内容的.env
文件:
提供了一个示例.env.example
文件以供参考。
获取 Perplexity API 密钥:
- 访问Perplexity API 设置
- 如果您没有帐户,请创建一个
- 生成 API 密钥
用法
运行服务器
测试服务器
您可以使用附带的测试脚本来测试服务器功能,而无需运行完整的 MCP 服务器:
--recency
的选项有:天、周、月(默认)、年
与 Claude Desktop 一起使用
- 编辑您的 Claude Desktop 配置文件:
- 在 macOS 上:
~/Library/Application\ Support/Claude/claude_desktop_config.json
- 在 Windows 上:
%APPDATA%/Claude/claude_desktop_config.json
- 在 macOS 上:
- 添加以下配置:Copy
- 重启Claude桌面
克劳德的示例提示
- “在网上搜索有关人工智能的最新消息”
- “使用 Perplexity 查找过去一周发布的有关气候变化的信息”
- “搜索过去一个月有关量子计算的最新研究论文”
API 参考
工具: search_web(query: str, recency: str = "month") -> str
使用 Perplexity API 搜索网络并返回结果。
参数:
query
:搜索查询字符串recency
:按时间段过滤结果 - “天”、“周”、“月”(默认)或“年”
**返回:**包含以下内容的综合文本响应:
- 搜索结果的详细摘要
- 发现的关键事实和信息
- 带有 URL 的来源以供验证
- 任何有冲突的信息(如有)
提示: web_search_prompt(query: str, recency: str = "month") -> str
创建使用 Perplexity 搜索网络的提示模板。
参数:
query
:搜索查询recency
:时间段过滤器 - ‘天’、‘周’、‘月’(默认)或‘年’
**返回:**格式化的提示字符串,指示 AI 执行以下操作:
- 搜索指定查询
- 关注特定时间段内的结果
- 总结主要发现
- 突出重要事实
- 提及相互矛盾的信息
- 引用来源并附链接
执照
麻省理工学院
This server cannot be installed
允许 Claude 或其他与 MCP 兼容的 AI 助手使用 Perplexity API 搜索网络并获取最新信息,并具有按时间段过滤结果的功能。