这是一个借助 Perplexity AI 的 API 来提供智能代码分析与调试功能的 Model Context Protocol (MCP) 服务器,它能够与 Claude 桌面客户端实现无缝集成。
你可以询问如下问题:
同时,要包含你的代码片段以进行针对性分析:
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)
服务器将提供以下内容:
# 使用 npm
npm install -g perplexity-mcp
# 或直接使用仓库
npm install -g git+https://github.com/yourusername/perplexity-mcp.git
git clone https://github.com/yourusername/perplexity-server.git
cd perplexity-server
npm install
npm run build
npm install -g .
将以下内容添加到你的 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 检查器以进行调试git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)此项目根据 MIT 许可证发布,详细信息请参见 LICENSE 文件。