Perplexity Research Assistant MCP server

Integrates with Perplexity Sonar Pro API to provide real-time research assistance for developers, enabling efficient documentation retrieval, API discovery, and code analysis
Back to servers
Setup instructions
Provider
DaInfernalCoder
Release date
Jan 27, 2025
Language
TypeScript
Stats
266 stars

The Perplexity MCP Server is an intelligent research assistant that leverages Perplexity's AI models to provide search capabilities for all tasks. It automatically detects query complexity to route requests to the most appropriate model, ensuring optimal results. This server also encourages specificity in agent interactions.

Available Tools

Search (Sonar Pro)

This tool is ideal for simple queries and basic information lookup, providing concise, direct answers.

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "search",
  arguments: {
    query: "What is the capital of France?",
    force_model: false // Optional: force using this model even if query seems complex
  }
});

Reason (Sonar Reasoning Pro)

Perfect for complex, multi-step tasks that require detailed analysis, explanations, comparisons, and problem-solving.

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "reason",
  arguments: {
    query: "Compare and contrast REST and GraphQL APIs, explaining their pros and cons",
    force_model: false // Optional: force using this model even if query seems simple
  }
});

Deep Research (Sonar Deep Research)

Conducts comprehensive research and generates detailed reports for in-depth analysis of complex topics.

const result = await use_mcp_tool({
  server_name: "perplexity",
  tool_name: "deep_research",
  arguments: {
    query: "The impact of quantum computing on cryptography",
    focus_areas: [
      "Post-quantum cryptographic algorithms",
      "Timeline for quantum threats",
      "Practical mitigation strategies"
    ],
    force_model: false // Optional: force using this model even if query seems simple
  }
});

Installation and Setup

Prerequisites

Configuration Options

Option 1: Using NPX (Recommended for macOS)

Add the following to your MCP settings file:

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "your_api_key"
      }
    }
  }
}

Option 2: Local Installation

If you've cloned the repository, configure your MCP settings file as follows:

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": ["/path/to/perplexity-server/build/index.js"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Alternative API Key Configuration Methods

If your MCP Client can't parse the Perplexity API Key from the environment, you have these alternatives:

Using Command-Line Argument

Pass the API key directly as a command-line argument:

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--api-key",
        "your_api_key_here"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Using a .env File

Specify a project directory containing a .env file with your API key:

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--cwd",
        "/path/to/your/project"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Note on Priority: The server checks for API keys in this order: command-line argument > environment variable > .env file with --cwd (path needed).

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" '{"command":"npx","args":["-y","perplexity-mcp"],"env":{"PERPLEXITY_API_KEY":"your_api_key"}}'

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": {
            "command": "npx",
            "args": [
                "-y",
                "perplexity-mcp"
            ],
            "env": {
                "PERPLEXITY_API_KEY": "your_api_key"
            }
        }
    }
}

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": {
            "command": "npx",
            "args": [
                "-y",
                "perplexity-mcp"
            ],
            "env": {
                "PERPLEXITY_API_KEY": "your_api_key"
            }
        }
    }
}

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