Perplexity Search MCP server

Enables web searches using Perplexity's API with sonar or sonar-pro models, returning detailed results with citations and optional recency filtering.
Back to servers
Setup instructions
Provider
Arjun Kumar M
Release date
Mar 17, 2025
Language
TypeScript
Stats
6 stars

This MCP server integrates Perplexity's web search capabilities with AI assistants using the Model Context Protocol (MCP). It allows AI models to perform real-time web searches through a simple interface, using either the sonar or sonar-pro models from Perplexity.

Features

  • Provides a search tool for AI assistants to perform web searches
  • Uses Perplexity's chat completions API with the sonar/sonar-pro models

Installation

Prerequisites

Before installing the Perplexity Search MCP server, you'll need:

  • A Perplexity API key
  • Node.js environment

Setting Up

  1. Clone the repository:

    git clone https://github.com/username/perplexity-search-mcp.git
    cd perplexity-search-mcp
    
  2. Install dependencies:

    npm install
    
  3. Set up your environment variables:

    export PERPLEXITY_API_KEY="your-perplexity-api-key"
    

    Alternatively, create a .env file in the root directory:

    PERPLEXITY_API_KEY=your-perplexity-api-key
    
  4. Start the server:

    npm start
    

Usage

Basic Search

The MCP server provides a search tool that accepts the following parameters:

  • query (required): The search query to perform
  • search_recency_filter (optional): Filter search results by recency (options: month, week, day, hour)

Example Requests

Simple Search Query

{
  "tool": "search",
  "parameters": {
    "query": "latest developments in quantum computing"
  }
}

Search with Recency Filter

{
  "tool": "search",
  "parameters": {
    "query": "current events in technology",
    "search_recency_filter": "week"
  }
}

Response Structure

The server returns responses in the following format:

{
  "content": "The search results text containing information about the query...",
  "citations": [
    {
      "url": "https://example.com/article1",
      "title": "Article Title 1"
    },
    {
      "url": "https://example.com/article2",
      "title": "Article Title 2"
    }
  ]
}

Integrating with AI Models

To use this MCP server with an AI model that supports the Model Context Protocol:

  1. Register the server's endpoint with your AI model framework
  2. Configure the AI to use the search tool when relevant
  3. Process the returned citations and content as needed in your application

Troubleshooting

Common Issues

  • Authentication Errors: Ensure your Perplexity API key is valid and correctly set in environment variables
  • Rate Limiting: Be aware of any rate limits on your Perplexity API plan
  • Search Filters: If search results aren't as expected, try adjusting the recency filter

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "perplexity-search" '{"command":"npx","args":["-y","@arjunkmrm/perplexity-search"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

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.

Adding an MCP server to Cursor globally

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-search": {
            "command": "npx",
            "args": [
                "-y",
                "@arjunkmrm/perplexity-search"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "perplexity-search": {
            "command": "npx",
            "args": [
                "-y",
                "@arjunkmrm/perplexity-search"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later