perplexity-web-api
π Perplexity AI MCP without API key
claude mcp add --transport stdio mishamyrt-perplexity-web-api-mcp npx -y perplexity-web-api-mcp \ --env PERPLEXITY_CSRF_TOKEN="<your-csrf-token>" \ --env PERPLEXITY_SESSION_TOKEN="<your-session-token>"
How to use
The Perplexity Web API MCP Server exposes Perplexity AI search, research, and reasoning capabilities as MCP tools that you can plug into your development environment. The server provides three primary tools: perplexity_search for quick web-enabled queries, perplexity_reason for advanced step-by-step reasoning and problem solving, and perplexity_research for in-depth, citation-backed investigations. Each tool accepts a standard set of parameters (query, sources, and language) and uses configurable models via environment variables (PERPLEXITY_SEARCH_MODEL and PERPLEXITY_REASON_MODEL) to tailor results to your needs. You can integrate these tools into editors, IDEs, or external clients that support the MCP wrapper format, such as Cursor, Claude Desktop, Windsurf, Zed, VS Code, Codex, or other MCP-compatible clients. To set up, provide the Perplexity session token and CSRF token extracted from your Perplexity cookies, then connect your client to the mcpServers configuration and start querying the tools. The server does not require a separate API key, leveraging your existing Perplexity subscription.
How to install
Prerequisites:
- Node.js and npm installed on your machine
- Access to a Perplexity account to obtain session tokens (PERPLEXITY_SESSION_TOKEN and PERPLEXITY_CSRF_TOKEN)
Installation steps:
- Install Node.js from the official site if you donβt have it already.
- Obtain your Perplexity tokens by logging into perplexity.ai in your browser and copying:
- __Secure-next-auth.session-token -> PERPLEXITY_SESSION_TOKEN
- next-auth.csrf-token -> PERPLEXITY_CSRF_TOKEN
- Run the MCP server using npx with your tokens:
export PERPLEXITY_SESSION_TOKEN="<your-session-token>"
export PERPLEXITY_CSRF_TOKEN="<your-csrf-token>"
npx -y perplexity-web-api-mcp
On Windows PowerShell, use the equivalent set commands:
$env:PERPLEXITY_SESSION_TOKEN = "<your-session-token>"
$env:PERPLEXITY_CSRF_TOKEN = "<your-csrf-token>"
npx -y perplexity-web-api-mcp
Optional: If you prefer to predefine the tokens in the mcp config, you can create a client configuration (see the mcp_config example) and connect your editor or client to that configuration.
Additional notes
Tips and common considerations:
- Tokens are sensitive; avoid committing them. Use environment variables or secure vaults where possible.
- If your client reports authentication errors, re-check that PERPLEXITY_SESSION_TOKEN and PERPLEXITY_CSRF_TOKEN are current and match the active Perplexity session.
- The available models are configurable via PERPLEXITY_SEARCH_MODEL and PERPLEXITY_REASON_MODEL; omit to use defaults (turbo for search, sonar-reasoning for reasoning).
- Some editors (Cursor, VS Code, Zed) provide templates or wrappers for the mcpServers config; use the provided examples to adapt to your environment.
- If you run into network or token-expiration issues, refreshing tokens from your browser and restarting the MCP server often resolves them.
Related MCP Servers
ls
List MCP Server configurations in your system used by AI applications like Cursor, Claude Desktop, VS Code and others
ytt
MCP server to fetch YouTube transcripts
mcp-loxone
An opinionated Model Context Protocol (MCP) server for controlling Loxone home automation systems.
mcp-install-instructions-generator
Generate MCP Server Installation Instructions for Cursor, Visual Studio Code, Claude Code, Claude Desktop, Windsurf, ChatGPT, Gemini CLI and more
mcp-perplexity
A Model Context Protocol (MCP) server for intelligent code analysis and debugging using Perplexity AIβs API, seamlessly integrated with the Claude desktop client.
Nexuscore_MCP
AI-powered MCP server for dynamic malware analysis with Frida instrumentation, session-based debugging, and 46+ security tools