Perplexity
Web search using the Perplexity API with automatic model selection based on query intent.
Perplexity MCP Server
An MCP server that provides Perplexity AI web search capabilities to Claude, with automatic model selection, stateful filters, and 7 purpose-built tools.
Prerequisites
- Node.js v20 or higher
- A Perplexity API key — get one at https://www.perplexity.ai/settings/api
- Claude Desktop (or any MCP-compatible client)
Installation
-
Clone this repository:
git clone https://github.com/RossH121/perplexity-mcp.git cd perplexity-mcp -
Install dependencies:
npm install -
Build the server:
npm run build
Configuration
Add the server to Claude's config file at ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"perplexity-server": {
"command": "node",
"args": ["/absolute/path/to/perplexity-mcp/build/index.js"],
"env": {
"PERPLEXITY_API_KEY": "your-api-key-here",
"PERPLEXITY_MODEL": "sonar-pro"
}
}
}
}
Replace /absolute/path/to with the actual path to where you cloned the repository.
Available Models
The server automatically selects the best model based on your query, but you can also set a default via PERPLEXITY_MODEL:
| Model | Best for |
|---|---|
sonar-deep-research | Comprehensive reports, exhaustive multi-source research |
sonar-reasoning-pro | Complex logic, math, chain-of-thought analysis |
sonar-pro | General search, factual queries (default) |
sonar | Quick, simple lookups |
For pricing and availability: https://docs.perplexity.ai/guides/pricing
Tools
search — AI-powered web search
The main search tool. Automatically selects the right model based on your query. Returns a synthesized answer with cited sources.
| Parameter | Options | Description |
|---|---|---|
query | string | Your search query |
search_context_size | low / medium / high | How much web context to retrieve. low is fastest/cheapest (default), high is most thorough |
reasoning_effort | minimal / low / medium / high | Depth of reasoning for sonar-deep-research |
strip_thinking | boolean | Remove <think>...</think> blocks from reasoning model responses |
search_mode | web / academic / sec | academic prioritizes peer-reviewed papers; sec searches SEC filings |
stream | boolean | Enable streaming responses |
Examples:
- "What's the latest on fusion energy?" → auto-selects
sonar-pro - "Deep research analysis of CRISPR gene editing advances" → auto-selects
sonar-deep-research - "Solve this logic puzzle step by step" → auto-selects
sonar-reasoning-pro
raw_search — Raw ranked results (no LLM)
Returns ranked web results directly without AI synthesis. Faster and cheaper — useful for URL discovery, building source lists, or fact-checking pipelines.
| Parameter | Options | Description |
|---|---|---|
query | string | Search query |
max_results | 1–20 | Number of results (default: 10) |
search_mode | web / academic / sec | Search type |
recency | hour / day / week / month / year | Time window filter |
search_after_date | MM/DD/YYYY | Only results after this date |
search_before_date | MM/DD/YYYY | Only results before this date |
country | ISO 3166 code | Localize results (e.g. US, GB) |
domain_filter — Allowlist/blocklist domains
Restrict or exclude specific domains from search results. Filters persist across all subsequent searches until cleared.
action: "allow"— restrict results to this domain (allowlist mode)action: "block"— exclude this domain from results (denylist mode)- Maximum 20 domains; cannot mix allow and block in the same filter set
"Allow results only from arxiv.org and nature.com"
"Block pinterest.com and reddit.com from search results"
recency_filter — Time window filter
Limit search results to a specific time period. Persists until changed.
Options: hour, day, week, month, year, none
"Set recency filter to week"
"Remove the recency filter"
clear_filters — Reset all filters
Clears all domain and recency filters in one call.
list_filters — View active filters
Shows currently active domain allowlist/blocklist and recency setting.
model_info — View or override model selection
View available models and current selection, or manually force a specific model.
"Show model info"
"Set model to sonar-deep-research"
Intelligent Model Selection
The server scores your query against keyword lists to automatically pick the right model:
- Research keywords (
deep research,comprehensive,in-depth) →sonar-deep-research - Reasoning keywords (
solve,logic,mathematical,figure out) →sonar-reasoning-pro - Simple keywords (
quick,brief,basic) →sonar - Everything else →
sonar-pro
Each response shows which model was used and why. If a query strongly matches a model (score ≥ 2), it will override a manually set model.
Example Workflows
Time-sensitive research with domain filtering:
recency_filter→weekdomain_filter→ allownature.com, allowarxiv.orgsearch→ "Recent breakthroughs in quantum error correction"
Financial document research:
raw_searchwithsearch_mode: "sec"→ find relevant filingssearchwithsearch_mode: "sec"→ synthesized analysis
Academic literature review:
searchwithsearch_mode: "academic",search_context_size: "high"→ comprehensive results from peer-reviewed sources
Deep research with reasoning control:
searchwithreasoning_effort: "high",strip_thinking: true→ thorough analysis without<think>blocks in the output
Development
npm run build # Compile TypeScript to build/
npm start # Run the built server
Source is in src/ — after editing, rebuild and restart Claude to load changes.
License
MIT
関連サーバー
MCP Compass
Explore and discover Model Context Protocol servers using natural language queries.
Google Maps MCP Server
Local business search and lead generation via Google Maps
MCP Web Search Server
A web search server powered by DuckDuckGo, no API key required.
Marketaux
Search for market news and financial data by entity, country, industry, or symbol using the Marketaux API.
Halal Terminal MCP
Shariah-compliant investing for AI agents — screen stocks & ETFs across 5 methodologies (AAOIFI, DJIM, FTSE, MSCI, S&P), audit portfolios, calculate zakat, get market data, news & SEC filings.
Plex MCP Server
Search your Plex media library. Supports OAuth and static token authentication.
Deep Research
Generates in-depth research reports using powerful AI models.
MCP RAG
A managed Retrieval-Augmented Generation (RAG) server using MCP, integrated with knowledge bases and OpenSearch.
YouTube Music MCP
Search and play tracks on YouTube Music via AI assistants.
Crawleo MCP Server
Crawleo MCP - Web Search & Crawl for AI Enable AI assistants to access real-time web data through native tool integration. Two Powerful Tools: web.search - Real-time web search with flexible formatting Search from any country/language Device-specific results (desktop, mobile, tablet) Multiple output formats: Enhanced HTML (AI-optimized, clean) Raw HTML (original source) Markdown (formatted text) Plain Text (pure content) Auto-crawl option for full content extraction Multi-page search support web.crawl - Deep content extraction Extract clean content from any URL JavaScript rendering support Markdown conversion Screenshot capture Multi-URL support Features: ✅ Zero data retention (complete privacy) ✅ Real-time, not cached results ✅ AI-optimized with Enhanced HTML mode ✅ Global coverage (any country/language) ✅ Device-specific search (mobile/desktop/tablet) ✅ Flexible output formats (4 options) ✅ Cost-effective (5-10x cheaper than competitors) ✅ Simple Claude Desktop integration Perfect for: Research, content analysis, data extraction, AI agents, RAG pipelines, multi-device testing