Skip to main content

Docker Setup

This guide covers deploying MCPHub using Docker, including development and production configurations.

Quick Start with Docker

Using Pre-built Image

The standard MCPHub image includes Node.js/pnpm, Python, uv/uvx, Git, and build tools. Use the latest-full image if you need Cargo and the stable Rust toolchain for Rust-based MCP servers.

Building from Source

Building with Extended Features

The Docker image supports an INSTALL_EXT build argument to include additional tools. Published -full images are built with this enabled:
What’s included with INSTALL_EXT=true:
  • Stable Rust + Cargo: Installed through rustup for Rust-based MCP servers.
  • Docker Engine: Full Docker daemon with CLI for container management. The daemon auto-starts when the container runs in privileged mode.
  • Chrome + Firefox for Playwright (amd64 only): For browser automation tasks
The extended image is larger but provides additional capabilities for advanced use cases.
Docker-in-Docker Security Considerations:
  • Privileged mode (--privileged): Required for the Docker daemon to start inside the container. This gives the container elevated permissions on the host.
  • Docker socket mounting (/var/run/docker.sock): Gives the container access to the host’s Docker daemon. Both approaches should only be used in trusted environments.
  • For production, consider using Docker socket mounting instead of privileged mode for better security.

Docker Compose Setup

Basic Configuration

Create a docker-compose.yml file:

Production Configuration with Nginx

Environment Variables

Create a .env file for Docker Compose:

Development Setup

Development Docker Compose

Create docker-compose.dev.yml:

Development Dockerfile

Create Dockerfile.dev:

Running the Application

Development Mode

Production Mode

Configuration Management

MCP Settings Volume Mount

Create your mcp_settings.json:

Secrets Management

For production, use Docker secrets:

Data Persistence

Database Backups

Add backup service to your docker-compose.yml:
Create scripts/backup.sh:
Run backup:

Monitoring and Health Checks

Health Check Endpoint

Add to your application:

Docker Health Checks

Monitoring with Watchtower

Add automatic updates:

Troubleshooting

Common Issues

Container fails to start: Check logs with docker-compose logs mcphub Rate-limit warning about X-Forwarded-For: Set TRUST_PROXY=1 when MCPHub is behind Nginx, Traefik, a load balancer, or another reverse proxy. Recent versions also default to trusting one proxy automatically inside Docker/Kubernetes, but keeping it explicit in production compose files is recommended. Database connection errors: Ensure PostgreSQL is healthy and accessible Port conflicts: Check if ports 3000/5432 are already in use Volume mount issues: Verify file paths and permissions

Debug Commands

Performance Optimization

This Docker setup provides a complete containerized environment for MCPHub with development and production configurations.