About Perplexity Web Search MCP Server
Perplexity Web Search MCP Server lets MCP-compatible AI assistants search the web through the Perplexity API. It returns summaries with source links and supports recency filters and a reusable search prompt.
Key features
- 01Search the web through Perplexity
- 02Return summaries with sources and citations
- 03Filter results by time period
- 04Create a web-search prompt template
- 05Load API keys from environment or .env
Use cases
- 01Find recent news and verify sources
- 02Search for research published within a time range
MCP support
Exposes a web-search tool and a prompt template to MCP clients. The search tool sends queries to the Perplexity API and returns results with source links.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEPerplexity Web Search MCP Server
A simple MCP (Model Context Protocol) server that provides web search functionality using the Perplexity API. This server allows Claude or other MCP-compatible AI assistants to search the web and get up-to-date information.
Features
- Search the web with Perplexity's powerful search capabilities
- Get comprehensive search results with sources and citations
- Filter results by time period (day, week, month, year)
- Includes a ready-to-use prompt template for web searches
- Supports loading API key from environment variables or .env file
Installation
- Clone this repository
- Install dependencies:
orpip install -e .uv pip install -e .
Configuration
You can set the PERPLEXITY_API_KEY environment variable with your Perplexity API key:
export PERPLEXITY_API_KEY="your-api-key-here"
Alternatively, you can create a .env file in the project root with the following content:
PERPLEXITY_API_KEY=your-api-key-here
A sample .env.example file is provided for reference.
To get a Perplexity API key:
- Visit Perplexity API Settings
- Create an account if you don't have one
- Generate an API key
Usage
Running the server
python server.py
Testing the server
You can test the server functionality without running the full MCP server using the included test script:
python test_server.py "your search query here" --recency month
Options for --recency are: day, week, month (default), year
Using with Claude Desktop
-
Edit your Claude Desktop configuration file:
- On macOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json - On Windows:
%APPDATA%/Claude/claude_desktop_config.json
- On macOS:
-
Add the following configuration:
{ "perplexity-mcp": { "env": { "PERPLEXITY_API_KEY": "your-api-key-here" }, "command": "python", "args": [ "/path/to/server.py" ] } } -
Restart Claude Desktop
Example Prompts for Claude
- "Search the web for the latest news about artificial intelligence"
- "Use Perplexity to find information about climate change published in the past week"
- "Search for recent research papers on quantum computing from the past month"
API Reference
Tool: search_web(query: str, recency: str = "month") -> str
Search the web using Perplexity API and return results.
Parameters:
query: The search query stringrecency: Filter results by time period - 'day', 'week', 'month' (default), or 'year'
Returns: A comprehensive text response containing:
- A detailed summary of the search results
- Key facts and information found
- Sources with URLs for verification
- Any conflicting information if present
Prompt: web_search_prompt(query: str, recency: str = "month") -> str
Creates a prompt template for searching the web with Perplexity.
Parameters:
query: The search queryrecency: Time period filter - 'day', 'week', 'month' (default), or 'year'
Returns: A formatted prompt string that instructs the AI to:
- Search for the specified query
- Focus on results from the specified time period
- Summarize key findings
- Highlight important facts
- Mention conflicting information
- Cite sources with links
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.