Skip to main content
Glama

Perplexity MCP 服务器

模型上下文协议 (MCP) 服务器,使用 Perplexity AI 的 API 提供智能代码分析和调试功能。可与 Claude 桌面客户端无缝协作。

特征

  • 智能错误分析:通过根本原因分析对编码错误进行详细细分

  • 模式检测:自动识别常见错误模式并提供有针对性的解决方案

  • 全面的解决方案:通过多种实施方案逐步修复

  • 最佳实践:包括编码标准和错误预防技巧

  • Python 支持:专门处理 Python 类型错误和常见编码问题

Related MCP server: MCP Code Analyzer

示例用法

提出以下问题:

  • “修复我的 Python 代码中的这个 TypeError”

  • “是什么导致了这个错误信息?”

  • “我该如何修复这个代码?”

包含您的代码片段以进行有针对性的分析:

def calculate_total(items):
    total = 0
    for item in items:
        total = total + item['price']  # TypeError: string + int

data = [
    {'name': 'Book', 'price': '10'},
    {'name': 'Pen', 'price': '2'}
]

result = calculate_total(data)

服务器将提供:

  1. 错误根本原因分析

  2. 带有代码示例的分步解决方案

  3. 防止类似问题的最佳实践

  4. 替代实施方法

安装

先决条件

  • Node.js 18 或更高版本

  • Perplexity AI API 密钥

选项 1:从 npm 安装(推荐)

# Using npm
npm install -g perplexity-mcp

# Or using the repository directly
npm install -g git+https://github.com/yourusername/perplexity-mcp.git

选项 2:从源安装

  1. 克隆存储库:

git clone https://github.com/yourusername/perplexity-server.git
cd perplexity-server
  1. 安装依赖项:

npm install
  1. 全局构建和安装:

npm run build
npm install -g .

配置 Claude 桌面

添加到您的 Claude 桌面配置文件:

MacOS~/Library/Application Support/Claude/claude_desktop_config.json Windows%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "perplexity": {
      "command": "perplexity-mcp",
      "args": [],
      "env": {
        "PERPLEXITY_API_KEY": "your-api-key-here"
      }
    }
  }
}

或者如果从源安装:

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": ["/absolute/path/to/perplexity-server/build/index.js"],
      "env": {
        "PERPLEXITY_API_KEY": "your-api-key-here"
      }
    }
  }
}

安全

  • API 密钥安全地存储在 Claude 的桌面配置文件中

  • 该密钥作为环境变量传递给服务器

  • 存储库中不存储任何敏感数据

  • 服务器需要 Claude 的环境提供 API 密钥

发展

项目结构

perplexity-server/
├── src/
│   └── index.ts      # Main server implementation
├── package.json      # Project configuration
└── tsconfig.json    # TypeScript configuration

可用脚本

  • npm run build :构建项目

  • npm run watch :监视更改并自动重建

  • npm run prepare :准备发布的包

  • npm run inspector :运行 MCP 检查器进行调试

贡献

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature

  3. 提交您的更改( git commit -m 'Add some amazing feature'

  4. 推送到分支( git push origin feature/amazing-feature

  5. 打开拉取请求

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

-
security - not tested
A
license - permissive license
-
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/PoliTwit1984/mcp-perplexity-server'

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