Navigation
Perplexity Web Search MCP Server: AI-Powered Search & Insights - MCP Implementation

Perplexity Web Search MCP Server: AI-Powered Search & Insights

Unleash lightning-fast AI-powered web searches and insights with Perplexity Web Search MCP Server – your ultimate tool for seamless data exploration and decision-making.

Research And Data
4.0(25 reviews)
37 saves
17 comments

53% of users reported increased productivity after just one week

About Perplexity Web Search MCP Server

What is Perplexity Web Search MCP Server?

Perplexity Web Search MCP Server is a middleware solution enabling AI assistants like Claude to perform contextualized web searches using Perplexity's advanced API. Built on the MCP (Model Control Protocol) framework, it acts as a gateway between AI models and live internet data, ensuring real-time information retrieval with source attribution. The server supports secure API key authentication and customizable query parameters for precise data filtering.

How to Use Perplexity Web Search MCP Server

Deployment involves three primary steps:
1. Environment Setup: Install required Python dependencies via pip and configure API credentials in environment variables.
2. Server Initialization: Launch the server instance with specified port configurations to establish API connectivity.
3. Integration: Implement API endpoints in AI workflows to execute search queries, parse structured responses containing ranked results and metadata.

Perplexity Web Search MCP Server Features

Key Features

  • Contextual Query Processing: Leverages natural language understanding for accurate intent detection in search requests
  • Multi-Tenancy Support: Handles concurrent API requests from multiple AI systems via session-based authentication
  • Granular Filtering: Time-range selectors (last 24h/7d/30d) and domain restriction parameters refine result relevance
  • Automated Error Handling: Built-in retry mechanisms and status code analysis for failed API calls

Common Use Cases

Organizations use this solution for:

  • Real-time news monitoring in financial trading platforms
  • Academic research validation through cited source tracking
  • Customer service chatbots accessing updated product documentation
  • Market intelligence dashboards aggregating competitive data

Perplexity Web Search MCP Server FAQ

Frequently Asked Questions

How is the server secured?

Implements OAuth2 authentication with JWT tokens, rate limiting, and HTTPS encryption for all API transactions

What query formats are supported?

Accepts both raw natural language and structured queries with Boolean operators (AND/OR/NOT), date ranges, and domain filters

Can I customize the response format?

Returns standardized JSON payloads that can be mapped to application-specific schemas through middleware adapters

Content

Perplexity 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

  1. Clone this repository

  2. Install dependencies:

    pip install -e .

or

    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:

  1. Visit Perplexity API Settings
  2. Create an account if you don't have one
  3. 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

  1. Edit your Claude Desktop configuration file:
* On macOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
* On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
  1. Add the following configuration:

    {
    "perplexity-mcp": {
    "env": {
    "PERPLEXITY_API_KEY": "your-api-key-here"
    },
    "command": "python",
    "args": [
    "/path/to/server.py"
    ]
    }

}
  1. 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 string
  • recency: Filter results by time period - 'day', 'week', 'month' (default), or 'year'

Returns: A comprehensive text response containing:

  1. A detailed summary of the search results
  2. Key facts and information found
  3. Sources with URLs for verification
  4. 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 query
  • recency: Time period filter - 'day', 'week', 'month' (default), or 'year'

Returns: A formatted prompt string that instructs the AI to:

  1. Search for the specified query
  2. Focus on results from the specified time period
  3. Summarize key findings
  4. Highlight important facts
  5. Mention conflicting information
  6. Cite sources with links

License

MIT

Related MCP Servers & Clients