Skip to main content

Image Description

MCP Gateway provides two deployment methods:

All-in-One Deployment

All services packaged in one container, suitable for single machine deployment or local use

Multi-Container Deployment

Each service deployed independently, suitable for production or cluster deployment

Image Repositories

Images are published to the following three repositories:
  • Docker Hub: docker.io/ifuryst/unla-*
  • GitHub Container Registry: ghcr.io/amoylab/unla/*
  • Alibaba Cloud Container Registry: registry.ap-southeast-1.aliyuncs.com/amoylab/unla-*
GHCR supports multi-level directories, so the organization structure is clearer. Docker and Aliyun repositories only support single-level directories, so image names are joined with -.

Image Tags

  • latest: Latest version
  • vX.Y.Z: Specific version number
MCP Gateway is currently in rapid iteration! Therefore, it is recommended to deploy with version numbers for better reliability.

Available Images

# All-in-One version
docker pull docker.io/ifuryst/unla-allinone:latest
docker pull ghcr.io/amoylab/unla/allinone:latest
docker pull registry.ap-southeast-1.aliyuncs.com/amoylab/unla-allinone:latest

# API Server
docker pull docker.io/ifuryst/unla-apiserver:latest
docker pull ghcr.io/amoylab/unla/apiserver:latest
docker pull registry.ap-southeast-1.aliyuncs.com/amoylab/unla-apiserver:latest

# MCP Gateway
docker pull docker.io/ifuryst/unla-mcp-gateway:latest
docker pull ghcr.io/amoylab/unla/mcp-gateway:latest
docker pull registry.ap-southeast-1.aliyuncs.com/amoylab/unla-mcp-gateway:latest

# Mock User Service
docker pull docker.io/ifuryst/unla-mock-server:latest
docker pull ghcr.io/amoylab/unla/mock-server:latest
docker pull registry.ap-southeast-1.aliyuncs.com/amoylab/unla-mock-server:latest

# Web frontend
docker pull docker.io/ifuryst/unla-web:latest
docker pull ghcr.io/amoylab/unla/web:latest
docker pull registry.ap-southeast-1.aliyuncs.com/amoylab/unla-web:latest

All-in-One Deployment

All-in-One deployment packages all services in one container, suitable for single machine deployment or local use. It includes the following services:
  • API Server: Management platform backend, can be understood as the control plane
  • MCP Gateway: Core service, responsible for actual gateway service, can be understood as the data plane
  • Mock User Service: Mock user service, providing test user services
  • Web Frontend: Management platform frontend, providing visual management interface
  • Nginx: Reverse proxy for other services
Uses Supervisor to manage service processes, all logs are output to stdout.

Port Description

External Service Ports

  • 8080: Web interface port
  • 5235: MCP Gateway port

Internal Service Ports

  • 5234: API Server port
  • 5335: MCP Gateway management port
  • 5236: Mock User Service port
5335 is the MCP Gateway management port, hosting internal interfaces such as reload. Do not expose it externally in production environments!

Data Persistence

It is recommended to mount the following directories:
  • /app/configs: Configuration file directory
  • /app/data: Data directory
  • /app/.env: Environment variable file

Deployment Steps

1

Create Directory and Download Configuration

mkdir -p unla/{configs,data}
cd unla/
curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/configs/apiserver.yaml -o configs/apiserver.yaml
curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/configs/mcp-gateway.yaml -o configs/mcp-gateway.yaml
curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/.env.example -o .env.allinone
2

Start Container

# Use Aliyun Container Registry image (recommended for use within China)
docker run -d \
           --name unla \
           -p 8080:80 \
           -p 5234:5234 \
           -p 5235:5235 \
           -p 5335:5335 \
           -p 5236:5236 \
           -e ENV=production \
           -v $(pwd)/configs:/app/configs \
           -v $(pwd)/data:/app/data \
           -v $(pwd)/.env.allinone:/app/.env \
           --restart unless-stopped \
           registry.ap-southeast-1.aliyuncs.com/amoylab/unla-allinone:latest

# Use GitHub Container Registry image
docker run -d \
           --name unla \
           -p 8080:80 \
           -p 5234:5234 \
           -p 5235:5235 \
           -p 5335:5335 \
           -p 5236:5236 \
           -e ENV=production \
           -v $(pwd)/configs:/app/configs \
           -v $(pwd)/data:/app/data \
           -v $(pwd)/.env.allinone:/app/.env \
           --restart unless-stopped \
           ghcr.io/amoylab/unla/allinone:latest

Notes

  1. Ensure configuration files and environment variable files are correctly configured
  2. Strongly recommended to use strong passwords in production environments
  3. Do not expose management port 5335 externally
  1. Recommended to use version number tags instead of latest
  2. Production environments should configure appropriate resource limits
Ensure mounted directories have correct permissions

Multi-Container Deployment

Multiple services deployed independently, suitable for production environments or cluster deployment. Includes the following services:
  • mcp-gateway: Core service, responsible for actual gateway service, can be understood as the data plane
  • web(includes apiserver): Management platform and backend, can be understood as the control plane
  • mock-server: Mock service, providing test services
Suitable for production environments, can be deployed as needed, especially for mcp-gateway which can be deployed in multiple replicas for high availability.

Deployment Features

Database Support

Uses PostgreSQL as database to store sessions, proxy configurations and other information

Cache Support

Uses Redis for configuration update notifications, OAuth storage and other purposes

Load Balancing

Supports multi-replica deployment and load balancing configuration

Docker Compose Deployment

1

Download Configuration Files

curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/deploy/docker/multi/docker-compose.yml -o docker-compose.yml
curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/.env.example -o .env
2

Modify Configuration

Edit docker-compose.yml and .env files:
  1. Modify database and Redis account passwords
  2. Adjust exposed ports as needed
  3. Configure LLM service parameters
3

Start Services

docker compose up -d
4

Configure Load Balancing

Configure Nginx or other LB layers as needed

Example Configuration

services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: "**********"
      POSTGRES_DB: mcp-gateway
    volumes:
      - ./db:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    restart: always

  redis:
    image: redis:7
    ports:
      - "6379:6379"
    volumes:
      - ./redis:/data
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    command: redis-server --appendonly yes --save "900 1" --save "300 10" --save "60 10000" --requirepass "**********"
    restart: always

  web:
    image: ghcr.io/amoylab/unla/web:latest
    ports:
      - "8080:80"
      - "5234:5234"
    environment:
      - ENV=production
      - TZ=Asia/Shanghai
    volumes:
      - ./.env:/app/.env
      - ./data:/app/data
    depends_on:
      - postgres
      - mcp-gateway
      - mock-server
    restart: always

  mcp-gateway:
    image: ghcr.io/amoylab/unla/mcp-gateway:latest
    ports:
      - "5235:5235"
    environment:
      - ENV=production
      - TZ=Asia/Shanghai
    volumes:
      - ./.env:/app/.env
      - ./data:/app/data
    depends_on:
      - postgres
    restart: always

  mock-server:
    image: ghcr.io/amoylab/unla/mock-server:latest
    ports:
      - "5236:5236"
    environment:
      - ENV=production
      - TZ=Asia/Shanghai
    volumes:
      - ./.env:/app/.env
    depends_on:
      - postgres
    restart: always
server {
    server_name unla.amoylab.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
    }

    location /api/ {
        proxy_pass http://127.0.0.1:5234/api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /ws/ {
        proxy_pass http://127.0.0.1:5234/api/ws/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /gateway/ {
        proxy_pass http://127.0.0.1:5235/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_buffering off;
        proxy_cache off;
        chunked_transfer_encoding off;
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
    }

    location /mock/ {
        proxy_pass http://127.0.0.1:5236/;
        proxy_set_header Host $host;
    }
}

Important Access URLs

After configuration is complete, you can access the services through the following URLs:
Please adjust the above URLs according to your actual domain and configuration.
I