Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/perplexityai/modelcontextprotocol/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Perplexity MCP Server is configured through environment variables. This page documents all available configuration options for both stdio and HTTP server modes.

Core Environment Variables

PERPLEXITY_API_KEY

PERPLEXITY_API_KEY
string
required
Your Perplexity API key from the API Portal
Required: Yes
Default: None
Example: pplx-abc123def456...
export PERPLEXITY_API_KEY="your_key_here"
The server will not start without a valid API key. Make sure to keep your API key secure and never commit it to version control.

PERPLEXITY_TIMEOUT_MS

PERPLEXITY_TIMEOUT_MS
number
Request timeout in milliseconds
Required: No
Default: 300000 (5 minutes)
Example: 600000 (10 minutes)
export PERPLEXITY_TIMEOUT_MS=600000
Increase this value for very long research queries using the perplexity_research tool, which can take 30+ seconds to complete.

PERPLEXITY_BASE_URL

PERPLEXITY_BASE_URL
string
Custom base URL for API requests
Required: No
Default: https://api.perplexity.ai
Example: https://your-custom-url.com
export PERPLEXITY_BASE_URL="https://your-custom-url.com"

PERPLEXITY_LOG_LEVEL

PERPLEXITY_LOG_LEVEL
string
Logging verbosity level
Required: No
Default: ERROR
Options: DEBUG, INFO, WARN, ERROR
export PERPLEXITY_LOG_LEVEL="INFO"

PERPLEXITY_PROXY

PERPLEXITY_PROXY
string
Proxy server URL for corporate networks
Required: No
Default: None
Example: https://proxy.company.com:8080
See the Proxy Setup guide for detailed configuration.
# Without authentication
export PERPLEXITY_PROXY="https://your-proxy-host:8080"

# With authentication
export PERPLEXITY_PROXY="https://username:password@your-proxy-host:8080"

HTTP Server Environment Variables

These variables are only used when running the server in HTTP mode for cloud or shared deployments.

PORT

PORT
number
HTTP server port
Required: No
Default: 8080
Example: 3000
export PORT=3000

BIND_ADDRESS

BIND_ADDRESS
string
Network interface to bind to
Required: No
Default: 0.0.0.0 (all interfaces)
Example: 127.0.0.1 (localhost only)
export BIND_ADDRESS="127.0.0.1"

ALLOWED_ORIGINS

ALLOWED_ORIGINS
string
CORS allowed origins (comma-separated)
Required: No
Default: * (all origins)
Example: https://app.example.com,https://staging.example.com
export ALLOWED_ORIGINS="https://app.example.com,https://staging.example.com"

Standard Proxy Variables

In addition to PERPLEXITY_PROXY, the server also supports standard proxy environment variables.

HTTPS_PROXY

HTTPS_PROXY
string
Standard HTTPS proxy variable
Required: No
Default: None
Priority: Checked after PERPLEXITY_PROXY
export HTTPS_PROXY="https://proxy.company.com:8080"

HTTP_PROXY

HTTP_PROXY
string
Standard HTTP proxy variable
Required: No
Default: None
Priority: Checked after HTTPS_PROXY
export HTTP_PROXY="http://proxy.company.com:8080"
Proxy variables are checked in this order: PERPLEXITY_PROXYHTTPS_PROXYHTTP_PROXY. If none are set, the server connects directly to the internet.

Usage Examples

Basic Setup

export PERPLEXITY_API_KEY="your_key_here"

Extended Timeout for Research

export PERPLEXITY_API_KEY="your_key_here"
export PERPLEXITY_TIMEOUT_MS=600000

Corporate Network with Proxy

export PERPLEXITY_API_KEY="your_key_here"
export PERPLEXITY_PROXY="https://proxy.company.com:8080"

HTTP Server Deployment

export PERPLEXITY_API_KEY="your_key_here"
export PORT=8080
export BIND_ADDRESS="0.0.0.0"
export ALLOWED_ORIGINS="https://app.example.com"

Debug Mode

export PERPLEXITY_API_KEY="your_key_here"
export PERPLEXITY_LOG_LEVEL="DEBUG"

Build docs developers (and LLMs) love