Deployment with Docker

This project includes a Dockerfile for building and running the Deepwiki MCP Server in a containerized environment. This is the recommended approach for production deployments as it ensures consistency and encapsulates all dependencies.

Building the Docker Image

To build the Docker image, navigate to the root of the project directory and run the following command:

docker build -t mcp-deepwiki .

This command executes the multi-stage build defined in the Dockerfile. It installs dependencies using pnpm, builds the TypeScript source code, and then creates a minimal production-ready image with only the necessary runtime artifacts.

Running the Container

How you run the container depends on the transport mode you intend to use.

Stdio Transport

For interactive use or when another process manages the container's lifecycle, run it with the -it (interactive) and --rm (auto-remove on exit) flags.

docker run -it --rm mcp-deepwiki

HTTP Transport

For a persistent server running in the background, use the -d (detached) flag and map a host port to the container's port.

docker run -d -p 3000:3000 --name mcp-deepwiki-server mcp-deepwiki --http --port 3000
  • -d: Runs the container in detached mode.
  • -p 3000:3000: Maps port 3000 on the host to port 3000 in the container.
  • --name ...: Assigns a convenient name to the container.
  • --http --port 3000: These are the arguments passed to the cli.mjs entry point, instructing it to start in HTTP mode on port 3000.

Passing Configuration

You can configure the server inside the container by passing environment variables using the -e flag.

docker run -d -p 3000:3000 \
  -e DEEPWIKI_MAX_CONCURRENCY=10 \
  -e DEEPWIKI_REQUEST_TIMEOUT=60000 \
  -e GITHUB_TOKEN=your_github_token \
  --name mcp-deepwiki-server \
  mcp-deepwiki --http --port 3000

This is the recommended way to provide sensitive information like a GITHUB_TOKEN without hardcoding it. Refer to the Configuration page for a full list of available environment variables.