The Perplexity MCP Server provides access to Perplexity AI's powerful search capabilities through the Model Context Protocol. It enables web search, academic research, financial data retrieval, and advanced filtering options, automatically returning source URLs for additional information retrieval.
./run.sh
PERPLEXITY_API_KEY
: Your Perplexity AI API keyPERPLEXITY_DEFAULT_MODEL
: Default model to use (default: "sonar")
sonar
: Fast, cost-effective search for quick factssonar-pro
: Comprehensive search with better depth and coveragePERPLEXITY_MAX_TOKENS
: Maximum tokens in response (default: 1024)PERPLEXITY_TEMPERATURE
: Response randomness 0-2 (default: 0.2)PERPLEXITY_TOP_P
: Nucleus sampling parameter (default: 0.9)PERPLEXITY_TOP_K
: Top-k sampling parameter (default: 0)PERPLEXITY_TIMEOUT
: Request timeout duration (default: 30s)PERPLEXITY_RETURN_IMAGES
: Include images by default (default: false)PERPLEXITY_RETURN_RELATED
: Include related questions by default (default: false)export PERPLEXITY_API_KEY="your-api-key"
./perplexity
export PERPLEXITY_API_KEY="your-api-key"
./perplexity -test
To use this server with an MCP client, add it to your client configuration:
{
"servers": {
"perplexity": {
"command": "path/to/perplexity",
"env": {
"PERPLEXITY_API_KEY": "your-api-key"
}
}
}
}
Perform a general web search with real-time information.
Parameters:
query
(required): The search querymodel
: Choose 'sonar' for quick searches or 'sonar-pro' for comprehensive resultssearch_domain_filter
: Array of domains to includesearch_exclude_domains
: Array of domains to excludesearch_recency_filter
: Time filter (hour, day, week, month, year)return_images
: Include imagesreturn_related_questions
: Include related questionsmax_tokens
: Maximum response tokenstemperature
: Response randomness (0-2)date_range_start
: Start date (YYYY-MM-DD)date_range_end
: End date (YYYY-MM-DD)location
: Geo-specific search locationExample:
{
"query": "latest AI developments",
"model": "sonar-pro",
"search_recency_filter": "week",
"return_citations": true
}
Search academic papers and scholarly content.
Parameters:
query
(required): The academic search querysubject_area
: Academic subject (e.g., "Physics", "Computer Science")model
: Defaults to 'sonar-pro' for comprehensive academic resultssearch_domain_filter
: Array of academic domainssearch_recency_filter
: Time filtermax_tokens
: Maximum response tokenstemperature
: Response randomnessExample:
{
"query": "quantum computing applications",
"subject_area": "Physics",
"search_recency_filter": "year"
}
Search financial data and SEC filings.
Parameters:
query
(required): The financial search queryticker
: Stock ticker symbol (e.g., "AAPL")company_name
: Company namereport_type
: Financial report type (e.g., "10-K", "10-Q", "8-K")model
: Defaults to 'sonar-pro' for comprehensive financial datasearch_recency_filter
: Time filterdate_range_start
: Report start datedate_range_end
: Report end datemax_tokens
: Maximum response tokensExample:
{
"query": "quarterly earnings",
"ticker": "MSFT",
"report_type": "10-Q",
"search_recency_filter": "month"
}
Advanced search with comprehensive filtering.
Parameters:
query
(required): The search querymodel
: Choose based on needs (defaults to sonar-pro)search_domain_filter
: Array of domains to includesearch_exclude_domains
: Array of domains to excludesearch_recency_filter
: Time filtercontent_type
: Type of content (news, academic, blog, etc.)file_type
: File type filter (pdf, doc, html, etc.)language
: Language filtercountry
: Country for geo-specific searchdate_range_start
: Start datedate_range_end
: End datereturn_citations
: Include citationsreturn_images
: Include imagesreturn_related_questions
: Include related questionsmax_tokens
: Maximum response tokenstemperature
: Response randomnesscustom_filters
: Object with additional key-value filtersExample:
{
"query": "renewable energy innovations",
"content_type": "news",
"language": "English",
"country": "Germany",
"search_recency_filter": "month",
"custom_filters": {
"industry": "energy",
"technology": "solar"
}
}
All search functions return responses in this format:
Example response structure:
[Main search results content...]
## Source URLs
1. https://example.com/article1
2. https://example.com/article2
3. https://example.com/article3
## Detailed Sources
1. **Article Title**
URL: https://example.com/article1
Snippet: Brief excerpt from the article...
## Related Questions
- What are the latest developments?
- How does this compare to...?
The server handles various error conditions:
Errors are returned with descriptive messages to help diagnose issues.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "perplexity" '{"command":"/path/to/binary/perplexity-server","env":{"PERPLEXITY_API_KEY":"your-perplexity-key"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"perplexity": {
"command": "/path/to/binary/perplexity-server",
"env": {
"PERPLEXITY_API_KEY": "your-perplexity-key"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"perplexity": {
"command": "/path/to/binary/perplexity-server",
"env": {
"PERPLEXITY_API_KEY": "your-perplexity-key"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect