perplexity-mcp
Provides tools for AI-powered search and deep research using Perplexity's Pro Search, Reasoning, and Deep Research capabilities with multi-account pooling, automatic failover, and zero-cost health monitoring.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@perplexity-mcpresearch the benefits of intermittent fasting"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
The only Perplexity MCP server with multi-account pooling, an admin dashboard, and zero-cost monitoring. No API keys. No per-query fees. Uses your existing Perplexity Pro session.
Features Β· Quick Start Β· Admin Panel Β· Configuration Β· Architecture
π― Why This One?
Most Perplexity MCP servers are single-account wrappers around the paid Sonar API. This one is different:
π No API costs β uses session cookies, not the paid API. Same features, zero per-query fees
π Multi-account pool β round-robin across N accounts with automatic failover
π Admin dashboard β React UI to monitor quotas, manage tokens, tail logs in real-time
β€οΈ Zero-cost health checks β monitors all accounts via rate-limit API without consuming queries
π‘οΈ Downgrade protection β detects when Perplexity silently returns a regular result instead of deep research
π± Telegram alerts β get notified when tokens expire or quota runs out
Related MCP server: Perplexity Web-Search MCP
β¨ Features
π Smart Search
Pro Search β fast, accurate answers with citations
Reasoning β multi-model thinking for complex decisions
Deep Research β comprehensive 10-30+ citation reports
Multi-source β web, scholar, and social
π€ 9 Models Available
sonarΒ·gpt-5.2Β·claude-4.5-sonnetΒ·grok-4.1gpt-5.2-thinkingΒ·claude-4.5-sonnet-thinkinggemini-3.0-proΒ·kimi-k2-thinkingΒ·grok-4.1-reasoning
π Token Pool Engine
Round-robin rotation across accounts
Exponential backoff on failures (60s β 120s β ... β 1h cap)
3-level fallback β Pro β auto (exhausted) β anonymous
Smart quota tracking β decrements locally, verifies at zero
Hot-reload β add/remove tokens without restart
π‘οΈ Production Hardened
Silent deep research downgrade detection
Atomic config saves (no corruption on crash)
Connection drop handling
Cross-process state sharing via
pool_state.json53 unit tests
πΌοΈ Screenshots
Token Pool Dashboard
Stats grid, monitor controls, sortable token table with per-account quotas (Pro / Research / Agentic), filter pills, and one-click actions.
Log Viewer
Live log streaming with auto-refresh, level filtering, search highlighting, follow mode, and line numbers.
π Quick Start
1. Clone & Install
git clone https://github.com/teoobarca/perplexity-mcp.git
cd perplexity-mcp
uv sync2. Add to Your AI Tool
claude mcp add perplexity -s user -- uv --directory /path/to/perplexity-mcp run perplexity-mcpGo to Settings β MCP β Add new server and paste:
{
"command": "uv",
"args": ["--directory", "/path/to/perplexity-mcp", "run", "perplexity-mcp"]
}Add to your MCP config file:
{
"mcpServers": {
"perplexity": {
"command": "uv",
"args": ["--directory", "/path/to/perplexity-mcp", "run", "perplexity-mcp"]
}
}
}That's it. Works immediately with anonymous sessions. Add your tokens for Pro access β see Authentication.
π οΈ Tools
Two MCP tools with LLM-optimized descriptions so your AI assistant picks the right one automatically:
perplexity_ask
AI-powered answer engine for tech questions, documentation lookups, and how-to guides.
Parameter | Type | Default | Description |
| string | required | Natural language question with context |
| string |
| Model selection (see models) |
| array |
| Sources: |
| string |
| ISO 639 language code |
Mode auto-detection: Models with thinking or reasoning in the name automatically switch to Reasoning mode.
"gpt-5.2" β Pro Search
"gpt-5.2-thinking" β Reasoning Mode β auto-detectedperplexity_research
Deep research agent for comprehensive analysis. Returns extensive reports with 10-30+ citations.
Parameter | Type | Default | Description |
| string | required | Detailed research question with full context |
| array |
| Sources: |
| string |
| ISO 639 language code |
Deep research takes 2-5 minutes per query. Provide detailed context and constraints for better results. The server has a 15-minute timeout to accommodate this.
π₯οΈ Admin Panel
A built-in web dashboard for managing your token pool. Start it with:
perplexity-serverOpens automatically at http://localhost:8123/admin/
Feature | Description |
π Stats Grid | Total clients, Online/Exhausted counts, Monitor status |
π Token Table | Sortable columns, filter pills (Online/Exhausted/Offline/Unknown), icon actions |
π° Quota Column | Per-token breakdown β Pro remaining, Research quota, Agentic research |
β€οΈ Health Monitor | Zero-cost checks via rate-limit API, configurable interval |
π± Telegram Alerts | Notifications on token state changes (expired, exhausted, back online) |
π Fallback Toggle | Enable/disable automatic Pro β free fallback |
π₯ Import/Export | Bulk token management via JSON config files |
π Log Viewer | Live streaming, level filter (Error/Warning/Info/Debug), search, follow mode |
π§ͺ Test Button | Run health check on individual tokens or all at once |
π Authentication
By default, the server uses anonymous Perplexity sessions (rate limited). For Pro access, add your session tokens.
How to Get Tokens
Sign in at perplexity.ai
Open DevTools (F12) β Application β Cookies
Copy these two cookies:
next-auth.csrf-tokennext-auth.session-token
Single Token
Create token_pool_config.json in the project root:
{
"tokens": [
{
"id": "my-account",
"csrf_token": "your-csrf-token-here",
"session_token": "your-session-token-here"
}
]
}Multi-Token Pool
Add multiple accounts for round-robin rotation with automatic failover:
{
"monitor": {
"enable": true,
"interval": 6,
"tg_bot_token": "optional-telegram-bot-token",
"tg_chat_id": "optional-chat-id"
},
"fallback": {
"fallback_to_auto": true
},
"tokens": [
{ "id": "account-1", "csrf_token": "...", "session_token": "..." },
{ "id": "account-2", "csrf_token": "...", "session_token": "..." },
{ "id": "account-3", "csrf_token": "...", "session_token": "..." }
]
}Session tokens last ~30 days. The monitor detects expired tokens and alerts you via Telegram.
βοΈ Configuration
Environment Variables
Variable | Default | Description |
|
| Request timeout in seconds (15 min for deep research) |
| β | SOCKS5 proxy URL ( |
Token States
Token state is computed automatically from session_valid + rate_limits (never set manually):
State | Meaning | Badge | Behavior |
π’ | Session valid, pro quota available | Online | Used for all requests |
π‘ | Session valid, pro quota = 0 | Exhausted | Skipped for Pro, used as auto fallback |
π΄ | Session invalid/expired | Offline | Not used for any requests |
π΅ | Not yet checked | Unknown | Used normally (quota assumed available) |
Fallback Chain
When a Pro request fails, the server tries progressively:
1. β
Next client with Pro quota (round-robin)
2. β
Next client with Pro quota ...
3. π‘ Any available client (auto mode)
4. π΅ Anonymous session (auto mode)
5. β Error returned to callerποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your AI Assistant (Claude Code / Cursor / Windsurf) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β MCP (stdio)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β perplexity-mcp β
β ββββββββββββββββββ ββββββββββββββββββββββββββββββββββ β
β β tools.py β β server.py β β
β β β’ ask ββββ β’ Pool state sync β β
β β β’ research β β β’ Timeout handling β β
β ββββββββββββββββββ ββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend Engine (perplexity/) β
β β
β βββββββββββββββ ββββββββββββββββ ββββββββββββββββββ β
β β client.py β β client_pool β β admin.py β β
β β β’ Search β β β’ Rotation β β β’ REST API β β
β β β’ Upload β β β’ Backoff β β β’ Static β β
β β β’ Validate β β β’ Monitor β β files β β
β ββββββββ¬ββββββββ β β’ Fallback β ββββββββββ¬ββββββββ β
β β ββββββββββββββββ β β
β βΌ βΌ β
β βββββββββββββββ ββββββββββββββββββ β
β β Perplexity β β React Admin UI β β
β β (web API) β β :8123/admin/ β β
β βββββββββββββββ ββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββComponent | File | Role |
MCP Server |
| Stdio transport, pool state sync, timeout handling |
Tool Definitions |
| 2 MCP tools with LLM-optimized descriptions |
API Client |
| Perplexity API via curl_cffi (bypasses Cloudflare) |
Client Pool |
| Round-robin, backoff, monitor, state persistence |
Query Engine |
| Rotation loop, 3-level fallback, validation |
Admin API |
| REST endpoints + static file serving |
Admin UI |
| React + Vite + Tailwind dashboard |
π§ͺ Development
# Install in development mode
uv pip install -e ".[dev]" --python .venv/bin/python
# Run unit tests (53 tests)
.venv/bin/python -m pytest tests/ -v
# Frontend development
cd perplexity/server/web
npm install
npm run dev # Dev server with proxy to :8123
npm run build # Production buildProject Structure
src/ # MCP stdio server (thin wrapper)
server.py # Entry point, pool state sync
tools.py # Tool definitions
perplexity/ # Backend engine
client.py # Perplexity API client (curl_cffi)
config.py # Constants, endpoints, model mappings
exceptions.py # Custom exception hierarchy
logger.py # Centralized logging
server/
app.py # Starlette app, query engine
client_pool.py # ClientPool, rotation, monitor
admin.py # Admin REST API
utils.py # Validation helpers
main.py # HTTP server entry point
web/ # React admin frontend (Vite + Tailwind)
tests/ # 53 unit testsβ οΈ Limitations
Unofficial β uses Perplexity's web interface, may break if they change it
Cookie-based auth β session tokens expire after ~30 days
Rate limits β anonymous sessions have strict query limits
Deep research β takes 2-5 minutes per query (this is normal)
π License
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceProvides AI assistants with real-time web search, reasoning, and research capabilities through Perplexity's Sonar models and Search API. Supports quick searches, deep research, advanced reasoning, and direct web search with ranked results.435,7212,442MIT
- FlicenseBqualityDmaintenanceEnables AI assistants to perform real-time web and academic searches using Perplexity's Sonar API.2
- AlicenseAqualityFmaintenanceEnables AI-powered web research using your existing Perplexity Pro subscription, providing tools for search, follow-up conversations, and thread management through the Model Context Protocol.419MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to perform web searches and retrieve real-time information using Perplexity AI's Sonar models, with support for multiple search modes and easy integration with MCP clients.51MIT
Related MCP Connectors
The best web search for your AI Agent
Web search for AI agents β one tool across 6 engines, routed to the cheapest + cached.
Enable language models to perform advanced AI-powered web scraping with enterprise-grade reliabiliβ¦
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/teoobarca/perplexity-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server