Perplexity MCP server: web search for Claude Code, Cursor and agents
T. Krause · · updated
Perplexity MCP is Perplexity's official MCP server. It gives Claude Code, Cursor, VS Code or any other MCP client four tools that search the web and answer with sources: perplexity_search, perplexity_ask, perplexity_reason and perplexity_research. Perplexity hosts it at https://api.perplexity.ai/mcp. The same server is open source at github.com/perplexityai/modelcontextprotocol and published on npm as @perplexity-ai/mcp-server. You connect by signing in to Perplexity or by sending a Perplexity API key.
With the server added, a coding agent can look up a changelog or an error message on the web before it writes code, instead of answering from its training data. The second half of this guide covers Prompt TM's Perplexity toolkit, for agents that should reach Perplexity through the same MCP URL as their other apps. The Perplexity details below come from docs.perplexity.ai and Perplexity's GitHub repository as of November 2026.
The four tools and the effort level behind each
Perplexity's MCP docs list four tools. One returns search results. The other three return a written answer, and each runs Perplexity's Agent API at a fixed effort level.
| Tool | What the agent gets back | What runs it |
|---|---|---|
perplexity_search | Ranked results with titles, URLs, snippets and metadata | Search API |
perplexity_ask | A short answer from a web search, for everyday questions | Agent API, fast |
perplexity_reason | Step-by-step reasoning for analysis and decisions | Agent API, medium |
perplexity_research | A detailed report with citations | Agent API, high |
perplexity_search takes a country code, a recency filter (search_recency_filter), a domain filter (search_domain_filter) and search_type: "fast", which Perplexity's README describes as lower latency and cost. The local server needs version 1.3.0 or later for search_type; the hosted one has it already. A perplexity_research run can take minutes.
The agent chooses among the four from their descriptions. Use the search tool when the agent should read the pages itself, and the answer tools when Perplexity should read them and write the answer.
Hosted or local
Perplexity recommends the hosted server. There is nothing to install or update. It speaks Streamable HTTP and accepts two kinds of credentials.
Sign in with Perplexity. Add the server without a key. On first use the client opens a browser, you sign in to your Perplexity account, pick the API organization to bill and approve the connection. You need to be an admin of an API organization that can pay for usage. The connection can call the API and nothing else, so it can't create keys, view balances or manage the organization.
An API key. Send it as Authorization: Bearer YOUR_API_KEY. Perplexity suggests this for clients without OAuth support and for server-side setups such as Anthropic's MCP connector. Create the key on the API Keys page of the Perplexity console.
The local server runs on your machine over stdio and reads the key from PERPLEXITY_API_KEY. Use it when your client only runs stdio servers, or when you want to pin a version. Perplexity says both "are intended to expose the same Perplexity tools", but transport, authentication, release timing and client behaviour can differ.
Perplexity bills each tool call at its standard API rates, to the key you connected or to the organization you picked at sign-in, and that organization's rate limits apply. Current rates are on Perplexity's pricing page.
Add the hosted server to your client
Claude Code. Add the server, then run /mcp inside Claude Code and follow the sign-in prompt for perplexity:
claude mcp add --transport http perplexity https://api.perplexity.ai/mcp
To use a key instead of the sign-in, add the header:
claude mcp add --transport http perplexity https://api.perplexity.ai/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Cursor. Put the server in ~/.cursor/mcp.json, then open Cursor Settings > Tools & MCP and click Connect next to perplexity:
{
"mcpServers": {
"perplexity": {
"url": "https://api.perplexity.ai/mcp"
}
}
}
VS Code. VS Code uses servers instead of mcpServers, plus a type field. Put this in .vscode/mcp.json, and VS Code opens a browser to sign in the first time the server starts:
{
"servers": {
"perplexity": {
"type": "http",
"url": "https://api.perplexity.ai/mcp"
}
}
}
For Cursor or VS Code with an API key, the MCP docs have one-click install links. Cursor's link adds the Authorization header with a YOUR_API_KEY placeholder that you replace with your key. VS Code's link makes VS Code ask you for the key.
claude.ai and other clients. claude.ai takes the URL as a custom connector and signs in with OAuth. Any other client that supports remote MCP servers over Streamable HTTP can connect with the same URL, using OAuth 2.1 with PKCE and dynamic client registration, or the bearer header.
Run the open-source server locally
In Claude Code, every local option needs the key in the environment that starts the client. Perplexity's docs add the server like this:
export PERPLEXITY_API_KEY="your_api_key_here"
claude mcp add perplexity --env 'PERPLEXITY_API_KEY=${PERPLEXITY_API_KEY}' -- npx -y @perplexity-ai/mcp-server
The single quotes keep ${PERPLEXITY_API_KEY} as a reference, so the key itself isn't written into Claude Code's config. Codex takes the same shape: codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server.
Cursor and Claude Desktop read an mcpServers block:
{
"mcpServers": {
"perplexity": {
"command": "npx",
"args": ["-y", "@perplexity-ai/mcp-server"],
"env": {
"PERPLEXITY_API_KEY": "your_key_here"
}
}
}
}
In VS Code, rename mcpServers to servers and add "type": "stdio" to the server.
Two settings from the README help in practice. PERPLEXITY_TIMEOUT_MS raises the five-minute default for long research runs. And if a strict client fails with an EOF or initialize error, npx -yq stops npx from writing install messages to stdout. From a clone of the repository, npm install && npm run build && npm run start:http runs the server over HTTP at http://localhost:8080/mcp, and the repository's Dockerfile builds the same server as a container.
If your setup still says sonar-pro
Per the README, earlier versions of the server called sonar-pro, sonar-reasoning-pro and sonar-deep-research, and accepted strip_thinking and reasoning_effort arguments. A guide written for those versions is out of date. The current tools run on Agent API presets, and the server ignores those two arguments if a client still sends them.
Perplexity ended support for Sonar Chat Completions on 27 September 2026. Its migration guide says synchronous and streaming Sonar requests keep working while Perplexity reformulates them as Agent API requests, model by model. It recommends the Agent API for new projects.
Which one to use
- Your own coding agent, web search only. Use Perplexity's hosted server with the sign-in. There is no key to store.
- A client that only runs stdio servers, or a pinned version. Use the npm package.
- Your own Node service that serves Perplexity tools to several tenants. The package exports
createPerplexityServer, which takes a function that returns the API key for each call. - An agent that uses Perplexity next to other apps, chooses its own model or effort, returns JSON, runs research in the background, needs approvals or calls with each user's own key. Use Prompt TM's Perplexity toolkit, which the rest of this guide covers.
The two don't exclude each other. A developer can keep perplexity in Claude Code for their own lookups and give the agent they ship Perplexity through Prompt TM.
Brave also publishes an MCP server, with separate tools for news, image, video and place search. Our guide covers running Brave's server with an API key.
Where the toolkit differs from Perplexity's server
Prompt TM calls Perplexity's REST API at api.perplexity.ai, not Perplexity's MCP server, so its tools and inputs differ from the server's.
| Perplexity's MCP server | Prompt TM's Perplexity toolkit | |
|---|---|---|
| Where the agent connects | https://api.perplexity.ai/mcp, or the local package | The same MCP URL as its GitHub, Linear or Slack tools |
| Credentials in the client | A Perplexity sign-in or a Perplexity API key | One Prompt TM key. The Perplexity key stays encrypted on Prompt TM, out of each client's config and out of .mcp.json |
| Model and effort | One fixed effort level per answer tool | Any effort level, a named model from the Agent API's list, or a fallback chain of up to five models |
| The answer | Text with numbered citations | Text, or JSON that follows a schema the agent passes |
| Deep research | perplexity_research answers when the report is done, which can take minutes | A background run that returns at once, and the agent polls for the result |
| Search inputs | Country, recency and domain filters, and a fast mode | The same, plus language and publish or update date filters and a people search type |
| Whose key a call uses | The key or organization the client connected, unless your own service picks one per call with createPerplexityServer | The key of the user the agent acts for, connected through the API or a connect link on prompt-tm.com |
Prompt TM's five Perplexity tools
The last column names the closest tool on Perplexity's server.
| Tool | What it does | Closest Perplexity MCP tool |
|---|---|---|
PERPLEXITY_SEARCH | Searches the web and returns ranked results with titles, URLs, snippets and dates | perplexity_search |
PERPLEXITY_CREATE_AGENT_RESPONSE | Runs Perplexity's Agent API at an effort level or with a named model | perplexity_ask (fast), perplexity_reason (medium), perplexity_research (high) |
PERPLEXITY_RETRIEVE_AGENT_RESPONSE | Returns a run's status and, when it's done, its output | None |
PERPLEXITY_LIST_MODELS | Lists the model IDs the Agent API accepts | None |
PERPLEXITY_CREATE_CHAT_COMPLETION | Answers with a Sonar model and returns its citations and the search results it used | None in the current version |
A few details decide how the agent uses them. An effort level (fast, low, medium, high, xhigh or ultra) brings its own web search. A request that names a model instead, as provider/model from PERPLEXITY_LIST_MODELS, searches only when the agent sets web_search. Anthropic models also need max_output_tokens.
For deep research, the agent runs PERPLEXITY_CREATE_AGENT_RESPONSE with effort high and background: true. The call returns at once with status queued and a response ID, and the agent polls PERPLEXITY_RETRIEVE_AGENT_RESPONSE until the run finishes. No MCP call stays open while the research runs.
PERPLEXITY_CREATE_CHAT_COMPLETION takes sonar, sonar-pro, sonar-reasoning-pro or sonar-deep-research, for code written against Sonar. For anything new, use the agent tool, as Perplexity's migration guide recommends. The toolkit leaves out streaming and asynchronous Sonar requests.
PERPLEXITY_CREATE_AGENT_RESPONSE is the one tool that isn't marked read-only, so an MCP server set to Ask a person before any call that changes something holds it, and only it. A held call returns approval_required: true and runs nothing. The approval link goes to your webhook and to the server's page in the dashboard, never to the agent. Use that setting if a person should agree before the agent starts an ultra run. Ask a person before destructive calls holds none of the five tools. Details are in the router docs. To keep a tool away from every account on an auth config, not only from one MCP server, set restrict_to_following_tools on the auth config.
Connect Perplexity to Prompt TM
The Perplexity toolkit takes a Perplexity API key, which Prompt TM sends as a bearer token. There is no Perplexity sign-in on Prompt TM, so you or your user creates a key on the API Keys page first. Prompt TM checks a new key by listing Perplexity's models, a call that needs a valid key and runs no model.
1. Add an auth config for Perplexity. In the dashboard, open Auth configs → New, choose Perplexity and Access token. Or with the API:
curl -X POST https://www.prompt-tm.com/api/v3/auth_configs \
-H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
-d '{ "toolkit": { "slug": "perplexity" }, "auth_config": { "auth_scheme": "BEARER_TOKEN" } }'
2. Connect an account. With your own key:
curl -X POST https://www.prompt-tm.com/api/v3/connected_accounts \
-H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
-d '{ "auth_config": { "id": "ac_..." }, "user_id": "me",
"connection": { "data": { "token": "YOUR_PERPLEXITY_API_KEY" } } }'
If Perplexity rejects the key, the call answers 400 and the account is FAILED. For a user's own key, POST /api/v3/connected_accounts/link returns a connect link on prompt-tm.com with a form for the key, so the key never passes through your app or the agent. The link expires after one hour. More in the authentication docs.
3. Create an MCP server. In MCP servers → New, choose Custom, tick Perplexity, and under Only some tools pick the tools the agent should see. Add the agent's other toolkits to the same server. Copy the server URL.
4. Add it to your client. In Cursor, ~/.cursor/mcp.json:
{
"mcpServers": {
"prompt-tm-perplexity": {
"url": "https://www.prompt-tm.com/mcp/mcp_...?user_id=me",
"headers": { "x-api-key": "ptm_..." }
}
}
}
In Claude Code:
claude mcp add --transport http prompt-tm-perplexity \
"https://www.prompt-tm.com/mcp/mcp_...?user_id=me" \
--header "x-api-key: $PROMPT_TM_KEY"
The name prompt-tm-perplexity keeps this server apart from Perplexity's own perplexity server if you added both. The user_id in the URL picks whose Perplexity key the calls use. The other clients are in the MCP client docs, and Claude Code MCP server setup covers scopes and sharing a server in .mcp.json without committing the key. Then ask something like "What changed in the latest Next.js release? Cite the release notes." The call then shows up under Logs with the tool, the user and the outcome.
To put Perplexity in a router with the rest of the catalogue instead of a fixed tool list, see tool router vs fixed tools. The Perplexity toolkit page lists every input. Prompt TM is free during early access, with 20,000 tool calls per project per month. To try it, create a free project and connect a Perplexity API key.