PoliTwit1984_mcp Perplexity Server

PoliTwit1984_mcp Perplexity Server

🚀 perplexity MCP 服务器

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

✨ 主要特性

  • 智能错误分析:对编码错误进行详细拆解,并给出根本原因分析。
  • 模式检测:自动识别常见的错误模式,同时提供有针对性的解决方案。
  • 全面解决方案:提供分步骤的修复方法,其中包含多种实现替代方案。
  • 最佳实践:涵盖编码标准以及错误预防技巧。
  • 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"
}
}
}
}

🔧 技术细节

项目结构

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

致谢

  • 0 关注
  • 0 收藏,20 浏览
  • system 提出于 2025-10-02 23:12

相似服务问题

相关AI产品