Prerequisites
Before you begin, ensure you have:- Node.js 18 or higher installed on your system
- A Perplexity API key (we’ll get this in the next step)
- An MCP-compatible client installed (Cursor, Claude Desktop, VS Code, etc.)
Get Your API Key
Access the API Portal
Navigate to the Perplexity API Portal and sign in to your account.
Generate API Key
Create a new API key from the portal. Keep this key secure - you’ll need it for configuration.
Installation Methods
The Perplexity MCP Server can be installed using npm or run directly with npx (recommended):Environment Variables
The server supports several environment variables for configuration:| Variable | Description | Default | Required |
|---|---|---|---|
PERPLEXITY_API_KEY | Your Perplexity API key | - | Yes |
PERPLEXITY_TIMEOUT_MS | Request timeout in milliseconds | 300000 (5 min) | No |
PERPLEXITY_BASE_URL | Custom API base URL | https://api.perplexity.ai | No |
PERPLEXITY_LOG_LEVEL | Logging level (DEBUG, INFO, WARN, ERROR) | ERROR | No |
PERPLEXITY_PROXY | Proxy URL for corporate networks | - | No |
Client Configuration
Choose your MCP client below for specific configuration instructions:One-Click Installation
For the fastest setup, use the one-click install buttons:- Cursor: Install in Cursor
- VS Code: Install in VS Code
Manual Configuration
- Cursor
- VS Code
- Claude Desktop
- Claude Code
- Windsurf
- Codex
Add to
~/.cursor/mcp.json:Replace
your_key_here with your actual Perplexity API key in all configuration examples.Verification
After installation, verify the server is working:Restart Your Client
Close and reopen your MCP client (Cursor, VS Code, etc.) to load the new configuration.
Check Available Tools
Look for the Perplexity tools in your client’s tool list. You should see:
perplexity_searchperplexity_askperplexity_researchperplexity_reason
Troubleshooting
API Key Issues
EnsurePERPLEXITY_API_KEY is set correctly in your configuration file. The key should be from the Perplexity API Portal.
Connection Errors
Check your internet connection and verify your API key is valid. You can test the key directly via the Perplexity API.Tool Not Found
Make sure the package path is correct in your configuration. Usenpx -y @perplexity-ai/mcp-server for automatic version management.
EOF / Initialize Errors
Some strict MCP clients fail becausenpx writes installation messages to stdout. Use npx -yq instead of npx -y to suppress this output:
Timeout Errors
For very long research queries, increase the timeout:Proxy Configuration
If you’re behind a corporate firewall or proxy, configure the proxy settings:The server checks proxy settings in this order:
PERPLEXITY_PROXY → HTTPS_PROXY → HTTP_PROXY. If none are set, it connects directly.Next Steps
Quick Start Guide
Learn how to use the tools effectively
Tools Reference
Explore all available tools and their parameters