perplexity-mcp
Provides a private Perplexity search tool that performs authenticated searches and returns answers with source links.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@perplexity-mcpWhat's the latest on the Artemis II launch?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Perplexity MCP on Cloudflare
Use Perplexity search from ChatGPT or another MCP client. You deploy one private Worker in your Cloudflare account.
Model Context Protocol (MCP) lets AI clients call external tools. This server gives a client one read-only tool named search_perplexity.
For example, ChatGPT can ask Perplexity a current web question and return the answer with its source links. You stay in the same chat.
Why this project exists
Perplexity and ChatGPT are useful for different types of research. This project connects them through a small server that you own.
The Worker uses your Perplexity consumer session. It does not need a Perplexity API key or Perplexity API billing.
The design is for one person and one deployment. Your Cloudflare account controls the server, its access policy, and its saved session.
Related MCP server: perplexity-web-mcp
Before you deploy
This project is an unofficial integration. It uses Perplexity consumer authentication, not the official Perplexity API.
Perplexity can change or block this login flow. Use this project only if the access method fits your account and obligations.
Do not run this Worker as a public or shared service. Its security model allows one owner email address.
What you get
ChatGPT and other remote MCP clients can call
search_perplexity.The tool returns the Perplexity answer and its source links.
A protected
/adminpage connects or disconnects the Perplexity account.Cloudflare Access limits the Worker to the exact owner email address.
A Durable Object stores the Perplexity session. Cloudflare encrypts its data and metadata at rest.
The Worker does not store search queries or answers.
Requirements
You need:
A Cloudflare account with Workers and Zero Trust enabled.
A Perplexity account that supports email sign-in.
One email address that will own the Worker.
ChatGPT with custom MCP app support, or another remote MCP client.
OpenAI changes custom app availability by plan. Read Developer mode and MCP apps in ChatGPT for current access rules.
Installation
The setup has four parts. You deploy the Worker, protect it, connect Perplexity, and add it to your MCP client.
1. Deploy the Worker
Select the Deploy to Cloudflare button near the top of this page.
Sign in to Cloudflare.
Set
OWNER_EMAILto the exact email address that will use the Worker.Finish the deployment.
Copy the Worker URL.
The URL usually looks like this:
https://perplexity-mcp.<your-subdomain>.workers.devThe deployment creates the Worker and its Durable Object. It does not create the Cloudflare Access policy.
2. Protect the Worker with Cloudflare Access
Do not use /admin or /mcp before you complete this section. A missing Access policy exposes the Worker endpoint.
Open Workers & Pages in the Cloudflare dashboard.
Select the deployed
perplexity-mcpWorker.Open the Access tab.
Select Protect this Worker behind Access.
Select All traffic.
Create an Allow policy for the exact
OWNER_EMAIL.Remove policies that allow Everyone or a complete email domain.
Apply Access.
Worker-level Access protects the workers.dev address, routes, custom domains, and preview addresses. Cloudflare explains this setup in Cloudflare Access for Workers.
Next, configure OAuth for the generated Access application:
Open Cloudflare Zero Trust.
Open Access, then Applications.
Select the application for the Worker.
Open its OAuth configuration.
Enable OAuth.
Enable Dynamic Client Registration.
Add this allowed redirect URI:
https://chatgpt.com/connector/oauth/*Dynamic Client Registration lets ChatGPT register itself with Access. Without it, ChatGPT reports that the server does not implement OAuth.
Use a short Access token lifetime, such as 15 minutes. A grant lifetime of one or two weeks reduces repeated sign-ins.
Do not select No authentication in ChatGPT. The Worker requires OAuth through Cloudflare Access.
3. Connect your Perplexity account
Open
<Worker URL>/adminin your browser.Sign in through Cloudflare Access with
OWNER_EMAIL.Enter the email address for your Perplexity account.
Select Send login code.
Enter the code that Perplexity sends by email.
If Perplexity asks for an authenticator code, enter it on the next page.
Make sure that the page shows
Provider session: Connected.
The Perplexity email address can differ from OWNER_EMAIL. The Worker never puts email codes or authenticator codes in an MCP conversation.
4. Add the app to ChatGPT
ChatGPT connects to remote MCP servers from its web app. The exact menu depends on your plan and workspace role.
Enable Developer mode for your ChatGPT account.
Open Settings, then Apps.
Select Create.
Enter a name such as
Perplexity MCP.Enter
<Worker URL>/mcpas the MCP server URL.Select OAuth authentication.
Select Scan tools.
Sign in through Cloudflare Access when ChatGPT opens the authorization page.
Create the app.
If Create is missing, ask the workspace administrator to enable Developer mode. An administrator can also use Workspace settings, Apps, then Create.
Start a new chat and select the app from the tools menu. Ask ChatGPT to use Perplexity for a current-information question.
For example:
Use Perplexity to find the latest Cloudflare Workers announcements. Include the source links.Other MCP clients
Use this server URL:
<Worker URL>/mcpThe client must support remote Streamable HTTP servers and OAuth. It must also work with Dynamic Client Registration from Cloudflare Access.
How it works
The setup uses two separate sign-ins. Cloudflare Access identifies the Worker owner. Perplexity authentication creates the private search session.
One-time setup
Owner browser
|
| Open /admin
v
Cloudflare Access
|
| Match the exact OWNER_EMAIL
v
Worker admin page
|
| Email code and optional authenticator code
v
Perplexity
|
| Consumer session
v
SQLite-backed Durable ObjectEach search follows this path:
ChatGPT or another MCP client
|
| OAuth and MCP request
v
Cloudflare Access
|
| Verified owner identity
v
Worker /mcp
|
| Load the saved session and send the query
v
Perplexity
|
| Answer and source links
v
MCP clientSecurity model
Cloudflare Access authenticates every request before the Worker handles it.
The Worker trusts only the identity in Cloudflare
ctx.access.The identity email must exactly match
OWNER_EMAIL.The MCP client never receives the saved Perplexity cookie.
The Worker never forwards inbound authorization, cookie, or Access headers to Perplexity.
Cloudflare encrypts Durable Object data and metadata at rest with Cloudflare-managed keys.
Disconnecting in
/adminremoves the saved state from this deployment.
Disconnecting does not revoke a session that Perplexity holds outside this Worker. Read SECURITY.md before you expose a new hostname.
Limits
This project supports one owner and one saved Perplexity session.
The Worker runs one provider search at a time.
Perplexity can expire the session. Reconnect it through
/admin.The integration has no official API fallback.
Subscription features, SSO, and provider account restrictions can produce different results.
The Deploy Button flow and live authenticator challenge still need broader account testing.
Troubleshooting
If ChatGPT says that the server does not implement OAuth, enable OAuth and Dynamic Client Registration in the Access application. Add https://chatgpt.com/connector/oauth/* as an allowed redirect URI.
If Cloudflare denies access, make sure that the signed-in email exactly matches OWNER_EMAIL. Also remove broad or bypass policies.
If the tool returns SETUP_REQUIRED, open <Worker URL>/admin and connect Perplexity again.
If the tool returns PROVIDER_BUSY, wait for the active search to finish. Then run the request again.
If the tool returns STATE_UNAVAILABLE, inspect the Cloudflare status and Worker logs. Do not put cookies, codes, queries, or provider responses in reports.
Read the troubleshooting guide for more error details.
Local development
Local development requires Node.js 22.6 or newer.
git clone https://github.com/Bitaru/perplexity-mcp.git
cd perplexity-mcp
npm install
cp .dev.vars.example .dev.varsSet OWNER_EMAIL in .dev.vars. Never commit real local values.
Run the local validation commands:
npm run typecheck
npm test
npm run smoke
npm run check-template
npm run check-secrets
npx wrangler deploy --dry-runStart the local Worker:
npm run devProtected routes need a simulated Cloudflare Access identity during local development. See Test ctx.access locally.
Project documentation
Architecture describes the trust boundaries and saved state.
Deployment describes release and rollback steps.
Cloudflare Access setup describes the required identity and OAuth policy.
Operations describes connection, disconnection, and log rules.
Compatibility lists tested versions and untested account flows.
Test evidence records the latest local and staging results.
License
This project uses the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Real-time web search, reasoning, and research through Perplexity's API
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that enables Claude to request chat completions with citations from the Perplexity API.1MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to perform web searches on Perplexity.ai using browser automation instead of an official API. It supports persistent authenticated sessions and returns search results along with cited sources directly to the client.340 npm10MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that queries Perplexity Pro via WebUI session token, providing model-specific tools for search and deep research.32 npm5MIT
- AlicenseAqualityCmaintenanceMCP server for Perplexity AI Pro that enables deep web search, thread management, and export of answers using an existing Perplexity Pro subscription and browser session cookie.510 npmMIT