Get the FREE Ultimate OpenClaw Setup Guide β†’

perplexity-web-api

πŸ” Perplexity AI MCP without API key

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Install Node.js from the official site if you don’t have it already.
  2. 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
  3. 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

Sponsor this space

Reach thousands of developers β†—