Perplexity MCP server

Integrates with Perplexity AI API to enable web search capabilities for retrieving up-to-date information across domains.
Back to servers
Setup instructions
Provider
Jason Allen
Release date
Dec 27, 2024
Language
Python
Package
Stats
12.2K downloads
181 stars

This MCP server provides web search functionality for Claude AI using the Perplexity API. It allows Claude to search the web for up-to-date information, effectively enabling the language model to access current information from the internet when responding to your queries.

Installation Options

Quick Installation via Smithery

The easiest way to install the Perplexity MCP server is through Smithery:

npx -y @smithery/cli install perplexity-mcp --client claude

Manual Installation Prerequisites

The server requires UV (a fast Python package manager) to run. If you don't have UV installed:

On macOS with Homebrew:

brew install uv

Or for macOS/Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

For Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Configuration Setup

To manually configure the MCP server, you'll need to edit your Claude Desktop or Cursor config file.

Add the following configuration:

"perplexity-mcp": {
  "env": {
    "PERPLEXITY_API_KEY": "XXXXXXXXXXXXXXXXXXXX",
    "PERPLEXITY_MODEL": "sonar"
  },
  "command": "uvx",
  "args": [
    "perplexity-mcp"
  ]
}

Config File Locations

For Claude Desktop:

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

For Cursor:

  • macOS: /Users/your-username/.cursor/mcp.json
  • Windows: C:\Users\your-username\.cursor\mcp.json

Required API Key

You must obtain a Perplexity API key from Perplexity AI and add it to your configuration.

Usage

Basic Usage

Once installed, you can use web search in your Claude conversations with prompts like:

  • "Search the web to find out what's new at Anthropic in the past week."
  • "Search the web for the latest updates on artificial intelligence."

When you use a search-related prompt, Claude will recognize the need and request permission to use the Perplexity web search tool. Click "Allow for this chat" when prompted.

Available Model Options

You can customize which Perplexity model to use by setting the PERPLEXITY_MODEL environment variable:

  • sonar-deep-research: 128k context - Enhanced research capabilities
  • sonar-reasoning-pro: 128k context - Advanced reasoning with professional focus
  • sonar-reasoning: 128k context - Enhanced reasoning capabilities
  • sonar-pro: 200k context - Professional grade model
  • sonar: 128k context - Default model
  • r1-1776: 128k context - Alternative architecture

Search Recency Controls

When searching, you can specify how recent the results should be:

  • Last 24 hours: Use "day" parameter
  • Last week: Use "week" parameter
  • Last month: Use "month" parameter (default)
  • Last year: Use "year" parameter

For example: "Search the web for news about OpenAI in the past week"

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-mcp" '{"env":{"PERPLEXITY_API_KEY":"XXXXXXXXXXXXXXXXXXXX","PERPLEXITY_MODEL":"sonar"},"command":"uvx","args":["perplexity-mcp"]}'

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-mcp": {
            "env": {
                "PERPLEXITY_API_KEY": "XXXXXXXXXXXXXXXXXXXX",
                "PERPLEXITY_MODEL": "sonar"
            },
            "command": "uvx",
            "args": [
                "perplexity-mcp"
            ]
        }
    }
}

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-mcp": {
            "env": {
                "PERPLEXITY_API_KEY": "XXXXXXXXXXXXXXXXXXXX",
                "PERPLEXITY_MODEL": "sonar"
            },
            "command": "uvx",
            "args": [
                "perplexity-mcp"
            ]
        }
    }
}

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