Perplexity MCP Server
Provides AI-powered web search, deep research, reasoning, brainstorming, code review, explanations, and file analysis with real-time web grounding and citations using Perplexity's Sonar, Sonar Pro, Sonar Reasoning Pro, and Sonar Deep Research models.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Perplexity MCP Server ask perplexity about the latest advancements in AI"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Perplexity MCP Server
MCP server that brings Perplexity to Claude Code — AI-powered web search, deep research, reasoning, brainstorming, code review, explanations, and file analysis. All with real-time web grounding and citations. Supports Sonar, Sonar Pro, Sonar Reasoning Pro, and Sonar Deep Research models.
Quick Start
Step 1: Get Your API Key
Go to Perplexity API Settings
Create an account or sign in
Generate an API key
Copy the key (you'll need it in Step 3)
Step 2: Install Prerequisites
Node.js 18+ - Download here
Claude Code CLI - Installation guide
Step 3: Install the MCP Server
3.1 Clone the repository
git clone https://github.com/wynandw87/claude-code-perplexity-mcp.git
cd claude-code-perplexity-mcp3.2 Install dependencies
macOS / Linux / Windows:
npm installNote: Dependencies are installed and the server is built automatically in one step.
3.3 Register with Claude Code
Choose your install scope:
Scope | Flag | Who can use it |
User (recommended) |
| You, in any project |
Project |
| Anyone who clones this repo |
Local |
| Only in current directory |
Replace YOUR_API_KEY with your actual Perplexity API key, and use the full path to dist/index.js.
Tip: To get the full path, run this from the cloned directory:
macOS/Linux:
echo "$(pwd)/dist/index.js"Windows:
echo %cd%\dist\index.js
macOS / Linux:
claude mcp add -s user Perplexity -e PERPLEXITY_API_KEY=YOUR_API_KEY -- node /full/path/to/dist/index.jsWindows (CMD):
claude mcp add -s user Perplexity -e "PERPLEXITY_API_KEY=YOUR_API_KEY" -- node "C:\full\path\to\dist\index.js"Windows (PowerShell):
claude mcp add -s user Perplexity -e "PERPLEXITY_API_KEY=YOUR_API_KEY" '--' node "C:\full\path\to\dist\index.js"Alternative: Use Setup Scripts
The setup scripts handle dependency installation, building, and registration automatically.
macOS / Linux:
chmod +x setup.sh
./setup.sh YOUR_API_KEYWindows (PowerShell):
.\setup.ps1 -ApiKey YOUR_API_KEYOr use the npm helper (if API key is set in environment):
export PERPLEXITY_API_KEY=YOUR_API_KEY
npm run install:claudeStep 4: Restart Claude Code
Close and reopen Claude Code for the changes to take effect.
Step 5: Verify Installation
claude mcp listYou should see Perplexity listed with a Connected status.
Related MCP server: Perplexity MCP Server
Features
Search & Research
Web Search (
search_web) - AI-powered web search with domain filtering, recency filtering, and detailed citationsDeep Research (
deep_research) - Exhaustive multi-step research using sonar-deep-researchReasoning + Search (
search_with_reasoning) - Step-by-step reasoning combined with live web searchRaw Search (
search) - Ranked search results with titles, URLs, and snippets
Text & Analysis
General Queries (
ask) - Web-grounded Q&A with automatic citationsBrainstorming (
brainstorm) - Creative ideation informed by real-time web dataCode Review (
code_review) - Code analysis with web-grounded best practicesExplanations (
explain) - Clear concept explanations with web-grounded accuracy
Files
File Upload (
upload_file) - Upload documents and images for analysis (text files, images)
Usage
Once installed, use trigger phrases to invoke Perplexity:
Trigger | Tool | Example |
| Ask | "ask perplexity about quantum computing" |
| Web Search | "perplexity search: latest React 19 features" |
| Deep Research | "perplexity deep research on Rust vs Go for microservices" |
| Reasoning | "perplexity reason about RSC vs traditional SSR performance" |
| Raw Search | "perplexity raw search for MCP server TypeScript examples" |
| Code Review | "perplexity review this function for security" |
| Brainstorm | "perplexity brainstorm ideas for authentication" |
| Explain | "perplexity explain how WebSockets work" |
| Upload File | "perplexity upload ./report.py and review it" |
Or ask naturally:
"Ask Perplexity what the latest best practices are for Next.js"
"Have Perplexity review this code for security issues"
"Brainstorm with Perplexity about scaling strategies"
"Perplexity search the web for the latest news on AI"
"Do a deep research with Perplexity on the state of WebAssembly"
"Perplexity reason through the tradeoffs of microservices vs monolith"
"Upload this CSV to Perplexity and ask it to summarize the data"
Tool Reference
ask
Query Perplexity with web-grounded answers and citations.
Parameters:
prompt(string, required) - The question or instructionmodel(string, optional) - Model identifier (defaults tosonar-pro)search(boolean, optional) - Enable web search grounding (default:true)
search_web
Search the web with domain and recency filtering. Best-in-class AI search.
Parameters:
query(string, required) - The search query or questionallowed_domains(string[], optional) - Only include results from these domains (max 5)excluded_domains(string[], optional) - Exclude these domains from search (max 5)recency(string, optional) -"hour","day","week","month"detail(string, optional) - Search depth:"low","medium","high"
deep_research
Conduct exhaustive, multi-step research on a topic. May take 30-60+ seconds.
Parameters:
query(string, required) - The research question or topic to investigate
search_with_reasoning
Step-by-step reasoning combined with live web search.
Parameters:
prompt(string, required) - The question or problem requiring deep reasoningallowed_domains(string[], optional) - Only include results from these domains (max 5)recency(string, optional) -"hour","day","week","month"
search
Get raw ranked search results without AI synthesis.
Parameters:
query(string, required) - The search querymax_results(integer, optional) - Number of results (1-50, default: 10)domain_filter(string[], optional) - Filter to these domains only (max 5)recency(string, optional) -"hour","day","week","month"
code_review
Code review with web-grounded current best practices.
Parameters:
code(string, required) - The code to reviewfocus(string, optional) - Specific focus area (e.g., "security", "performance")
brainstorm
Brainstorming informed by real-time web data and current trends.
Parameters:
topic(string, required) - The subject to brainstorm aboutcontext(string, optional) - Additional context
explain
Clear explanations with web-grounded accuracy.
Parameters:
concept(string, required) - What to explain
upload_file
Upload a document or image for analysis.
Parameters:
file_path(string, required) - Absolute path to the file to uploadquery(string, optional) - Question to ask about the file immediately after uploadmodel(string, optional) - Model identifier (defaults tosonar-pro)
Supports text files (.txt, .md, .py, .js, .ts, .csv, .json, etc.) and images (.png, .jpg, .gif, .webp).
Supported Models
Model | Best For |
| Quick queries, summaries — fast and cost-effective |
| Default — complex queries, citations, multi-step reasoning |
| Multi-step reasoning with live web search |
| Exhaustive research, comprehensive reports |
All models have 128K context windows and real-time web grounding.
Configuration
Environment Variables
Variable | Required | Default | Description |
| Yes | — | Perplexity API key |
| No |
| Default model for text tools |
| No |
| API timeout in ms |
How It Works
This MCP server uses the Perplexity REST API directly (Chat Completions and Search endpoints) with native fetch. No SDK dependency — just @modelcontextprotocol/sdk and zod. It connects to Claude Code via stdio transport.
Tools provided:
Tool | API | Default Model |
| Chat Completions | Configurable ( |
| Chat Completions + domain/recency filters |
|
| Chat Completions |
|
| Chat Completions |
|
| Search API | — |
| Chat Completions |
|
| Chat Completions |
|
| Chat Completions |
|
| Chat Completions (inline/vision) | Configurable ( |
Troubleshooting
Fix API Key
If you entered the wrong API key, remove and reinstall:
claude mcp remove PerplexityThen reinstall using the command from Step 3.3 above (use the same scope you originally installed with).
MCP Server Not Showing Up
Check if the server is installed:
claude mcp listIf not listed, follow Step 3 to install it.
Server Won't Start
Verify your API key is valid at Perplexity API Settings
Check Node.js version (needs 18+):
node --versionEnsure the server was built — if
dist/index.jsis missing, runnpm installagain
Connection Errors
Check that
dist/index.jsexists — if not, runnpm installVerify the path is absolute in your
claude mcp addcommandRestart Claude Code after any configuration changes
Timeout Errors
Deep research uses 5x base timeout — it's expected to take longer
Reasoning and search tools use 3x base timeout
Increase
PERPLEXITY_TIMEOUTenvironment variable for slow connections
Deep Research Takes Too Long
sonar-deep-research can take 30-60+ seconds for comprehensive research. This is normal — it's doing multi-step investigation across many sources.
View Current Configuration
claude mcp listContributing
Pull requests welcome! Please keep it simple and beginner-friendly.
License
MIT
Made for the Claude Code community
Available Tools
9 toolsaskA
Ask Perplexity a question with real-time web-grounded answers and citations. Trigger: 'use perplexity', 'ask perplexity', or 'perplexity:' followed by a question.
Inputs: prompt (required), model, search.
brainstormB
Brainstorm solutions with Perplexity, informed by real-time web data and current trends. Trigger: 'perplexity brainstorm', 'brainstorm with perplexity', or 'perplexity ideas'.
Inputs: topic (required), context.
code_reviewB
Have Perplexity review code with web-grounded best practices and current documentation. Trigger: 'perplexity review', 'perplexity code review', or 'have perplexity review'.
Inputs: code (required), focus.
deep_researchA
Conduct deep, exhaustive research on a topic using Perplexity's sonar-deep-research model. Best for comprehensive analysis, literature reviews, and multi-source synthesis. May take longer. Trigger: 'perplexity research', 'perplexity deep research', or 'deep research with perplexity'.
Inputs: query (required).
explainB
Clear explanations of concepts, code, or technical topics using Perplexity with web-grounded accuracy. Trigger: 'perplexity explain'.
Inputs: concept (required).
searchA
Get raw ranked search results from Perplexity's search index. Returns structured results with titles, URLs, and snippets. Best for getting a list of sources without AI synthesis. Trigger: 'perplexity raw search', 'perplexity search results'.
Inputs: query (required), max_results, domain_filter, recency.
search_webB
Search the web using Perplexity with real-time results, domain filtering, recency filtering, and detailed citations. Best-in-class AI search. Trigger: 'perplexity search', 'perplexity web search', or 'search with perplexity'.
Inputs: query (required), allowed_domains, excluded_domains, recency, +1 more.
search_with_reasoningA
Search the web with step-by-step reasoning using Perplexity's sonar-reasoning-pro model. Best for complex questions requiring multi-step analysis with live web data. Trigger: 'perplexity reason', 'perplexity think', or 'reason with perplexity'.
Inputs: prompt (required), allowed_domains, recency.
upload_fileA
Upload a document for Perplexity to analyze. Supports text files (txt, md, py, js, ts, csv, json, etc.) and images (png, jpg, gif, webp). Trigger: 'perplexity upload file', 'upload to perplexity'.
Inputs: file_path (required), query, model.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have distinct purposes, but ask and search_web both provide Q&A with citations, and search_with_reasoning adds step-by-step reasoning, causing minor potential confusion. However, descriptions and triggers help clarify differences.
All tool names follow a consistent lowercase underscore-separated verb or verb_noun pattern (e.g., ask, brainstorm, search_web), making them predictable and easy to reason about.
With 9 tools, the server covers a broad range of interactions with Perplexity without being overwhelming. Each tool serves a clear purpose, and the count feels well-scoped for an AI assistant.
The set covers core functionalities: Q&A, brainstorming, code review, deep research, explanations, raw search, web search, reasoning search, and file upload. Minor gaps like saving results or comparing sources are not essential for the domain.
Maintenance
Related MCP Connectors
Multi-brand AI code review for Claude: up to 12 reviewers and a judge, no install.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Connect your team's living knowledge base — docs, data, issues, CRM — to Claude and ChatGPT.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseBqualityDmaintenanceA powerful research assistant that integrates with Cline and Claude Desktop to leverage Perplexity AI for intelligent search, documentation retrieval, API discovery, and code modernization assistance while coding.45MIT
- FlicenseAqualityDmaintenanceIntegrates Perplexity AI's search-enhanced language models with Claude Desktop, providing three tools with different complexity levels for quick fact-checking, technical analysis, and deep research.32-
- AlicenseNot gradedqualityNot gradedmaintenanceIntegrates the Sonar API to provide Claude with real-time web-wide research capabilities. Enables conversational web searches through Perplexity's AI-powered search engine for up-to-date information retrieval.MIT
- AlicenseAqualityDmaintenanceConnects Claude to Perplexity Comet's agentic browser for autonomous web browsing, deep research, and real-time task monitoring. Enables Claude to delegate web research tasks and receive comprehensive results through multiple browsing modes.668 npm181MIT