Perplexity WebUI Scraper logo

Perplexity WebUI Scraper

Community
henrique-coder

An advanced, high-performance Python client, MCP server, and REST API for reverse-engineering Perplexity AI's WebUI.

Publisherhenrique-coder
Repositoryperplexity-webui-scraper
LanguagePython
Forks
27
Stars
130
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Perplexity WebUI Scraper exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    130 stars and 27 forks from the linked repository.

Perplexity WebUI Scraper

Python scraper to extract AI responses from Perplexity's web interface.

PyPI Python License

Documentation: perplexity-webui-scraper.readthedocs.io

About

This unofficial library uses Perplexity's internal WebUI endpoints with a browser session token. It supports conversations, file uploads, streaming, an MCP server, and an OpenAI-compatible REST API.

A Perplexity account and its browser session token are required. Free accounts support text prompts; paid tiers are required for Pro/Max models and file uploads.

Community

Installation

Install the package depending on your use case:

This project is distributed as a Python package on PyPI and as optional container images on GHCR. GitHub Releases contain the Python wheel and source distribution; native standalone executables are not published.

Core library

Install the core Python library without optional features.

bash
uv add perplexity-webui-scraper

All optional features

Install the cli, api, and mcp extras together.

bash
uv add "perplexity-webui-scraper[all]"

CLI tools

Install with terminal UX dependencies to use the interactive chat and token CLI commands.

bash
uv add "perplexity-webui-scraper[cli]"

Servers

Install dependencies required for the MCP Server or the OpenAI-compatible REST API.

bash
# MCP Server for AI agents
uv add "perplexity-webui-scraper[mcp]"

# OpenAI-compatible API server
uv add "perplexity-webui-scraper[api]"

Quick Start

1. Get your session token

bash
# Interactive email authentication
uv run perplexity-webui-scraper token

Or retrieve __Secure-next-auth.session-token manually from your browser cookies on perplexity.ai.

2. Basic usage

python
from perplexity_webui_scraper import Perplexity

client = Perplexity(session_token="YOUR_TOKEN")
conversation = client.create_conversation()

print(client.get_account_profile().account_tier)

conversation.ask("What is quantum computing?")
print(conversation.answer)

# Follow-ups preserve context automatically
conversation.ask("Explain it simpler")
print(conversation.answer)

Before each prompt, the library checks /api/auth/session and raises ModelAccessError if an available model requires a higher tier than the authenticated account. When the session payload does not expose enough subscription data, it falls back to /rest/user/settings. Models use one of three statuses: available (confirmed working normally), unknown (not yet verified, including custom identifiers), or unavailable (confirmed not working). is_official separately records whether a model is listed in Perplexity's official WebUI. last_tested_at records the last test in ISO 8601 UTC and is null for untested models. Any non-available status requires allow_risky_model=True; after acknowledgement, the backend makes the final entitlement decision. Free accounts can use text prompts, but file attachments raise FileAccessError.

perplexity/best adapts to the account tier: free accounts use Perplexity's internal turbo preference, while Pro/Max accounts use pplx_pro_upgraded; both use copilot mode.

3. Streaming

python
for chunk in conversation.ask("Explain AI", stream=True):
    if chunk.last_chunk:
        print(chunk.last_chunk, end="", flush=True)

4. Choose a model

python
from perplexity_webui_scraper import ConversationConfig

conversation = client.create_conversation(ConversationConfig(model="perplexity/best"))
conversation.ask("Solve this step by step: ...")
print(conversation.answer)

5. List registered models

python
from perplexity_webui_scraper import MODELS

for model in MODELS.list_all():
    print(f"{model.id:40} {model.name}")

Available CLI

CommandExtraDescription
perplexity-webui-scraper tokencliInteractive email auth wizard to generate a session token (supports TOTP 2FA)
perplexity-webui-scraper chatcliAsk Perplexity AI questions with real-time streaming output
perplexity-webui-scraper chat setupcliConfigure saved token and default model for the chat command
perplexity-webui-scraper mcpmcpStart the MCP server
perplexity-webui-scraper apiapiStart the OpenAI-compatible REST API server

OpenAI-Compatible API

Run a local server that accepts the supported OpenAI chat-completions fields and forwards requests to Perplexity. Each request passes the Perplexity session token through Authorization: Bearer.

bash
# Start the server (no token needed at startup)
perplexity-webui-scraper api

# Custom host and port
perplexity-webui-scraper api --host 0.0.0.0 --port 8080

# Development mode with auto-reload
perplexity-webui-scraper api --reload

Running via Container (Podman)

bash
# Pull the published multi-arch API image
podman pull ghcr.io/henrique-coder/perplexity-webui-scraper:latest

# Run the server (exposing port 8000)
podman run --rm -p 8000:8000 ghcr.io/henrique-coder/perplexity-webui-scraper:latest

