|
| 1 | +# Docker Setup |
| 2 | + |
| 3 | +This document explains how to build and run the Perplexity MCP Server using Docker. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Docker installed on your system |
| 8 | +- A Perplexity API key from the [API Portal](https://www.perplexity.ai/account/api/group) |
| 9 | + |
| 10 | +## Building the Docker Image |
| 11 | + |
| 12 | +Build the Docker image from the project root: |
| 13 | + |
| 14 | +```bash |
| 15 | +docker build -t perplexity-mcp-server . |
| 16 | +``` |
| 17 | + |
| 18 | +## Running the Container |
| 19 | + |
| 20 | +### Basic Usage |
| 21 | + |
| 22 | +Run the container with your API key: |
| 23 | + |
| 24 | +```bash |
| 25 | +docker run --rm -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-server |
| 26 | +``` |
| 27 | + |
| 28 | +### With Custom Timeout |
| 29 | + |
| 30 | +Set a custom timeout for requests (default is 5 minutes): |
| 31 | + |
| 32 | +```bash |
| 33 | +docker run --rm \ |
| 34 | + -e PERPLEXITY_API_KEY=your_key_here \ |
| 35 | + -e PERPLEXITY_TIMEOUT_MS=600000 \ |
| 36 | + perplexity-mcp-server |
| 37 | +``` |
| 38 | + |
| 39 | +### With Proxy Support |
| 40 | + |
| 41 | +If you're behind a corporate proxy, configure it: |
| 42 | + |
| 43 | +```bash |
| 44 | +docker run --rm \ |
| 45 | + -e PERPLEXITY_API_KEY=your_key_here \ |
| 46 | + -e PERPLEXITY_PROXY=https://your-proxy-host:8080 \ |
| 47 | + perplexity-mcp-server |
| 48 | +``` |
| 49 | + |
| 50 | +Or with authentication: |
| 51 | + |
| 52 | +```bash |
| 53 | +docker run --rm \ |
| 54 | + -e PERPLEXITY_API_KEY=your_key_here \ |
| 55 | + -e PERPLEXITY_PROXY=https://username:password@your-proxy-host:8080 \ |
| 56 | + perplexity-mcp-server |
| 57 | +``` |
| 58 | + |
| 59 | +### Using Environment File |
| 60 | + |
| 61 | +Create a `.env` file: |
| 62 | + |
| 63 | +```bash |
| 64 | +PERPLEXITY_API_KEY=your_key_here |
| 65 | +PERPLEXITY_TIMEOUT_MS=600000 |
| 66 | +PERPLEXITY_PROXY=https://your-proxy-host:8080 |
| 67 | +``` |
| 68 | + |
| 69 | +Then run: |
| 70 | + |
| 71 | +```bash |
| 72 | +docker run --rm --env-file .env perplexity-mcp-server |
| 73 | +``` |
| 74 | + |
| 75 | +## Integration with MCP Clients |
| 76 | + |
| 77 | +When using Docker with MCP clients, configure them to run the Docker container. For example, in Cursor/VS Code's `mcp.json`: |
| 78 | + |
| 79 | +```json |
| 80 | +{ |
| 81 | + "mcpServers": { |
| 82 | + "perplexity": { |
| 83 | + "command": "docker", |
| 84 | + "args": [ |
| 85 | + "run", |
| 86 | + "--rm", |
| 87 | + "-i", |
| 88 | + "-e", "PERPLEXITY_API_KEY=your_key_here", |
| 89 | + "perplexity-mcp-server" |
| 90 | + ] |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +> **Note**: Docker-based MCP server configuration may have limitations compared to direct `npx` usage. For most use cases, the `npx` method documented in the main README is recommended. |
| 97 | +
|
0 commit comments