Web search using the Perplexity API with automatic model selection based on query intent.
An MCP server that provides web search capabilities using Perplexity's API with automatic model selection based on query intent.
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
Get your Perplexity API key from https://www.perplexity.ai/settings/api
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"
}
}
}
}
Replace /absolute/path/to
with the actual path to where you cloned the repository.
The server now supports automatic model selection based on query intent, but you can also specify a default model using the PERPLEXITY_MODEL
environment variable. Available options:
sonar-deep-research
- Specialized for extensive research and expert-level analysis across domainssonar-reasoning-pro
- Optimized for advanced logical reasoning and complex problem-solvingsonar-reasoning
- Designed for reasoning tasks with balanced performancesonar-pro
- General-purpose model with excellent search capabilities and citation densitysonar
- Fast and efficient for straightforward queriesThe default model (specified in the environment variable) will be used as the baseline for automatic model selection.
For up-to-date model pricing and availability, visit: https://docs.perplexity.ai/guides/pricing
After configuring the server and restarting Claude, you can simply ask Claude to search for information. For example:
Claude will automatically use the Perplexity search tool to find and return relevant information. The server will automatically select the most appropriate model based on your query's intent.
If for whatever reason it decides not to use the search tool, you can force the issue by prepending your prompt with "Search the web".
The server automatically selects the most appropriate Perplexity model based on your query:
Each search response includes information about which model was used and why.
This server supports domain filtering to customize your search experience. You can allow or block specific domains using these commands:
Note: Perplexity API supports up to 3 domains total with priority given to allowed domains. Domain filtering requires a Perplexity API tier that supports this feature.
Example usage flow:
You can limit search results to a specific time window using the recency filter:
This is particularly useful for time-sensitive queries like current events or breaking news.
While the automatic model selection works well for most cases, you can manually control which model is used:
Example usage:
To modify the server:
src/index.ts
npm run build
MIT
Perform real-time web searches using the Yandex Search API.
Provides web search, Wikipedia search, and web content fetching capabilities using OCaml.
Search NCBI databases, including PubMed, for scientific literature. Tailored for researchers in life sciences, evolutionary biology, and computational biology.
Provides comprehensive trademark information, including search, profile statistics, and status tracking.
Scrapes Google search results using a headless browser. Requires Chrome to be installed.
Self-hosted Websearch API
Interact with the Haloscan SEO API for search engine optimization tasks.
Provides the Ferengi Rules of Acquisition with powerful search and retrieval capabilities.
Provides knowledge base search and dialogue completion using the Volcengine Knowledge Base service. Requires external credential configuration.
An MCP server for web and similarity search, designed for Claude Desktop. It integrates with various external embedding and API services.