Optional MCP image for containerized stdio setups:

bash
# Pull the published multi-arch MCP image
podman pull ghcr.io/henrique-coder/perplexity-webui-scraper:mcp

# Run MCP server (requires token)
podman run --rm -e PERPLEXITY_SESSION_TOKEN=your_token ghcr.io/henrique-coder/perplexity-webui-scraper:mcp

For local development, you can still build the provided container files:

bash
# API image: installs the `api` extra, exposes port 8000, and starts the REST server.
podman build -t perplexity-api -f Containerfile .
podman run --rm -it -p 8000:8000 perplexity-api

# MCP image: installs the `mcp` extra and starts the stdio MCP server. It does not expose an HTTP port.
podman build -t perplexity-mcp -f Containerfile.mcp .
podman run --rm -it -e PERPLEXITY_SESSION_TOKEN=your_token perplexity-mcp

CLI options

OptionShortDefaultDescription
--host-H127.0.0.1Bind address
--port-p8000Port to listen on
--reloadFalseEnable auto-reload (dev)
--log-levelinfoUvicorn log level

Authentication

Pass your Perplexity session token as the API key in every request:

bash
# curl
export PERPLEXITY_SESSION_TOKEN="your_session_token"
curl http://localhost:8000/v1/chat/completions \
  -H "Authorization: Bearer $PERPLEXITY_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model": "perplexity/best", "messages": [{"role": "user", "content": "Hello!"}]}'

# Streaming
curl -N http://localhost:8000/v1/chat/completions \
  -H "Authorization: Bearer $PERPLEXITY_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model": "perplexity/best", "messages": [{"role": "user", "content": "Hello!"}], "stream": true}'
python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="YOUR_SESSION_TOKEN",  # sent as Authorization: Bearer automatically
)

response = client.chat.completions.create(
    model="perplexity/best",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

API endpoints

MethodPathDescription
GET/v1/modelsList registered models
POST/v1/chat/completionsChat completion (streaming + non-streaming)
GET/docsInteractive Swagger UI
GET/redocReDoc documentation

Fields not supported by Perplexity (e.g. temperature, top_p) are accepted for client compatibility but silently ignored.

MCP Server

Expose every Perplexity model as a separate tool for AI agents (Claude Desktop, Antigravity, etc.):

json
{
  "mcpServers": {
    "perplexity-webui-scraper": {
      "command": "uvx",
      "args": [
        "--from",
        "perplexity-webui-scraper[mcp]@latest",
        "perplexity-webui-scraper",
        "mcp"
      ],
      "env": { "PERPLEXITY_SESSION_TOKEN": "your_token_here" }
    }
  }
}

See the MCP documentation for tools and configuration.

Disclaimer

This is an unofficial library. It uses internal APIs that may change without notice. Use at your own risk. By using this library, you agree to Perplexity AI's Terms of Service.

Installation

TypingMind
{
  "mcpServers": {
    "perplexity-webui-scraper": {
      "command": "uvx",
      "args": [
        "--from",
        "perplexity-webui-scraper[mcp]@latest",
        "perplexity-webui-scraper-mcp"
      ],
      "env": {
        "PERPLEXITY_SESSION_TOKEN": "<PERPLEXITY_SESSION_TOKEN>"
      }
    }
  }
}

Use Perplexity WebUI Scraper MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Perplexity WebUI Scraper is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Perplexity WebUI Scraper as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Perplexity WebUI Scraper MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "perplexity-webui-scraper": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Perplexity WebUI Scraper MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Perplexity WebUI Scraper MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Perplexity WebUI Scraper to help me with this task?
Perplexity WebUI Scraper
Sure. I read it.
Here is what I found using Perplexity WebUI Scraper.

Option 2: Add an MCP server URL

Use this when Perplexity WebUI Scraper is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter the MCP server URL from the provider in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste the MCP server URL from the provider into the Server URL field.
  2. Enter a connection name for Perplexity WebUI Scraper.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Perplexity WebUI Scraper connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Perplexity WebUI Scraper tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Perplexity WebUI Scraper tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Perplexity WebUI Scraper to help me with this task?
Perplexity WebUI Scraper
Sure. I read it.
Here is what I found using Perplexity WebUI Scraper.

Frequently asked questions

What is the Perplexity WebUI Scraper MCP server used for?

Perplexity WebUI Scraper is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Perplexity WebUI Scraper MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Perplexity WebUI Scraper with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Perplexity WebUI Scraper MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Perplexity WebUI Scraper connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Perplexity WebUI Scraper MCP to TypingMind?

Perplexity WebUI Scraper can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Perplexity WebUI Scraper MCP provide in TypingMind?

Perplexity WebUI Scraper exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Perplexity WebUI Scraper MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Perplexity WebUI Scraper requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