PE
OfficialSearch

Perplexity MCP Server Connector for Web Search

Enable web search with Perplexity API via an MCP server connector, integrating Perplexity results into your workflow without leaving the MCP ecosystem.

Overview

The Perplexity MCP Server Connector brings Perplexity’s real-time web search and research models into any Model Context Protocol (MCP) client. Run this small server locally or in the cloud and expose Perplexity Search and Sonar models as MCP tools so assistants can fetch up-to-date web results, reason over external sources, and produce in-context research without leaving the MCP ecosystem.

This connector is useful when you need an integrated search capability inside chat assistants, code editors, or other MCP-compatible applications (Cursor, VS Code, Claude Desktop, Windsurf, etc.). It standardizes access to Perplexity’s Search API and Sonar models (ask/research/reason), supports proxy and HTTP server deployment, and is configurable with environment variables.

GitHub: https://github.com/ppl-ai/modelcontextprotocol

Features

  • Exposes Perplexity Search and Sonar models as MCP tools (stdio or HTTP)
  • Four ready-to-use tools: search, ask (conversational), research (deep), and reason (advanced reasoning)
  • Real-time web search results with ranking and metadata
  • Optional removal of internal “thinking” tags to save context tokens
  • Proxy support for corporate networks (PERPLEXITY_PROXY, HTTPS_PROXY, HTTP_PROXY)
  • Deployable as a local stdio server or an HTTP server (Docker-friendly)
  • Configurable timeout and logging level

Installation / Configuration

Quick install (run as an MCP stdio server via npx):

# Run once to launch an MCP stdio server
npx -y @perplexity-ai/mcp-server

Set the required API key and optional settings via environment variables:

export PERPLEXITY_API_KEY="your_key_here"
export PERPLEXITY_TIMEOUT_MS=600000       # optional, default ~5 minutes
export PERPLEXITY_BASE_URL="https://api.perplexity.ai"  # optional
export PERPLEXITY_LOG_LEVEL="ERROR"       # DEBUG|INFO|WARN|ERROR

mcpServers example (Cursor / generic MCP clients):

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": ["-y", "@perplexity-ai/mcp-server"],
      "env": {
        "PERPLEXITY_API_KEY": "your_key_here"
      }
    }
  }
}

VS Code (.vscode/mcp.json) stdio example:

{
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@perplexity-ai/mcp-server"],
      "env": {
        "PERPLEXITY_API_KEY": "your_key_here"
      }
    }
  }
}

HTTP server / Docker

# Build and run a Docker image for HTTP deployment
docker build -t perplexity-mcp-server .
docker run -p 8080:8080 -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-server

Environment variables (summary):

VariablePurposeDefault / Notes
PERPLEXITY_API_KEYRequired API key for Perplexity
PERPLEXITY_BASE_URLCustom Perplexity API base URLhttps://api.perplexity.ai
PERPLEXITY_TIMEOUT_MSRequest timeout in ms300000 (5 min) typical
PERPLEXITY_LOG_LEVELLogging verbosityERROR
PERPLEXITY_PROXYProxy (checked first)Use https://host:port or https://user:pass@host:port
HTTPS_PROXY / HTTP_PROXYFallback proxy varsStandard env names
PORTHTTP server port8080
BIND_ADDRESSHTTP server bind address0.0.0.0
ALLOWED_ORIGINSCORS origins (comma)*

Proxy precedence: PERPLEXITY_PROXY → HTTPS_PROXY → HTTP_PROXY. Include the scheme (https://).

Available Tools

The server exposes the following MCP tools:

  • perplexity_search

    • Direct web searches using the Perplexity Search API.
    • Returns ranked results, snippets, and metadata for current information.
  • perplexity_ask

    • Conversational Q&A backed by the sonar-pro model and web search.
    • Best for everyday questions and short-form assistance.
  • perplexity_research

    • In-depth research using sonar-deep-research.
    • Produces detailed reports, source citations, and long-form analysis.
  • perplexity_reason

    • Advanced multi-step reasoning with sonar-reasoning-pro.
    • Use for complex problem solving and logic-heavy tasks.

Optional parameter for perplexity_research and perplexity_reason:

  • strip_thinking: set true to remove tags from model output to reduce token usage (default: false).

Use Cases

  • Current-events assistant: Answer questions about recent news using live web search results and citations.
  • Technical troubleshooting: Pull recent StackOverflow answers, changelogs, and docs to diagnose environment-specific problems.
  • Research briefs: Generate a 1–2 page report with source links on a scientific, legal, or market topic using sonar-deep-research.
  • Code augmentation: In your editor (VS Code / Cursor), augment code completions with web-sourced examples and package info.
  • Complex reasoning: Use sonar-reasoning-pro to break down multi-step problems like debugging strategies, root-cause analysis, or policy interpretation.

Concrete example — Cursor / VS Code flow:

  1. Add the connector to mcpServers (see config examples).
  2. In your assistant session, invoke the tool (e.g., call perplexity_search or perplexity_ask).
  3. The tool returns ranked results and a short answer; the assistant can include citations and source metadata.

Tips & Troubleshooting

  • If responses seem slow in corporate networks, verify PERPLEXITY_PROXY or HTTPS_PROXY is set correctly.
  • Increase PERPLEXITY_TIMEOUT_MS for long research tasks (research/reason may take longer).
  • Use PERPLEXITY_LOG_LEVEL=DEBUG when diagnosing issues — logs show HTTP requests and proxy selection.
  • For multi-user or shared deployments, run in HTTP mode behind an authenticated proxy or gateway and restrict ALLOWED_ORIGINS.

For source code, bug reports, and the latest releases, see the repository: https://github.com/ppl-ai/modelcontextprotocol

Tags:search