Skip to main content
Glama
nachoal

Perplexity Web Search MCP Server

by nachoal

Perplexity Web 搜索 MCP 服务器

一个简单的 MCP(模型上下文协议)服务器,使用 Perplexity API 提供网页搜索功能。该服务器允许 Claude 或其他兼容 MCP 的 AI 助手搜索网页并获取最新信息。

特征

  • 使用 Perplexity 强大的搜索功能搜索网络

  • 获得包含来源和引文的全面搜索结果

  • 按时间段(日、周、月、年)过滤结果

  • 包含一个可立即使用的网页搜索提示模板

  • 支持从环境变量或.env 文件加载 API 密钥

Related MCP server: Perplexity MCP Server

安装

  1. 克隆此存储库

  2. 安装依赖项:

    pip install -e .

    或者

    uv pip install -e .

配置

您可以使用 Perplexity API 密钥设置PERPLEXITY_API_KEY环境变量:

export PERPLEXITY_API_KEY="your-api-key-here"

或者,您可以在项目根目录中创建一个包含以下内容的.env文件:

PERPLEXITY_API_KEY=your-api-key-here

提供了一个示例.env.example文件以供参考。

获取 Perplexity API 密钥:

  1. 访问Perplexity API 设置

  2. 如果您没有帐户,请创建一个

  3. 生成 API 密钥

用法

运行服务器

python server.py

测试服务器

您可以使用附带的测试脚本来测试服务器功能,而无需运行完整的 MCP 服务器:

python test_server.py "your search query here" --recency month

--recency的选项有:天、周、月(默认)、年

与 Claude Desktop 一起使用

  1. 编辑您的 Claude Desktop 配置文件:

    • 在 macOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json

    • 在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

  2. 添加以下配置:

    {
      "perplexity-mcp": {
        "env": {
          "PERPLEXITY_API_KEY": "your-api-key-here"
        },
        "command": "python",
        "args": [
          "/path/to/server.py"
        ]
      }
    }
  3. 重启Claude桌面

克劳德的示例提示

  • “在网上搜索有关人工智能的最新消息”

  • “使用 Perplexity 查找过去一周发布的有关气候变化的信息”

  • “搜索过去一个月有关量子计算的最新研究论文”

API 参考

工具: search_web(query: str, recency: str = "month") -> str

使用 Perplexity API 搜索网络并返回结果。

参数:

  • query :搜索查询字符串

  • recency :按时间段过滤结果 - “天”、“周”、“月”(默认)或“年”

**返回:**包含以下内容的综合文本响应:

  1. 搜索结果的详细摘要

  2. 发现的关键事实和信息

  3. 带有 URL 的来源以供验证

  4. 任何有冲突的信息(如有)

提示: web_search_prompt(query: str, recency: str = "month") -> str

创建使用 Perplexity 搜索网络的提示模板。

参数:

  • query :搜索查询

  • recency :时间段过滤器 - ‘天’、‘周’、‘月’(默认)或‘年’

**返回:**格式化的提示字符串,指示 AI 执行以下操作:

  1. 搜索指定查询

  2. 关注特定时间段内的结果

  3. 总结主要发现

  4. 突出重要事实

  5. 提及相互矛盾的信息

  6. 引用来源并附链接

执照

麻省理工学院

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Facilitates web search capabilities using Perplexity's API, allowing users to retrieve search results through Claude's interface.
    1
    7
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables web search functionality through Perplexity AI's API with time-based filtering options. Allows users to search the web for recent information within specified time periods (day, week, month, or year).
    1
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables web search using Perplexity AI's API, allowing users to search the web with optional recency filters and integration with Claude, Cursor, and other MCP clients.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables 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.
    5
    1
    MIT

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/nachoal/perplexity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server