{"_id":"@antonlx/perplexity-web-api-mcp","_rev":"2-5f06e14564123cd4d53bed9034b00f39","name":"@antonlx/perplexity-web-api-mcp","dist-tags":{"latest":"0.12.2"},"versions":{"0.12.1":{"name":"@antonlx/perplexity-web-api-mcp","version":"0.12.1","keywords":["perplexity","mcp","ai","search"],"license":"MIT","_id":"@antonlx/perplexity-web-api-mcp@0.12.1","maintainers":[{"name":"antonlx","email":"antonix@devpins.org"}],"homepage":"https://github.com/AntonIXO/perplexity-web-api-mcp#readme","bugs":{"url":"https://github.com/AntonIXO/perplexity-web-api-mcp/issues"},"bin":{"perplexity-web-api-mcp":"run-perplexity-web-api-mcp.js"},"dist":{"shasum":"22cbdc93d840394eb0893d0285e5991352ad54eb","tarball":"https://registry.npmjs.org/@antonlx/perplexity-web-api-mcp/-/perplexity-web-api-mcp-0.12.1.tgz","fileCount":11,"integrity":"sha512-JaVi8I46bU6aE/Zn8IQ5OYcvyOmCnNHjrK0Pj08SiXAa3ykkK6jnsrnWTDRfUNrFHhJLTV7sNpQ7ZiSRHiH/sQ==","signatures":[{"sig":"MEUCIQCIIfG4GwNzmQb+sXomYg2C6jS31RY6vJY4qYvei4XJ0QIgaWDwsdvORJ25oWVeNWR5MFrqXQ1ho1hNlTEKX+ad4Jo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55576},"_from":"file:npm/perplexity-web-api-mcp-npm-package.tar.gz","volta":{"npm":"9.5.0","node":"18.14.1"},"engines":{"npm":">=6","node":">=14"},"scripts":{"fmt":"prettier --write **/*.js","fmt:check":"prettier --check **/*.js","postinstall":"node ./install.js"},"_npmUser":{"name":"antonlx","email":"antonix@devpins.org"},"_resolved":"/home/runner/work/perplexity-web-api-mcp/perplexity-web-api-mcp/npm/perplexity-web-api-mcp-npm-package.tar.gz","_integrity":"sha512-JaVi8I46bU6aE/Zn8IQ5OYcvyOmCnNHjrK0Pj08SiXAa3ykkK6jnsrnWTDRfUNrFHhJLTV7sNpQ7ZiSRHiH/sQ==","repository":{"url":"git+https://github.com/AntonIXO/perplexity-web-api-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server exposing Perplexity AI search, research, and reasoning tools","directories":{},"_nodeVersion":"20.20.2","dependencies":{"axios":"^1.13.5","rimraf":"^6.1.3","detect-libc":"^2.1.2","console.table":"^0.10.0","axios-proxy-builder":"^0.1.2"},"glibcMinimum":{"major":2,"series":35},"_hasShrinkwrap":true,"devDependencies":{"prettier":"^3.8.1"},"preferUnplugged":true,"supportedPlatforms":{"x86_64-apple-darwin":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz","artifactName":"perplexity-web-api-mcp-x86_64-apple-darwin.tar.xz"},"aarch64-apple-darwin":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz","artifactName":"perplexity-web-api-mcp-aarch64-apple-darwin.tar.xz"},"x86_64-pc-windows-gnu":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip","artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip"},"x86_64-pc-windows-msvc":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip","artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip"},"aarch64-pc-windows-msvc":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip","artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip"},"x86_64-unknown-linux-gnu":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz","artifactName":"perplexity-web-api-mcp-x86_64-unknown-linux-gnu.tar.xz"},"aarch64-unknown-linux-gnu":{"bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz","artifactName":"perplexity-web-api-mcp-aarch64-unknown-linux-gnu.tar.xz"}},"artifactDownloadUrls":["https://github.com/AntonIXO/perplexity-web-api-mcp/releases/download/v0.12.1"],"_npmOperationalInternal":{"tmp":"tmp/perplexity-web-api-mcp_0.12.1_1785334297213_0.5848417722129939","host":"s3://npm-registry-packages-npm-production"}},"0.12.2":{"artifactDownloadUrls":["https://github.com/AntonIXO/perplexity-web-api-mcp/releases/download/v0.12.2"],"bin":{"perplexity-web-api-mcp":"run-perplexity-web-api-mcp.js"},"dependencies":{"axios":"^1.13.5","axios-proxy-builder":"^0.1.2","console.table":"^0.10.0","detect-libc":"^2.1.2","rimraf":"^6.1.3"},"description":"MCP server exposing Perplexity AI search, research, and reasoning tools","devDependencies":{"prettier":"^3.8.1"},"engines":{"node":">=14","npm":">=6"},"glibcMinimum":{"major":2,"series":35},"keywords":["perplexity","mcp","ai","search"],"license":"MIT","name":"@antonlx/perplexity-web-api-mcp","preferUnplugged":true,"repository":{"type":"git","url":"git+https://github.com/AntonIXO/perplexity-web-api-mcp.git"},"scripts":{"fmt":"prettier --write **/*.js","fmt:check":"prettier --check **/*.js","postinstall":"node ./install.js"},"supportedPlatforms":{"aarch64-apple-darwin":{"artifactName":"perplexity-web-api-mcp-aarch64-apple-darwin.tar.xz","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz"},"aarch64-pc-windows-msvc":{"artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip"},"aarch64-unknown-linux-gnu":{"artifactName":"perplexity-web-api-mcp-aarch64-unknown-linux-gnu.tar.xz","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz"},"x86_64-apple-darwin":{"artifactName":"perplexity-web-api-mcp-x86_64-apple-darwin.tar.xz","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz"},"x86_64-pc-windows-gnu":{"artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip"},"x86_64-pc-windows-msvc":{"artifactName":"perplexity-web-api-mcp-x86_64-pc-windows-msvc.zip","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp.exe"},"zipExt":".zip"},"x86_64-unknown-linux-gnu":{"artifactName":"perplexity-web-api-mcp-x86_64-unknown-linux-gnu.tar.xz","bins":{"perplexity-web-api-mcp":"perplexity-web-api-mcp"},"zipExt":".tar.xz"}},"version":"0.12.2","volta":{"node":"18.14.1","npm":"9.5.0"},"_id":"@antonlx/perplexity-web-api-mcp@0.12.2","bugs":{"url":"https://github.com/AntonIXO/perplexity-web-api-mcp/issues"},"homepage":"https://github.com/AntonIXO/perplexity-web-api-mcp#readme","_integrity":"sha512-2gXIinmhUw1GU8BDfcdK5QGqQGM5JByIi1DkcZWHmomutyffkMg7rIfZajwre0NCsXQyxM6xqr4r6nAQWPkLpA==","_resolved":"/home/runner/work/perplexity-web-api-mcp/perplexity-web-api-mcp/npm/perplexity-web-api-mcp-npm-package.tar.gz","_from":"file:npm/perplexity-web-api-mcp-npm-package.tar.gz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-2gXIinmhUw1GU8BDfcdK5QGqQGM5JByIi1DkcZWHmomutyffkMg7rIfZajwre0NCsXQyxM6xqr4r6nAQWPkLpA==","shasum":"b6526db39baedde7fef6b323682ff883636b851d","tarball":"https://registry.npmjs.org/@antonlx/perplexity-web-api-mcp/-/perplexity-web-api-mcp-0.12.2.tgz","fileCount":11,"unpackedSize":57318,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCLn+igF4zQFezVQRoODBf328fL9kBwl3FZmsvGzWdgpAIhAIUk0bkyc3A//1u+O3sE4JmEdNixVpOOAIm67ptb1Ztn"}]},"_npmUser":{"name":"antonlx","email":"antonix@devpins.org"},"directories":{},"maintainers":[{"name":"antonlx","email":"antonix@devpins.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/perplexity-web-api-mcp_0.12.2_1785764705731_0.08581224889229899"},"_hasShrinkwrap":true}},"time":{"created":"2026-07-29T14:11:36.947Z","modified":"2026-08-03T13:45:06.047Z","0.12.1":"2026-07-29T14:11:37.363Z","0.12.2":"2026-08-03T13:45:05.887Z"},"bugs":{"url":"https://github.com/AntonIXO/perplexity-web-api-mcp/issues"},"license":"MIT","homepage":"https://github.com/AntonIXO/perplexity-web-api-mcp#readme","keywords":["perplexity","mcp","ai","search"],"repository":{"type":"git","url":"git+https://github.com/AntonIXO/perplexity-web-api-mcp.git"},"description":"MCP server exposing Perplexity AI search, research, and reasoning tools","maintainers":[{"name":"antonlx","email":"antonix@devpins.org"}],"readme":"# Perplexity Web API MCP Server\n\n<p>\n    <a href=\"https://cursor.com/en/install-mcp?name=perplexity-web&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBhbnRvbmx4L3BlcnBsZXhpdHktd2ViLWFwaS1tY3AiXSwiZW52Ijp7IlBFUlBMRVhJVFlfU0VTU0lPTl9UT0tFTiI6IiJ9fQ==\" target=\"_blank\">\n        <img src=\"https://custom-icon-badges.demolab.com/badge/Install_in_Cursor-000000?style=for-the-badge&logo=cursor-ai-white\" alt=\"Install in Cursor\">\n    </a>\n    <a href=\"https://vscode.dev/redirect/mcp/install?name=perplexity-web&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40antonlx%2Fperplexity-web-api-mcp%22%5D%2C%22env%22%3A%7B%22PERPLEXITY_SESSION_TOKEN%22%3A%22%22%7D%7D\" target=\"_blank\">\n        <img src=\"https://custom-icon-badges.demolab.com/badge/Install_in_VS_Code-007ACC?style=for-the-badge&logo=vsc&logoColor=white\" alt=\"Install in VS Code\">\n    </a>\n    <a href=\"https://www.npmjs.com/package/@antonlx/perplexity-web-api-mcp\" target=\"_blank\">\n        <img\n            src=\"https://img.shields.io/npm/v/%40antonlx%2Fperplexity-web-api-mcp?style=for-the-badge&logo=npm&logoColor=white&color=CB3837\"\n            alt=\"NPM Version\" />\n    </a>\n</p>\n\nMCP (Model Context Protocol) server that exposes Perplexity AI search, research, and reasoning capabilities as tools.\n\nThis repository is the [`AntonIXO` fork](https://github.com/AntonIXO/perplexity-web-api-mcp) of the [original project by `mishamyrt`](https://github.com/mishamyrt/perplexity-web-api-mcp). Fork releases are published as [`@antonlx/perplexity-web-api-mcp`](https://www.npmjs.com/package/@antonlx/perplexity-web-api-mcp).\n\n## No API Key Required\n\nThis MCP server uses your Perplexity account session directly — **no API key needed**.\n\nPerplexity offers a separate [paid API](https://docs.perplexity.ai/guides/pricing) with per-request pricing that is charged independently from your Pro subscription. With this MCP, you don't need to pay for API access — your existing Perplexity subscription (or even a free account) is enough.\n\nSimply extract the session token from your browser cookies, and you're ready to use Perplexity search, research, and reasoning in your IDE.\n\n## Tokenless Mode\n\nThe server can run **without any authentication tokens**. In this mode:\n\n- Only `perplexity_search` (links only) and `perplexity_ask` (answer with sources) are available — `perplexity_research` and `perplexity_reason` require tokens.\n- Both tools use the `turbo` model; `PERPLEXITY_ASK_MODEL` and `PERPLEXITY_REASON_MODEL` cannot be set (the server will throw an error if they are).\n- File attachments (`files` parameter) are unavailable — they require tokens.\n\nTo use tokenless mode, simply omit `PERPLEXITY_SESSION_TOKEN` from your configuration.\n\nFor full access to all tools and model selection, provide your session token as described in the [Configuration](#configuration) section below.\n\n## Requirements\n\n### Supported Platforms\n\n- macOS (arm64, x86_64)\n- Linux (x86_64, aarch64)\n- Windows (x86_64)\n\n## Installation\n\nFor MCP clients, use the npm package directly (no global install required):\n\n```bash\nnpx -y @antonlx/perplexity-web-api-mcp\n```\n\nTo install the latest prebuilt binary on macOS or Linux:\n\n```bash\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/AntonIXO/perplexity-web-api-mcp/releases/latest/download/perplexity-web-api-mcp-installer.sh | sh\n```\n\nOn Windows PowerShell:\n\n```powershell\npowershell -ExecutionPolicy Bypass -c \"irm https://github.com/AntonIXO/perplexity-web-api-mcp/releases/latest/download/perplexity-web-api-mcp-installer.ps1 | iex\"\n```\n\nPlatform archives and checksums are available on the [GitHub Releases page](https://github.com/AntonIXO/perplexity-web-api-mcp/releases/latest).\n\n## Configuration\n\n### Getting Your Token\n\nThis server requires a Perplexity AI account. You need to extract the session token from your browser cookies:\n\n1. Log in to [perplexity.ai](https://www.perplexity.ai) in your browser\n2. Open Developer Tools (F12 or right-click → Inspect)\n3. Go to Application → Cookies → `https://www.perplexity.ai`\n4. Copy the value of `__Secure-next-auth.session-token` → use as `PERPLEXITY_SESSION_TOKEN`\n\n### Environment Variables\n\n- `PERPLEXITY_SESSION_TOKEN` (optional): Perplexity session token (`__Secure-next-auth.session-token` cookie). Required for `perplexity_research`, `perplexity_reason`, `perplexity_computer`, `perplexity_view_chat`, connectors, and file attachments. The CSRF token is fetched automatically — no `PERPLEXITY_CSRF_TOKEN` needed.\n- `PERPLEXITY_ASK_MODEL` (optional, requires token): Model for `perplexity_ask`.\n  Valid values: `turbo`, `pro-auto` (default), `pro-upgraded`, `sonar`, `nemotron-3-super`, `claude-4.6-sonnet`, `claude-4.6-opus`, `gemini-3.0-flash`, `gemini-3.0-pro`, `gpt-5-pro`, `gpt-5.3-codex`, `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.2`, `gpt-5.2-pro`, `grok-4.1`.\n- `PERPLEXITY_REASON_MODEL` (optional, requires token): Model for `perplexity_reason`.\n  Valid values: `gemini-3.1-pro` (default), `gemini-3.0-flash-high`, `claude-4.6-sonnet-thinking`, `claude-4.6-opus-thinking`, `gpt-5-thinking`, `gpt-5.1-thinking`, `gpt-5.2-thinking`, `gpt-5.4-thinking`, `grok-4.1-reasoning`, `kimi-k2.5-thinking`.\n- `PERPLEXITY_COMPUTER_MODEL` (optional, requires token): Model for `perplexity_computer`.\n  Valid values: `asi`, `asi-beta`, `claude-4.6-sonnet` / `claude-4.6-sonnet-thinking`, `claude-4.6-opus` / `claude-4.6-opus-thinking` (default), `gpt-5.4`, `kimi`, `qwen`.\n- **`raw:` escape hatch:** any of the three model vars also accepts `raw:<preference>` to pass an arbitrary Perplexity preference string straight through, for models newer than this build's validated list (e.g. `PERPLEXITY_REASON_MODEL=raw:glm_5_2`). No recompile needed. **Important:** each mode only accepts models from its own family — `PERPLEXITY_ASK_MODEL` takes an \"ask\"-family preference, `PERPLEXITY_REASON_MODEL` takes a \"reasoning\"-family preference, and the two are not interchangeable. Setting a reasoning-only model (e.g. GLM 5.2 via `raw:glm_5_2`) as `PERPLEXITY_ASK_MODEL` will make `perplexity_ask` silently return `answer: null` instead of erroring — Perplexity's backend accepts the (wrong-family) preference string but produces no output for it. If `perplexity_ask` or `perplexity_reason` starts returning `null` answers after changing a model var, check that the model actually belongs to that tool's family before assuming a rate-limit or auth issue. See [Discovering available models](#discovering-available-models) below for how to find which family a model preference belongs to.\n- `PERPLEXITY_TIMEOUT_SECS` (optional, default: `30`): Request timeout in seconds for fast modes (search, ask, reason).\n- `PERPLEXITY_LONG_TIMEOUT_SECS` (optional, default: `600`): Request timeout in seconds for long-running modes — **Deep Research**, Computer, and Document Review. Raise this if deep-research runs are being cut off.\n  **Note:** this timeout lives inside the Perplexity HTTP client only. If you're also being cut off by your *MCP client's own* tool-call timeout (a separate, client-side setting — see [Progress heartbeats](#progress-heartbeats-for-long-running-tools) below), raising this variable alone won't help; you also need to raise (or auto-extend via progress) the client's timeout.\n- `PERPLEXITY_PROGRESS_INTERVAL_SECS` (optional, default: `10`): How often (in seconds) to emit `notifications/progress` heartbeats during a tool call, when the caller's request included a `progressToken`. See [Progress heartbeats](#progress-heartbeats-for-long-running-tools) below.\n- `PERPLEXITY_INCOGNITO` (optional, default: `true`): Whether requests should use Perplexity's incognito mode.\n  Valid values: `true` or `false`\n\n### Discovering Available Models\n\nPerplexity doesn't publish a stable model list in this server's code alone — the typed enums (`SearchModel`, `ReasonModel`, `ComputerModel` in `crates/perplexity-web-api/src/models.rs`) are a **snapshot** that goes stale as Perplexity ships new models. Two live sources let you check what's actually available on your account before using the `raw:` escape hatch:\n\n1. **Model config endpoint** (no login required): [`https://www.perplexity.ai/rest/models/config`](https://www.perplexity.ai/rest/models/config) — returns the full JSON list of every model Perplexity's frontend knows about, grouped by which mode(s) it's valid for (`ask`, `reason`/copilot, `computer`/agentic, etc.) along with its internal `preference` string (the exact value you pass to `raw:<preference>`). This is the authoritative source for \"does model X exist\" and \"which family (ask vs reason vs computer) does it belong to\" — cross-check against this before filing a bug report about a model returning `null`.\n2. **Rate limit / usage endpoint** (requires a logged-in browser session — Cloudflare blocks non-browser requests): [`https://www.perplexity.ai/rest/rate-limit/all`](https://www.perplexity.ai/rest/rate-limit/all) — returns your account's current quota status per feature (`remaining_pro`, `remaining_research`, `remaining_labs`, `remaining_agentic_research`, plus per-source monthly limits). Also exposed as the `perplexity_usage` MCP tool, but that tool call hits the same Cloudflare wall as any other non-browser client and will return an HTTP 403 unless you're proxying through a real browser session (see the code comment on `perplexity_usage` in `crates/perplexity-web-api-mcp/src/server.rs` for the current status of that limitation).\n\nTo pull the config JSON from a terminal:\n\n```bash\ncurl -s 'https://www.perplexity.ai/rest/models/config' | jq .\n```\n\nIf you find a model preference that isn't in the typed enums yet, either (a) use it immediately via `raw:<preference>` — no recompile needed — or (b) open a PR adding it to `models.rs` so it gets schema validation and shows up in tool descriptions.\n\n### Progress Heartbeats for Long-Running Tools\n\n`perplexity_research`, `perplexity_computer`, and `perplexity_document_review` (and, less commonly, `perplexity_reason` on a heavy query) can legitimately hold Perplexity's SSE connection open for **minutes** with no intermediate bytes — this looks identical to a hung request from an MCP client's point of view.\n\nPer the [MCP Lifecycle spec's Timeouts section](https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle#timeouts), a client **MAY** reset its own per-request timeout clock every time it receives a `notifications/progress` message tied to that request's `progressToken` — but the spec doesn't let a *server* force this; it's entirely a client-side opt-in (`resetTimeoutOnProgress` in the TypeScript SDK, or equivalent in other clients). A `SHOULD`-level absolute maximum timeout still applies on top, regardless of progress notifications, so this cannot make a request run forever.\n\nThis server implements the server side of that contract:\n\n- If (and only if) the caller's `tools/call` request includes `_meta.progressToken`, a background task sends a `notifications/progress` message every `PERPLEXITY_PROGRESS_INTERVAL_SECS` (default 10s) for the duration of the call.\n- `progress` is a monotonically increasing tick counter — Perplexity's streaming search API doesn't expose a real percent-complete signal, and the spec only requires `progress` to increase, not to mean anything specific. `message` explains this in plain English for clients that surface it to a human (\"Still working — Perplexity request in flight, no timeout yet.\").\n- The heartbeat is a `tokio` task tied to the tool call's lifetime: it's spawned right before the underlying HTTP request and aborted on drop, whichever way the call ends (success, error, or client cancellation).\n- No `progressToken` in the request → **zero overhead**, no task is spawned.\n\n**This does not replace `PERPLEXITY_LONG_TIMEOUT_SECS`** — that variable still governs how long this server's own HTTP client will wait for Perplexity's API before giving up. The two settings solve different halves of the same problem: `PERPLEXITY_LONG_TIMEOUT_SECS` controls how long *this server* is willing to wait, and the progress heartbeat controls how long *your MCP client* is willing to wait, provided your client supports `resetTimeoutOnProgress` (or equivalent) and actually sends a `progressToken`. Many MCP clients (including some simple stdio wrappers) don't set a `progressToken` at all, in which case only the client's static configured timeout applies and you'll need to raise that directly in your client's config.\n\n### Claude Code\n\n```bash\nclaude mcp add perplexity --env PERPLEXITY_SESSION_TOKEN=\"your-session-token\" -- npx -y @antonlx/perplexity-web-api-mcp\n```\n\n### Cursor, Claude Desktop & Windsurf\n\nI recommend using the one-click install badge at the top of this README for Cursor.\n\nFor manual setup, all these clients use the same `mcpServers` format:\n\n| Client | Config File |\n|--------|-------------|\n| Cursor | `~/.cursor/mcp.json` |\n| Claude Desktop | `claude_desktop_config.json` |\n| Windsurf | `~/.codeium/windsurf/mcp_config.json` |\n\n```json\n{\n  \"mcpServers\": {\n    \"perplexity\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@antonlx/perplexity-web-api-mcp\"],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your-session-token\"\n      }\n    }\n  }\n}\n```\n\n### Zed\n\nAdd following following to `context_servers` in your [settings file](https://zed.dev/docs/configuring-zed.html#settings-files):\n\n```json\n{\n  \"context_servers\": {\n    \"perplexity\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@antonlx/perplexity-web-api-mcp\"],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your-session-token\"\n      }\n    }\n  }\n}\n```\n\n### VS Code\n\nI 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`:\n\n```json\n{\n  \"servers\": {\n    \"perplexity\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@antonlx/perplexity-web-api-mcp\"],\n      \"env\": {\n        \"PERPLEXITY_SESSION_TOKEN\": \"your-session-token\"\n      }\n    }\n  }\n}\n```\n\n### Codex\n\n```bash\ncodex mcp add perplexity --env PERPLEXITY_SESSION_TOKEN=\"your-session-token\" -- npx -y @antonlx/perplexity-web-api-mcp\n```\n\n### Building from Source\n\nSource build instructions, including optional cargo features, are documented in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n### Other MCP Clients\n\nMost 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.\n\n## Docker\n\nBuild the fork's image locally:\n\n```bash\ndocker build -t perplexity-web-api-mcp .\n\ndocker run -d \\\n  -p 8080:8080 \\\n  -e PERPLEXITY_SESSION_TOKEN=\"your-session-token\" \\\n  perplexity-web-api-mcp\n```\n\nThe container exposes the MCP server via Streamable HTTP at `http://localhost:8080/mcp`.\nThe Docker image is built with `--features streamable-http`; local/source builds need the same feature if you want HTTP transport.\n\nConfigure your MCP client to connect:\n\n```json\n{\n  \"mcpServers\": {\n    \"perplexity\": {\n      \"url\": \"http://localhost:8080/mcp\"\n    }\n  }\n}\n```\n\n### Environment Variables (Docker-specific)\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `MCP_TRANSPORT` | `streamable-http` | Transport mode. `stdio` or `streamable-http` (requires the `streamable-http` cargo feature) |\n| `MCP_HOST` | `0.0.0.0` | Host address to bind |\n| `MCP_PORT` | `8080` | Port to listen on |\n\nThe [authentication token, model variables, and incognito flag](#configuration) described above work the same way in Docker.\n\n## Available Tools\n\n### `perplexity_search`\n\nQuick web search using the `turbo` model. Returns only links, titles, and snippets — no generated answer.\n\n**Best for:** Finding relevant URLs and sources quickly.\n\n**Parameters:**\n\n- `query` (required): The search query or question\n- `sources` (optional): Array of sources — `\"web\"`, `\"scholar\"`, `\"social\"`, plus connectors like\n  `\"google_drive\"`, `\"gcal\"` / `\"google_calendar\"`, `\"github_mcp_direct\"` / `\"github\"`,\n  `\"hugging_face\"` / `\"huggingface\"`, `\"notion_mcp\"` / `\"notion\"`, `\"linear_alt\"` / `\"linear\"`,\n  `\"slack_direct\"` / `\"slack\"`, `\"jira_mcp_merge\"` / `\"jira\"`, `\"confluence_mcp_merge\"` / `\"confluence\"`,\n  `\"microsoft_teams_mcp_merge\"` / `\"teams\"`, `\"onedrive\"`, `\"sharepoint\"`, `\"dropbox\"`, `\"box\"`.\n  Unknown connector IDs are passed through unchanged. Defaults to `[\"web\"]`\n- `language` (optional): Language code, e.g., `\"en-US\"`. Defaults to `\"en-US\"`\n\n> File attachments are not supported by this tool.\n\n### `perplexity_ask`\n\nAsk Perplexity AI a question and get a comprehensive answer with source citations. By default uses the best model (Pro auto mode) when authenticated, or `turbo` in tokenless mode. Can be configured via `PERPLEXITY_ASK_MODEL`.\n\n**Best for:** Getting detailed answers to questions with web context.\n\n**Parameters:** Same as `perplexity_search`, plus:\n\n- `files` (optional, requires token): Array of file attachments for document analysis. See [File Attachments](#file-attachments).\n\n### `perplexity_reason`\n\nAdvanced reasoning and problem-solving. By default uses Perplexity's `sonar-reasoning` model, but can be configured via `PERPLEXITY_REASON_MODEL`.\n\n**Best for:** Logical problems, complex analysis, decision-making, and tasks requiring step-by-step reasoning.\n\n**Parameters:** Same as `perplexity_ask`.\n\n### `perplexity_research`\n\nDeep, comprehensive research using Perplexity's sonar-deep-research (`pplx_alpha`) model.\n\n**Best for:** Complex topics requiring detailed investigation, comprehensive reports, and in-depth analysis. Provides thorough analysis with citations.\n\n**Parameters:** Same as `perplexity_ask`.\n\n### `perplexity_view_chat`\n\nLoads the context of an existing Perplexity search/chat and asks Perplexity to extract or summarize it.\n\n**Parameters:**\n\n- `url_or_id` (required): Full `perplexity.ai/search/...` URL, thread UUID, or thread slug\n- `query` (optional): A specific question about the thread. By default, returns a detailed question-by-question breakdown\n\nRequires `PERPLEXITY_SESSION_TOKEN`. Internally this uses Perplexity's follow-up mechanism, so the inspection query may appear as a new turn in the referenced thread.\n\n## File Attachments\n\n`perplexity_ask`, `perplexity_research`, and `perplexity_reason` accept an optional `files` parameter for document analysis. **Requires authentication token.**\n\nEach entry in the `files` array must have:\n\n- `filename` (required): Filename with extension, e.g. `\"report.pdf\"` or `\"notes.txt\"`\n- `text` (mutually exclusive with `data`): Plain-text file content. Use for `.txt`, `.md`, `.csv`, `.json`, source code, etc.\n- `data` (mutually exclusive with `text`): Base64-encoded binary content. Use for `.pdf`, `.docx`, images, etc.\n\n**Example — plain text:**\n\n```json\n{\n  \"query\": \"Summarise the key points\",\n  \"files\": [\n    {\n      \"filename\": \"notes.txt\",\n      \"text\": \"Meeting notes: Q1 revenue up 12%...\"\n    }\n  ]\n}\n```\n\n**Example — binary file (PDF):**\n\n```json\n{\n  \"query\": \"What does this contract say about termination?\",\n  \"files\": [\n    {\n      \"filename\": \"contract.pdf\",\n      \"data\": \"JVBERi0xLjQK...\"\n    }\n  ]\n}\n```\n\nMultiple files can be passed in a single request — they are uploaded to Perplexity's storage in parallel before the query is sent.\n\n## Response Format\n\n`perplexity_search` returns only web results:\n\n```json\n{\n  \"web_results\": [\n    {\n      \"name\": \"Source name\",\n      \"url\": \"https://example.com\",\n      \"snippet\": \"Source snippet\"\n    }\n  ]\n}\n```\n\n`perplexity_ask`, `perplexity_research`, and `perplexity_reason` return a full response:\n\n```json\n{\n  \"answer\": \"The generated answer text...\",\n  \"web_results\": [\n    {\n      \"name\": \"Source name\",\n      \"url\": \"https://example.com\",\n      \"snippet\": \"Source snippet\"\n    }\n  ],\n  \"follow_up\": {\n    \"backend_uuid\": \"uuid-for-follow-up-queries\",\n    \"attachments\": []\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}