Perplexity MCP Server

Sends questions to Perplexity's Sonar Pro, Sonar Reasoning Pro and Sonar Deep Research models

By Sumit Datta (individual) TypeScript Local · stdio Web searchAI and ML

27 popularity score ★ 297 ↓ 1.4k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs PERPLEXITY_API_KEY. Replace each <NAME> with your value.

Claude CodeTerminal
claude mcp add perplexity -e PERPLEXITY_API_KEY=<PERPLEXITY_API_KEY> -- npx -y perplexity-mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "perplexity-mcp"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.perplexity]
command = "npx"
args = ["-y", "perplexity-mcp"]

[mcp_servers.perplexity.env]
PERPLEXITY_API_KEY = "<PERPLEXITY_API_KEY>"
Gemini CLITerminal
gemini mcp add --scope user -e PERPLEXITY_API_KEY=<PERPLEXITY_API_KEY> perplexity npx -- -y perplexity-mcp
Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs PERPLEXITY_API_KEY. Replace each <NAME> with your value.

FirstTerminal
git clone https://github.com/DaInfernalCoder/researcher-mcp.git
cd researcher-mcp
npm install
npm run build
Claude CodeTerminal
claude mcp add perplexity -e PERPLEXITY_API_KEY=<PERPLEXITY_API_KEY> -- node '<ABSOLUTE_PATH_TO_CLONE>/build/index.js'
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/build/index.js"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/build/index.js"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/build/index.js"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "<PERPLEXITY_API_KEY>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.perplexity]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/build/index.js"]

[mcp_servers.perplexity.env]
PERPLEXITY_API_KEY = "<PERPLEXITY_API_KEY>"
Gemini CLITerminal
gemini mcp add --scope user -e PERPLEXITY_API_KEY=<PERPLEXITY_API_KEY> perplexity node -- '<ABSOLUTE_PATH_TO_CLONE>/build/index.js'

Settings 1

PERPLEXITY_API_KEY Required: Perplexity API key; the server exits at start without one. Can instead be passed with --api-key or read from a .env file in the folder given with --cwd.

What it does

Researcher MCP (published on npm as perplexity-mcp) is a small stdio server that forwards an assistant's questions to the Perplexity API and returns the model's answer with its cited web sources listed as numbered links. It offers three tools, one per Perplexity model: search for short lookups on sonar-pro, reason for multi-step explanations on sonar-reasoning-pro, and deep_research for long reports on sonar-deep-research, which also takes a list of focus areas.

The search tool does not always use sonar-pro. In src/index.ts, unless force_model is true, a search query is checked for keywords: words such as "how", "why", "explain" or "compare" send it to sonar-reasoning-pro, and words such as "analyze", "research", "detailed" or "evaluate" send it to sonar-deep-research. The reason and deep_research tools are never rerouted. Each query is also wrapped in a fixed prompt asking the model to use the error messages, versions and code it contains, and when the query lacks such details the server appends a note to the answer listing what was missing, nudging the assistant to ask more specific questions.

The API key can come from the PERPLEXITY_API_KEY variable, a --api-key argument (which the server masks in its own process arguments), or a .env file in a folder named with --cwd. It is a third-party project, not one published by Perplexity.

What it needs

RuntimeNode.js 18+

Node.js 18 or later (npx for the npm way). A Perplexity API key from perplexity.ai/settings/api; Perplexity bills API usage, and Sonar Deep Research calls cost more than Sonar Pro ones. Running from source needs git and a TypeScript build (npm install, npm run build).

Limits

Only three tools, all of them question-and-answer calls to Perplexity; it cannot fetch a given URL, set search filters such as domain or date, or pick other Perplexity models. A search query containing common words like "how" or "analyze" is silently moved to a slower, costlier model unless force_model is set to true (src/index.ts). No request timeout is set, so a long deep_research call waits as long as the API takes. The server exits at start if no key is found by any of the three methods; .env files are read only from a folder given with --cwd.

Who it suits

Suits someone who already pays for the Perplexity API and wants web-grounded answers with sources inside an assistant, with a choice between quick, reasoned and long research answers. Because search reroutes on keywords, users watching their API bill should pass force_model or call the tools they mean. Those who want an option maintained by Perplexity itself should look at the official server its README mentions; this one is a community project with three fixed tools.

Tools 3

search
Ask a short question on sonar-pro; may be rerouted to a heavier model by keywords unless force_model is true
reason
Ask for a step-by-step explanation or comparison on sonar-reasoning-pro
deep_research
Request a long report on sonar-deep-research, optionally steered by a list of focus_areas

Similar servers