This document explains how to build and run the Perplexity MCP Server using Docker.
- Docker installed on your system
- A Perplexity API key from the API Portal
Build the Docker image from the project root:
docker build -t perplexity-mcp-server .The Docker container runs in HTTP mode by default, making it accessible via HTTP requests:
docker run --rm -p 8080:8080 -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-serverThe server will be accessible at http://localhost:8080/mcp
Set a custom timeout for requests (default is 5 minutes):
docker run --rm -p 8080:8080 \
-e PERPLEXITY_API_KEY=your_key_here \
-e PERPLEXITY_TIMEOUT_MS=600000 \
perplexity-mcp-serverIf you're behind a corporate proxy, configure it:
docker run --rm -p 8080:8080 \
-e PERPLEXITY_API_KEY=your_key_here \
-e PERPLEXITY_PROXY=https://your-proxy-host:8080 \
perplexity-mcp-serverOr with authentication:
docker run --rm -p 8080:8080 \
-e PERPLEXITY_API_KEY=your_key_here \
-e PERPLEXITY_PROXY=https://username:password@your-proxy-host:8080 \
perplexity-mcp-serverCreate a .env file:
PERPLEXITY_API_KEY=your_key_here
PERPLEXITY_TIMEOUT_MS=600000
PERPLEXITY_PROXY=https://your-proxy-host:8080
PORT=8080Then run:
docker run --rm -p 8080:8080 --env-file .env perplexity-mcp-serverWhen using the HTTP Docker server, configure your MCP client to connect to the HTTP endpoint:
{
"mcpServers": {
"perplexity": {
"url": "http://localhost:8080/mcp"
}
}
}For local development with STDIO transport, you can still run the server locally without Docker:
npm install
npm run build
PERPLEXITY_API_KEY=your_key_here npm startNote: The Docker image is optimized for HTTP mode deployment. For local STDIO usage, the
npxmethod documented in the main README is recommended.