FROM python:3.13-slim

WORKDIR /app

# Install uv for fast dependency resolution
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Copy SDK and MCP server source
COPY sdk/python /app/sdk/python
COPY mcp /app/mcp

# Install the MCP server (which pulls in the local SDK)
RUN uv pip install --system /app/sdk/python /app/mcp

EXPOSE 8080

# Default to streamable-http (current MCP standard) for remote deployment
ENV MAILERBOT_MCP_TRANSPORT=streamable-http
ENV MAILERBOT_MCP_HOST=0.0.0.0
ENV MAILERBOT_MCP_PORT=8080
# In Docker Compose, MAILERBOT_API_URL and MAILERBOT_OAUTH_ISSUER are set
# via environment or env_file to point at the backend service.

CMD ["mailerbot-mcp"]
