返回市场
麦普困惑服务器

麦普困惑服务器

作者:PoliTwit198413 星标更新:2025-01-06

项目介绍

Perplexity MCP 服务器

这是一个使用 Perplexity AI 的 API 提供智能代码分析和调试功能的 Model Context Protocol (MCP) 服务器。它与 Claude 桌面客户端无缝集成。

<a href="https://glama.ai/mcp/servers/oxchzx8c75"><img width="380" height="200" src="https://gips2.baidu.com/it/u=2147014135,1844169179&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Perplexity Server MCP 服务器" /></a>

功能

  • 智能错误分析:详细分解编码错误并进行根本原因分析
  • 模式检测:自动识别常见错误模式并提供针对性解决方案
  • 全面解决方案:逐步修复并提供多种实现方案
  • 最佳实践:包含编码标准和错误预防技巧
  • Python 支持:专门处理 Python 类型错误和常见编码问题

示例用法

可以提出如下问题:

  • "修复我的 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 安装(推荐)

# 使用 npm
npm install -g perplexity-mcp

# 或者直接使用仓库
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 桌面配置文件中
  • 密钥作为环境变量传递给服务器
  • 不在仓库中存储任何敏感数据
  • 服务器期望 API 密钥由 Claude 环境提供

开发

项目结构

perplexity-server/
├── src/
│   └── index.ts      # 主服务器实现
├── package.json      # 项目配置
└── tsconfig.json    # TypeScript 配置

可用脚本

  • 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 文件。

致谢