The Perplexity MCP Server supports HTTP mode for cloud deployments, containerized environments, and scenarios where STDIO transport is not suitable.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.
HTTP Mode vs STDIO Mode
HTTP Mode
- Cloud deployments
- Docker containers
- Shared server environments
- Browser-based MCP clients
- Remote access
STDIO Mode
- Local development
- Desktop MCP clients (Cursor, Claude Desktop)
- Direct process communication
- Single-user environments
Node.js Deployment
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
PERPLEXITY_API_KEY | Your Perplexity API key | - | Yes |
PORT | HTTP server port | 8080 | No |
BIND_ADDRESS | Network interface to bind to | 0.0.0.0 | No |
ALLOWED_ORIGINS | CORS allowed origins (comma-separated) | * | No |
PERPLEXITY_TIMEOUT_MS | Request timeout in milliseconds | 300000 | No |
PERPLEXITY_BASE_URL | Custom API base URL | https://api.perplexity.ai | No |
PERPLEXITY_LOG_LEVEL | Logging level: DEBUG, INFO, WARN, ERROR | ERROR | No |
Setting
BIND_ADDRESS to 0.0.0.0 allows the server to accept connections from any network interface. For local-only access, use 127.0.0.1.CORS Configuration
The HTTP server implements CORS middleware to control cross-origin access from browser-based clients.Default Configuration
By default, all origins are allowed (ALLOWED_ORIGINS=*). This is suitable for development but should be restricted in production.
Production Configuration
For production deployments, specify allowed origins explicitly:src/http.ts:21-37) includes:
- Dynamic origin validation
- Exposed headers:
Mcp-Session-Id,mcp-protocol-version - Allowed headers:
Content-Type,mcp-session-id
Health Check Endpoint
The server exposes a health check endpoint at/health for monitoring and load balancer integration.
src/http.ts:69-71 and always returns a 200 status code when the server is running.
MCP Endpoint
The main MCP protocol endpoint is available at/mcp and handles all MCP protocol requests:
- Accepts all HTTP methods (GET, POST, etc.)
- Uses MCP Streamable HTTP transport
- Generates session IDs automatically
- Returns JSON-RPC 2.0 formatted responses
- Handles errors with standard error codes
Client Connection Configuration
Configure your MCP client to connect to the HTTP endpoint:Real Deployment Examples
Development Server
Production Server
Behind Reverse Proxy
Process Management
For production deployments, use a process manager to keep the server running:PM2 Example
systemd Example
Create/etc/systemd/system/perplexity-mcp.service:
Always store sensitive environment variables like
PERPLEXITY_API_KEY securely. Consider using environment files with restricted permissions or secret management services.