npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

perplexity-web-api-mcp

v0.2.1

Published

MCP server exposing Perplexity AI search, research, and reasoning tools

Readme

Perplexity Web API MCP Server

MCP (Model Context Protocol) server that exposes Perplexity AI search, research, and reasoning capabilities as tools.

Requirements

Supported Platforms

  • macOS
  • Linux
  • ~~Windows~~ (not supported yet)

Supported Architectures

  • x86_64
  • aarch64

Configuration

User Tokens

This server requires a Perplexity AI account. You need to extract two authentication tokens from your browser cookies:

  • PERPLEXITY_SESSION_TOKEN - The next-auth.session-token cookie value
  • PERPLEXITY_CSRF_TOKEN - The next-auth.csrf-token cookie value

Getting Your Tokens

  1. Log in to perplexity.ai in your browser
  2. Open Developer Tools (F12 or right-click → Inspect)
  3. Go to Application → Cookies → https://www.perplexity.ai
  4. Copy the values of:
    • next-auth.session-token → use as PERPLEXITY_SESSION_TOKEN
    • next-auth.csrf-token → use as PERPLEXITY_CSRF_TOKEN

Claude Code

claude mcp add perplexity --env PERPLEXITY_SESSION_TOKEN="your-session-token" --env PERPLEXITY_CSRF_TOKEN="your-csrf-token" -- npx -y perplexity-web-api-mcp

Cursor, Claude Desktop & Windsurf

I recommend using the one-click install badge at the top of this README for Cursor.

For manual setup, all these clients use the same mcpServers format:

| Client | Config File | |--------|-------------| | Cursor | ~/.cursor/mcp.json | | Claude Desktop | claude_desktop_config.json | | Windsurf | ~/.codeium/windsurf/mcp_config.json |

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": ["-y", "perplexity-web-api-mcp"],
      "env": {
        "PERPLEXITY_SESSION_TOKEN": "your-session-token",
        "PERPLEXITY_CSRF_TOKEN": "your-csrf-token"
      }
    }
  }
}

VS Code

I recommend using the one-click install badge at the top of this README for VS Code, or for manual setup, add to .vscode/mcp.json:

{
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "perplexity-web-api-mcp"],
      "env": {
        "PERPLEXITY_SESSION_TOKEN": "your-session-token",
        "PERPLEXITY_CSRF_TOKEN": "your-csrf-token"
      }
    }
  }
}

Codex

codex mcp add perplexity --env PERPLEXITY_SESSION_TOKEN="your-session-token" --env PERPLEXITY_CSRF_TOKEN="your-csrf-token" -- npx -y perplexity-web-api-mcp

Other MCP Clients

Most clients can be manually configured to use the mcpServers wrapper in their configuration file (like Cursor). If your client doesn't work, check its documentation for the correct wrapper format.

Available Tools

perplexity_search

Quick web search using Perplexity's turbo model.

Best for: Quick questions, everyday searches, and conversational queries that benefit from web context.

Parameters:

  • query (required): The search query or question
  • sources (optional): Array of sources - "web", "scholar", "social". Defaults to ["web"]
  • language (optional): Language code, e.g., "en-US". Defaults to "en-US"

perplexity_research

Deep, comprehensive research using Perplexity's sonar-deep-research (pplx_alpha) model.

Best for: Complex topics requiring detailed investigation, comprehensive reports, and in-depth analysis. Provides thorough analysis with citations.

Parameters: Same as perplexity_search

perplexity_reason

Advanced reasoning and problem-solving using Perplexity's sonar-reasoning-pro (pplx_reasoning) model.

Best for: Logical problems, complex analysis, decision-making, and tasks requiring step-by-step reasoning.

Parameters: Same as perplexity_search

Response Format

All tools return a JSON response with:

{
  "answer": "The generated answer text...",
  "chunks": [
    // Citation/source chunks from Perplexity
  ],
  "follow_up": {
    "backend_uuid": "uuid-for-follow-up-queries",
    "attachments": []
  }
}

License

MIT