Home / MCP / Perplexity MCP Server

Perplexity MCP Server

A Model Context Protocol (MCP) server for research and documentation assistance using Perplexity AI. Won 1st @ Cline Hackathon

JavaScript
Installation
Add the following to your MCP client configuration file.

Configuration

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

You can run the Perplexity MCP Server to access an intelligent research assistant that routes tasks to the most suitable model and provides search capabilities for every task. This lets you perform quick lookups, complex analyses, and in-depth research from a single MCP integration.

How to use

To use this MCP server, connect it to an MCP client and start one of the provided server configurations. You can run the server locally with Node.js or via NPX, and you’ll supply your Perplexity API key for authentication.

// Option 1: Run with a local node process (explicit build index)
{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": ["/path/to/perplexity-server/build/index.js"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
// Option 2: Use NPX to run a prebuilt MCP package
{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "your_api_key"
      }
    }
  }
}
// Option 3: Pass API key via command-line, then start the server
{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--api-key",
        "your_api_key_here"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}
// Option 4: Use a .env file from a project directory with --cwd
{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/perplexity-server/build/index.js",
        "--cwd",
        "/path/to/your/project"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

How to install

Follow these concrete steps to set up the Perplexity MCP Server locally. Ensure you have Node.js installed and an API key for Perplexity. Then clone the project, install dependencies, and start the server using one of the provided methods.

# Prerequisites
- Install Node.js from nodejs.org
- Obtain a Perplexity API key from your Perplexity account

# Install and prepare
- git clone <repository-url>
- cd <cloned-directory>
- npm install
- npm run build

# Start using the stdio method (example 1)
# Ensure you replace the path with your actual build location and API key
node /path/to/perplexity-server/build/index.js --api-key YOUR_API_KEY_HERE
# Start using NPX (example 2)
npx -y perplexity-mcp
# Start using the explicit internal path (example 3)
node /path/to/perplexity-server/build/index.js --cwd /path/to/your/project

Configuration notes and security

All configurations require the Perplexity API key to be provided either via an environment variable, a command-line argument, or a .env file. The priority order is command-line argument, then environment variable, then a .env file provided with --cwd.

Environment variable to set: PERPLEXITY_API_KEY. Use a strong key and keep it secret. If you are using a local project directory with a .env file, place the key in that file and ensure your tool picks it up.

Tools and capabilities

The server exposes three capabilities to handle different task types with Perplexity models.

- search Quick lookups and concise answers for straightforward questions.

- reason Complex, multi-step reasoning for explanations and comparisons.

- deep_research In-depth research and detailed reports on major topics.

Troubleshooting

If the MCP client cannot parse the API key automatically, supply it directly via the command-line or ensure the environment variable PERPLEXITY_API_KEY is set correctly in your runtime environment.

Available tools

search

Quick search tool for simple queries and concise information lookup.

reason

Handles complex, multi-step tasks requiring detailed analysis, explanations, and comparisons.

deep_research

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