Skip to content

Commit ab3fbf4

Browse files
authored
Merge pull request #68 from perplexityai/kesku/docker
2 parents 3c1fcd3 + 65bfe03 commit ab3fbf4

File tree

3 files changed

+124
-3
lines changed

3 files changed

+124
-3
lines changed

.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
node_modules
2+
dist
3+
coverage
4+
.git
5+
.gitignore
6+
*.md
7+
!README.md
8+
.vscode
9+
.idea
10+
*.log
11+
.env
12+
.env.local
13+
*.test.ts
14+
*.test.js
15+
vitest.config.ts
16+
vitest.config.js
17+
Dockerfile
18+
.dockerignore
19+

DOCKER.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
FROM node:22.12-alpine AS builder
22

3-
COPY . /app
4-
53
WORKDIR /app
64

7-
RUN --mount=type=cache,target=/root/.npm npm install
5+
COPY package*.json ./
6+
COPY tsconfig.json ./
7+
8+
RUN --mount=type=cache,target=/root/.npm npm install --ignore-scripts
9+
10+
COPY . .
11+
12+
RUN npm run build
813

914
FROM node:22-alpine AS release
1015

0 commit comments

Comments
 (0)