Perplexity MCP Server (Python)
A Python port of the official Perplexity MCP server that enables web-grounded Q\&A, deep research, and step-by-step reasoning via Perplexity AI's models. It supports both STDIO and HTTP interfaces for seamless integration with tools like Claude Desktop and Cursor.
README
Perplexity MCP Server — Python Port
Python conversion of the official perplexityai/modelcontextprotocol Node.js/TypeScript server.
File mapping
| TypeScript (original) | Python (this port) | Notes |
|---|---|---|
src/types.ts |
types.py |
Dataclasses replace TS interfaces |
src/validation.ts |
validation.py |
Pydantic models replace Zod schemas |
src/logger.ts |
logger.py |
Direct translation |
src/server.ts |
server.py |
Core MCP tools + API logic |
src/index.ts |
__main__.py |
STDIO entry point |
src/http.ts |
http_server.py |
HTTP entry point (FastAPI + uvicorn) |
Dependencies
| Node.js | Python |
|---|---|
@modelcontextprotocol/sdk |
mcp |
axios / undici (fetch) |
httpx |
zod |
pydantic |
express + cors |
fastapi + CORSMiddleware |
| Node.js built-ins | Python stdlib (asyncio, re, json, …) |
Installation
pip install -e .
Usage
STDIO (for Claude Desktop, Cursor, VS Code…)
export PERPLEXITY_API_KEY=your_key_here
python -m perplexity_mcp
# or after pip install:
perplexity-mcp
Claude Desktop / Cursor mcpServers config:
{
"mcpServers": {
"perplexity": {
"command": "perplexity-mcp",
"env": { "PERPLEXITY_API_KEY": "your_key_here" }
}
}
}
HTTP server
export PERPLEXITY_API_KEY=your_key_here
python -m perplexity_mcp.http_server
# or after pip install:
perplexity-mcp-http
The server listens on http://0.0.0.0:8080/mcp by default.
Environment variables
| Variable | Description | Default |
|---|---|---|
PERPLEXITY_API_KEY |
Perplexity API key (required) | — |
PERPLEXITY_BASE_URL |
Custom API base URL | https://api.perplexity.ai |
PERPLEXITY_TIMEOUT_MS |
Request timeout in ms | 300000 |
PERPLEXITY_PROXY |
Proxy URL | — |
HTTPS_PROXY / HTTP_PROXY |
Fallback proxy env vars | — |
PERPLEXITY_LOG_LEVEL |
DEBUG|INFO|WARN|ERROR |
ERROR |
PORT |
HTTP server port | 8080 |
BIND_ADDRESS |
HTTP bind address | 0.0.0.0 |
ALLOWED_ORIGINS |
CORS origins (comma-separated) | * |
Available tools
| Tool | Model | Description |
|---|---|---|
perplexity_ask |
sonar-pro |
Quick Q&A with web grounding |
perplexity_research |
sonar-deep-research |
Deep multi-source research (30s+) |
perplexity_reason |
sonar-reasoning-pro |
Step-by-step reasoning + web |
perplexity_search |
Search API | Raw ranked URL results |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.