Skip to main content
Glama
Perplexity Insight MCP Server

Perplexity Insight MCP Server

Perplexity Insight MCP 服务器

MCP 服务器实现与 Perplexity AI API 交互,通过标准化模型上下文协议提供高级问答功能。

特征

  • 与 Perplexity AI API 无缝集成

  • 支持不同的困惑度模型(sonar-reasoning、sonar-pro、sonar-deep-research)

  • 可定制的系统提示和用户查询

  • 正确的错误处理和响应格式

  • 速率限制保护

  • 轻松与 Windsurf IDE 集成

Related MCP server: Perplexity MCP Server

要求

  • Node.js 18+

  • Perplexity API 密钥

安装

npm install

环境变量

使用以下变量创建.env文件:

PERPLEXITY_API_KEY=your_api_key_here

用法

运行服务器:

npm start

API 工具

该服务器公开以下工具:

  1. perplexity_ask - 向 Perplexity AI 直接提问

  2. perplexity_search - 使用 Perplexity AI 执行搜索查询

改变模型

两种工具都支持以下困惑度模型:

  • sonar-reasoning (默认) - Perplexity 的推理模型,最适合一般问题

  • sonar-pro - 增强型模型,具有针对专业用例的改进功能

  • sonar-deep-research - 专门用于深入研究和复杂查询

要在使用工具时指定模型,请在请求中包含model参数:

Ask Perplexity using sonar-deep-research: What are the latest advancements in quantum computing?

您还可以自定义系统提示和最大令牌数:

Search with Perplexity using sonar-pro with system prompt "You are a helpful research assistant" and max tokens 2000: Latest developments in renewable energy

工具响应格式

服务器遵循 MCP 工具响应规范:

{
  content: [
    {
      type: "text",
      text: "Response content from Perplexity AI"
    }
  ],
  isError: false // or true if an error occurred
}

风帆冲浪整合

在 Windsurf 中设置

  1. 构建服务器:

    npm run build
  2. 打开 Windsurf 并导航至“设置”

  3. 找到“AI 设置”或“模型上下文协议”部分

  4. 添加新的 MCP 服务器,其详细信息如下:

    • 名称:困惑洞察

    • 类型:本地流程

    • 命令:Node.js 可执行文件的路径

    • 参数:已编译index.js文件的路径

    • 工作目录:项目目录的路径

    • 环境变量:确保包含PERPLEXITY_API_KEY=your_api_key_here

  5. 启用服务器并重新启动 Windsurf(如有必要)

示例配置

以下是mcp_config.json文件的示例配置:

"perplexity-ask": {
  "command": "node",
  "args": [
    "/path/to/perplexity-insight-MCP/dist/index.js"
  ],
  "cwd": "/path/to/perplexity-insight-MCP",
  "env": {
    "PERPLEXITY_API_KEY": "pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}

将/path/to/perplexity-insight-MCP替换为安装目录的实际路径,并使用实际的 Perplexity API 密钥。

在 Windsurf 中使用 Perplexity

  • 使用 AI 助手面板提出问题,这些问题将被引导至 Perplexity

  • 对于网络搜索,请在查询中包含“搜索”等特定术语

  • 要更改模型,请在查询中包含模型名称,如“更改模型”部分所示

  • Windsurf 将根据您的查询自动使用适当的 Perplexity 工具

发展

对于本地开发:

npm run dev

故障排除

如果您遇到 MCP 服务器问题:

  1. 检查您的 API 密钥是否有效并在.env文件中正确设置

  2. 验证响应格式是否符合 MCP 规范

  3. 在服务器日志中查找任何错误消息

  4. 确保 Windsurf 已正确配置以使用 MCP 服务器

执照

麻省理工学院

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    A Node.js implementation that enables Claude to interact with Perplexity AI's language models through Anthropic's Model Context Protocol, providing tools for advanced chat completions and quick queries.
    2
    71 npm
    6
    Apache 2.0
  • A
    license
    Not graded
    quality
    F
    maintenance
    A custom Model Context Protocol implementation that integrates Perplexity AI with Claude Desktop, allowing users to access Perplexity's AI models for both single questions and multi-turn conversations.
    35 npm
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    An Apify Actor implementing the Model Context Protocol for Perplexity API, enabling AI assistants to search and access information through a standardized interface.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides a Python-based interface to the Perplexity API for querying responses, maintaining chat history, and managing conversations. It enables models to ask questions, continue conversations, and list chats through Perplexity AI.
    MIT