Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
docker buildx bake --file docker-bake.hcl --print | grep -q "runtime-cpu"
docker buildx bake --file docker-bake.hcl --print | grep -q "runtime-cuda"
docker buildx bake --file docker-bake.hcl --print | grep -q "complete-cuda"
docker buildx bake --file docker-bake.hcl --print | grep -q "mcp"

build-cuda:
runs-on: ubuntu-latest
Expand Down
23 changes: 21 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,33 @@ target "complete-cuda" {
depends_on = ["core-cuda"]
}

target "mcp" {
context = "services/mcp"
dockerfile = "dockerfile.comfy.mcp"
platforms = PLATFORMS
tags = [
"${REGISTRY_URL}mcp:${IMAGE_LABEL}",
"${REGISTRY_URL}mcp:cache",
notequal("",IMAGE_LABEL) && notequal("latest",IMAGE_LABEL) ? "${REGISTRY_URL}mcp:latest" : ""
]
cache-from = ["type=registry,ref=${REGISTRY_URL}mcp:cache,optional=true"]
cache-to = ["type=inline"]
args = {
MCP_VERSION = "v1.1.1"
}
}

group "mcp" {
targets = ["mcp"]
}

// Convenience groups
group "default" {
targets = ["all"]
}

group "all" {
targets = ["runtime", "cuda", "cpu"]
targets = ["runtime", "cuda", "cpu", "mcp"]
}

group "core" {
Expand All @@ -139,4 +159,3 @@ group "cuda" {
group "cpu" {
targets = ["runtime-cpu", "core-cpu"]
}

47 changes: 47 additions & 0 deletions services/mcp/dockerfile.comfy.mcp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# MCP server for ComfyUI — joenorton/comfyui-mcp-server
# Standalone Python image; does NOT depend on the ComfyUI runtime image.
# Communicates with ComfyUI over HTTP (COMFYUI_URL env var).
#
# Published as: ghcr.io/pixeloven/comfyui/mcp:<IMAGE_LABEL>

ARG MCP_VERSION=v1.1.1

FROM python:3.12-slim

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*

# Create non-root user
ARG APP_UID=1000
ARG APP_GID=1000
RUN groupadd -g "$APP_GID" comfy && \
useradd -u "$APP_UID" -g "$APP_GID" -d /app -s /bin/bash -M comfy && \
mkdir -p /app

WORKDIR /app

# Fetch pinned upstream source
ARG MCP_VERSION
RUN git clone --depth 1 --branch "$MCP_VERSION" \
https://github.com/joenorton/comfyui-mcp-server.git . && \
pip install --no-cache-dir -r requirements.txt && \
rm -rf .git

# Upstream FastMCP() defaults host="127.0.0.1" via its __init__ kwarg default,
# which explicit-kwarg initialization makes impossible to override via env var.
# Patch the constructor call directly so the server binds all interfaces.
RUN sed -i 's/port=9000,/port=9000, host="0.0.0.0",/' server.py

RUN chown -R comfy:comfy /app

USER comfy

# COMFYUI_URL is required at runtime — point to the ComfyUI service
ENV COMFYUI_URL=http://localhost:8188

EXPOSE 9000

CMD ["python", "server.py"]
Loading