Back to Guides

Deploy AnythingMCP with Docker Compose

Step-by-step guide to deploying AnythingMCP on any Linux server using Docker Compose, with automatic SSL via Caddy reverse proxy.

Prerequisites

Before starting, make sure your server has:

  • Docker and Docker Compose installed
  • Ports 80 and 443 open (if using HTTPS)
  • A domain name pointing to your server (optional, required for SSL)

Clone and Run Setup

git clone https://github.com/HelpCode-ai/anythingmcp.git
cd anythingmcp
bash setup.sh

The interactive wizard will guide you through:

  1. Deployment mode — choose Docker (recommended)
  2. Domain & ports — enter your domain to auto-enable HTTPS via Caddy
  3. MCP authentication — OAuth 2.0, API key, or both
  4. Email (SMTP) — optional, for verification and password reset
  5. Redis — optional, for rate limiting and caching

All secrets (JWT, encryption key, database password) are generated automatically.

What setup.sh Does

The script handles the full deployment pipeline:

  • Generates .env with secure random secrets
  • Creates a Caddyfile for automatic Let's Encrypt SSL (when a domain is provided)
  • Optionally adds Redis via docker-compose.override.yml
  • Runs docker compose up -d --build to start all services

The application runs as a single container with NestJS backend (port 4000) and Next.js frontend (port 3000), alongside PostgreSQL 17.

HTTPS with Caddy

When you enter a real domain during setup, Caddy is configured automatically:

  • App ports bind to 127.0.0.1 only (not exposed publicly)
  • Caddy handles all traffic on ports 80 and 443
  • SSL certificates are provisioned and renewed by Let's Encrypt

No manual certificate management required.

Verifying the Deployment

Check that all containers are running:

docker compose ps

Verify the backend health:

curl http://localhost:4000/health

Open the dashboard:

  • With Caddy: https://yourdomain.com
  • Without Caddy: http://your-server-ip:3000

The first user to register becomes the administrator.

Updating AnythingMCP

git pull
docker compose up -d --build

Database migrations run automatically on startup.

Troubleshooting

Port conflicts

sudo lsof -i :80
sudo lsof -i :443

Stop conflicting services or disable Caddy to access the app directly on ports 3000/4000.

Database issues

If you changed credentials in .env, reset the database volume:

docker compose down -v
docker compose up -d

Checking logs

docker compose logs -f        # all services
docker compose logs -f app    # app only
docker compose logs -f caddy  # caddy only

Caddy certificate issues

Ensure your domain's A record points to the server and ports 80/443 are reachable for the ACME challenge.