perplexity-ai
CLAUDE.md168 starsChanged 2 months agoMITView on GitHub
Perplexity MCP Server - An unofficial Python API for Perplexity.ai that exposes search capabilities via MCP (Model Context Protocol) and OpenAI-compatible endpoints. Supports multi-token pools for load balancing, health monitoring, and various search modes. Core Flow: main.py → app.py (FastMCP instance + middleware) → route modules (mcp.py, oai.py, admin.py) Key Components: - perplexity/server/app.py - FastMCP app, auth middleware, run_query() core logic, ClientPool singleton - perplexity/server/mcp.py - MCP tool definitions: list_models, search, research - perplexity/server/oai.py - OpenAI-compatible API: /v1/models, /v1/chat/completions -…
In this repository4 other files it gives its agents.
- perplexity-searchSkill
- server-deploySkill
- bump-versionSkill
- perplexity-searchSkill
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 58
Use type hints where appropriate
- Very specific: line 62
Use perplexity-mcp tools instead of webSearch for web search functionality.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Perplexity MCP Server - An unofficial Python API for Perplexity.ai that exposes search capabilities via MCP (Model Context Protocol) and OpenAI-compatible endpoints. Supports multi-token pools for load balancing, health monitoring, and various search modes.
Commands
# Install dependencies
uv sync
# Run the server (default: HTTP on port 8000)
uv run perplexity
# Run with specific transport
uv run perplexity --transport http --host 0.0.0.0 --port 8000
# Run tests
uv run pytest
# Run a single test file
uv run pytest tests/test_client_pool.py
# Run with coverage
uv run pytest --cov=perplexity
# Format code
uv run black perplexity tests
uv run isort perplexity tests
# Docker deployment
docker compose up -dArchitecture
Core Flow: main.py → app.py (FastMCP instance + middleware) → route modules (mcp.py, oai.py, admin.py)
Key Components:
perplexity/server/app.py- FastMCP app, auth middleware,run_query()core logic, ClientPool singletonperplexity/server/mcp.py- MCP tool definitions:list_models,search,researchperplexity/server/oai.py- OpenAI-compatible API:/v1/models,/v1/chat/completionsperplexity/server/admin.py- Health check, token pool management, heartbeat controlperplexity/server/client_pool.py- Multi-account connection pool with load balancing and exponential backoffperplexity/client.py- Low-level Perplexity API client using WebSocket
Configuration:
token_pool_config.json- Token pool and heartbeat settings- Environment variables:
MCP_TOKEN,PPLX_ADMIN_TOKEN,SOCKS_PROXY
Code Style
- Line length: 100 characters (black/isort configured in pyproject.toml)
- Python 3.10+
- Use type hints where appropriate
Web Search
Use perplexity-mcp tools instead of webSearch for web search functionality.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

