mcp-perplexity
A Model Context Protocol (MCP) server for intelligent code analysis and debugging using Perplexity AI’s API, seamlessly integrated with the Claude desktop client.
claude mcp add --transport stdio politwit1984-mcp-perplexity-server npx -y perplexity-mcp \ --env PERPLEXITY_API_KEY="your-api-key-here"
How to use
The Perplexity MCP Server provides intelligent code analysis and debugging capabilities via Perplexity AI's API, designed to work with the Claude desktop client. It specializes in Python error analysis, pattern detection for common coding issues, and delivering step-by-step fixes with alternative implementations. With this MCP server, you can paste or provide your code snippets, and the server will return root-cause analysis, recommended remedies, and best practices to prevent similar errors in the future. The toolset is tailored for developers seeking quick diagnostics and robust guidance on type errors, runtime errors, and coding pattern issues across languages, with particular emphasis on Python type errors and common Python coding problems.
To use the server, configure Claude or your MCP client to point to the Perplexity MCP server (via the provided command and environment variable for authentication). You’ll typically run the server locally or in your environment, supplying your Perplexity API key through the PERPLEXITY_API_KEY environment variable. Then, submit questions like “Fix this TypeError in my Python code” or “What’s causing this error message?” and include your code snippet. The server will respond with:
- Root cause analysis of the error
- Step-by-step solution with code examples
- Best practices to prevent similar issues
- Alternative implementation approaches
How to install
Prerequisites
- Node.js 18 or higher
- A Perplexity AI API key (for server authentication)
Option 1: Install from npm (Recommended)
- Install globally:
npm install -g perplexity-mcp
- Run the MCP server (example):
npx -y perplexity-mcp
Option 2: Install from Source
- Clone the repository:
git clone https://github.com/yourusername/perplexity-server.git
cd perplexity-server
- Install dependencies:
npm install
- Build and install globally:
npm run build
npm install -g .
Configure Claude Desktop (for integration)
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Example Claude config (installed from npm):
{
"mcpServers": {
"perplexity": {
"command": "perplexity-mcp",
"args": [],
"env": {
"PERPLEXITY_API_KEY": "your-api-key-here"
}
}
}
}
Example Claude config (installed from source):
{
"mcpServers": {
"perplexity": {
"command": "node",
"args": ["/absolute/path/to/perplexity-server/build/index.js"],
"env": {
"PERPLEXITY_API_KEY": "your-api-key-here"
}
}
}
}
Additional notes
Environment and configuration tips:
- Always provide PERPLEXITY_API_KEY in the environment to authorize requests to Perplexity AI.
- If running via npm npx, ensure network access to fetch the perplexity-mcp package when first starting.
- When integrating with Claude Desktop, use the recommended config and restart Claude after updating the MCP server settings.
- The server is designed to handle Python-specific issues but can also assist with general coding errors and debugging workflows. If you see API limits or latency, consider caching frequent queries or adjusting rate limits in your environment.
Related MCP Servers
any-chat-completions
MCP Server for using any LLM as a Tool
unity-editor
An MCP server and client for LLMs to interact with Unity Projects
website-publisher
AI Website builder and publisher MCP. Quickly publish and deploy your AI generated code as real website URL. Support html, css, js, python etc.
perplexity-web-api
🔍 Perplexity AI MCP without API key
mcp-deep-search
Runs a search across all major providers simultaneously
mcp-perplexity-search
🔎 A Model Context Protocol (MCP) server for integrating Perplexity's AI API with LLMs.