Skip to main content
Glama

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 AI 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 服务器

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

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/TheoLawrence86/perplexity-insight-MCP'

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