Perplexity MCP
Updated
The official MCP server implementation for the Perplexity API Platform. Provides AI assistants with real-time web search, reasoning, and research capabilities through Sonar models and the Search API.
claude mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server docker build -t perplexity-mcp-server . && docker run -p 8080:8080 -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-server What it does
Claude’s training data has a cutoff, so questions that require fresh information — recent news, just-shipped docs, latest releases — can’t be answered from memory alone. The usual workaround is to switch to a browser, run a search, and paste results back. Perplexity MCP collapses that loop: Claude calls the search directly through MCP tools and gets answers grounded in real-time web data.
Because Perplexity’s Sonar models synthesize answers from search results rather than returning raw pages, Claude doesn’t have to re-read full result pages itself.
Key features — four tools
-
perplexity_search— direct web searchReturns ranked Perplexity Search API results unmodified. Use when you want the raw result set rather than a synthesized answer.
-
perplexity_ask— conversational AI with real-time web searchThe most common entry point. Runs on
sonar-proand returns a synthesized answer over current web data in a single call. -
perplexity_research— deep researchRuns on
sonar-deep-researchand produces longer-form research that combines multiple sources. Better suited for topic-wide questions than one-shot queries. -
perplexity_reason— advanced reasoningRuns on
sonar-reasoning-proand adds an explicit reasoning step on top of search results.
Both perplexity_research and perplexity_reason accept a strip_thinking boolean to drop thinking tags from output and save tokens.
Installation
Claude Code (recommended) — one-liner that registers and installs the server.
claude mcp add perplexity \
--env PERPLEXITY_API_KEY="your_key_here" \
-- npx -y @perplexity-ai/mcp-server
Codex — same pattern.
codex mcp add perplexity \
--env PERPLEXITY_API_KEY="your_key_here" \
-- npx -y @perplexity-ai/mcp-server
Cursor · Claude Desktop · Kiro · Windsurf · VS Code — add the server to the client’s mcpServers JSON config (file location varies per client).
Docker · HTTP server — for shared or cloud deployments. Either docker build and docker run -p 8080:8080 -e PERPLEXITY_API_KEY=..., or run the HTTP mode directly with npm install && npm run build && npm run start:http.
Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
PERPLEXITY_API_KEY | ✅ | — | API key. Generate at https://www.perplexity.ai/account/api/group |
PERPLEXITY_TIMEOUT_MS | 5 minutes | API call timeout | |
PERPLEXITY_BASE_URL | https://api.perplexity.ai | Custom endpoint | |
PERPLEXITY_LOG_LEVEL | ERROR | One of DEBUG, INFO, WARN, ERROR | |
PERPLEXITY_PROXY / HTTPS_PROXY / HTTP_PROXY | — | Corporate proxy. Format: https://[username:password@]host:port |
HTTP server deployment also reads: PORT (default 8080), BIND_ADDRESS (default 0.0.0.0), and ALLOWED_ORIGINS.
Notes
- Officially operated by Perplexity — maintained in the
github.com/perplexityaiorg, distinct from community wrappers. - API usage is billed separately by Perplexity — Anthropic charges for Claude tokens, Perplexity charges for API calls. Track usage on each platform separately if cost monitoring matters.
- Proxy support — set
PERPLEXITY_PROXY,HTTPS_PROXY, orHTTP_PROXY; any of the three is recognized. - Use
strip_thinkingto save tokens — the research and reason tools include thinking tags in output by default. When only the final answer is needed, enable the option to reduce token usage. - MIT licensed — free for commercial and personal use.
Frequently Asked Questions
What is Perplexity MCP?
The official MCP server implementation for the Perplexity API Platform. It gives AI assistants real-time web search, reasoning, and research capabilities through Perplexity's Sonar models (`sonar-pro`, `sonar-deep-research`, `sonar-reasoning-pro`) and the Search API.
Where does it run?
Claude Code, Claude Desktop, Codex, Cursor, Kiro, Windsurf, and VS Code. Any standard MCP client can connect via manual `mcpServers` JSON configuration.
How do I install it?
On Claude Code, run `claude mcp add perplexity --env PERPLEXITY_API_KEY="..." -- npx -y @perplexity-ai/mcp-server`. Codex uses the equivalent `codex mcp add` command. Docker and a Node.js HTTP server deployment are also supported.
Where do I get the API key?
Generate one at https://www.perplexity.ai/account/api/group and set it as the `PERPLEXITY_API_KEY` environment variable.
What tools does the server expose?
`perplexity_search` (direct web search), `perplexity_ask` (conversational AI on `sonar-pro`), `perplexity_research` (deep research on `sonar-deep-research`), and `perplexity_reason` (advanced reasoning on `sonar-reasoning-pro`). The last two accept an optional `strip_thinking` boolean to remove thinking tags and save tokens.
What's the license?
MIT. Perplexity API usage is billed separately by Perplexity — refer to the [Perplexity documentation](https://docs.perplexity.ai/) for pricing.