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
Set the required API key and optional settings via environment variables:
# optional, default ~5 minutes
# optional
# DEBUG|INFO|WARN|ERROR
mcpServers example (Cursor / generic MCP clients):
VS Code (.vscode/mcp.json) stdio example:
HTTP server / Docker
# Build and run a Docker image for HTTP deployment
Environment variables (summary):
| Variable | Purpose | Default / Notes |
|---|---|---|
| PERPLEXITY_API_KEY | Required API key for Perplexity | — |
| PERPLEXITY_BASE_URL | Custom Perplexity API base URL | https://api.perplexity.ai |
| PERPLEXITY_TIMEOUT_MS | Request timeout in ms | 300000 (5 min) typical |
| PERPLEXITY_LOG_LEVEL | Logging verbosity | ERROR |
| PERPLEXITY_PROXY | Proxy (checked first) | Use https://host:port or https://user:pass@host:port |
| HTTPS_PROXY / HTTP_PROXY | Fallback proxy vars | Standard env names |
| PORT | HTTP server port | 8080 |
| BIND_ADDRESS | HTTP server bind address | 0.0.0.0 |
| ALLOWED_ORIGINS | CORS 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:
- Add the connector to mcpServers (see config examples).
- In your assistant session, invoke the tool (e.g., call perplexity_search or perplexity_ask).
- 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