Perplexity Web Search MCP Server

Perplexity Web Search MCP Server

Allows Claude or other MCP-compatible AI assistants to search the web and get up-to-date information using the Perplexity API, with features for filtering results by time period.

nachoal

Search
Browser Automation
Python
Visit Server

README

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
  2. Add the following configuration:

    {
      "perplexity-mcp": {
        "env": {
          "PERPLEXITY_API_KEY": "your-api-key-here"
        },
        "command": "python",
        "args": [
          "/path/to/server.py"
        ]
      }
    }
    
  3. 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
@kazuph/mcp-fetch

@kazuph/mcp-fetch

Model Context Protocol server for fetching web content and processing images. This allows Claude Desktop (or any MCP client) to fetch web content and handle images appropriately.

Featured
Local
JavaScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.

Featured
Python
YouTube Transcript MCP Server

YouTube Transcript MCP Server

This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Featured
Python
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

This Serper MCP Server supports search and webpage scraping, and all the most recent parameters introduced by the Serper API, like location.

Featured
TypeScript
The Verge News MCP Server

The Verge News MCP Server

Provides tools to fetch and search news from The Verge's RSS feed, allowing users to get today's news, retrieve random articles from the past week, and search for specific keywords in recent Verge content.

Featured
TypeScript
Google Search Console MCP Server

Google Search Console MCP Server

A server that provides access to Google Search Console data through the Model Context Protocol, allowing users to retrieve and analyze search analytics data with customizable dimensions and reporting periods.

Featured
TypeScript