Deploy MCP with Docker

FROM python:3.12-slim
WORKDIR /app
COPY . /app
RUN pip install --no-cache-dir -r requirements.txt
RUN useradd -r appuser && chown -R appuser /app
USER appuser
CMD ["python", "server.py"]

Container principles

State

The modern protocol core is stateless, so avoid storing protocol session state in container memory. Application state belongs in durable stores when needed.