Deploying MCPO with Dockerfile on Coolify

MCPO (Model Context Protocol OpenAPI Proxy) is a tool that exposes MCP server tools as OpenAPI endpoints, making them easy to integrate with platforms like Open WebUI. I previously wrote a detailed post on manual MCPO installation and configuration: ðŸš€ Installing and Configuring MCPO for Open WebUI – A Complete Guide. However, deploying MCPO with Coolify is much easier to implement and maintain, thanks to automated builds, environment management, and a streamlined workflow.

What is Coolify?

Coolify is an open-source self-hosted platform for deploying and managing web applications, databases, and services. It provides a user-friendly interface for automated deployments from Git repositories, supports Dockerfile-based builds, and handles networking, SSL, and environment variables out of the box.

I write a blog post explaining how to install it here: https://cfocoder.com/installing-coolify-on-an-oracle-arm-ubuntu-server/

Why use Coolify instead of manual deployment with uvx?

  • Automation: Coolify automatically builds and deploys your app from GitHub, reducing manual steps.
  • Environment Management: Easily set environment variables and secrets securely.
  • Networking: Handles domain, SSL, and port mapping for you.
  • Rollback & Updates: Supports rolling updates and easy redeploys.
  • Multi-app Support: Manage multiple apps and services from one dashboard.

Manual deployment with uvx requires you to build, run, and manage containers and networking yourself. Coolify streamlines the process and is ideal for production and team workflows.

Prerequisites

  • A GitHub repository containing your app and a valid Dockerfile.
  • Access to a Coolify instance.

Step 1: Prepare Your Dockerfile

Dockerfile Explanation (Line-by-Line)

  • FROM python:3.11
    Use the official Python 3.11 image as the base for your container. This ensures a consistent Python environment.
  • RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
    Update package lists, install git and curl (needed for cloning repos and installing uvx), then clean up to reduce image size.
  • RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash – && apt-get install -y nodejs
    Install Node.js and npm, which are required for Node-based MCP tools like Context7. This makes npx available in the container.
  • RUN curl -LsSf https://astral.sh/uv/install.sh | sh
    Download and install uvx, a fast Python package manager and runner, directly into the container.
  • ENV PATH=”/root/.local/bin:${PATH}”
    Add uvx to the PATH so it’s available to all processes and commands in the container.
  • WORKDIR /app
    Set the working directory inside the container to /app.
  • RUN git clone https://github.com/open-webui/mcpo.git /app/open-webui/mcpo
    Clone the MCPO repository into the container at /app/open-webui/mcpo.
  • COPY mcp_config.json /app/mcp_config.json
    Copy your MCP configuration file from your repo into the container.
  • EXPOSE 8002
    Expose port 8002 so Coolify and external clients can access MCPO.
  • CMD [“sh”, “-c”, “~/.local/bin/uvx /app/open-webui/mcpo –port 8002 –config /app/mcp_config.json”]
    Start MCPO using uvx, specifying the port and config file.

For MCPO, use a Dockerfile like this:

FROM python:3.11
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /app
RUN git clone https://github.com/open-webui/mcpo.git /app/open-webui/mcpo
COPY mcp_config.json /app/mcp_config.json
EXPOSE 8002
CMD ["sh", "-c", "~/.local/bin/uvx /app/open-webui/mcpo --port 8002 --config /app/mcp_config.json"]

Step 2: Add Your Configuration

Your mcp_config.json file defines which MCP server tools you want to add to MCPO. Each entry in the mcpServers section specifies a tool, the command to run it, and any arguments or options. This is how you customize MCPO to expose the tools you need.

For details on the config file structure and MCP tool definitions, see the official documentation: Add new MCP servers from JSON configuration | MCP Router

Include your mcp_config.json in the repo. Example:

{
  "mcpServers": {
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time", "--local-timezone=America/New_York"]
    }
  }
}

Step 3: Push to GitHub

Commit and push your changes to your GitHub repository.

Step 4: Deploy on Coolify

  1. In Coolify, create a new Web App.
  2. Connect your GitHub repo.
  3. Select the branch and set the build method to Dockerfile.
  4. Set environment variables if needed (e.g., API keys).
  5. Deploy.

Step 5: Access Your App

Once deployed, Coolify will provide a public URL. For MCPO, you’ll see the OpenAPI Proxy UI and endpoints.

Deploying Any App with a Dockerfile in Coolify

  1. Add a Dockerfile to your app’s repository.
  2. Push your code to GitHub.
  3. In Coolify, create a new Web App and connect your repo.
  4. Select the branch and set build method to Dockerfile.
  5. Set environment variables and secrets as needed.
  6. Deploy.

Coolify will build and run your app automatically. For most web apps, this is the simplest and most reliable way to deploy from source.

Share