Skip to main content
Glama
by yty-build
Dockerfile2.02 kB
# Multi-stage build for YT PostgreSQL MCP Server FROM python:3.11-slim as builder # Install build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ postgresql-client \ && rm -rf /var/lib/apt/lists/* # Create virtual environment RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" # Copy and install requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Final stage FROM python:3.11-slim # Install runtime dependencies including PgBouncer RUN apt-get update && apt-get install -y --no-install-recommends \ libpq5 \ pgbouncer \ postgresql-client \ && rm -rf /var/lib/apt/lists/* # Create non-root user with pgbouncer group access RUN useradd -m -u 1000 mcpuser && \ mkdir -p /app /etc/pgbouncer /var/log/pgbouncer /var/run/pgbouncer && \ chown -R mcpuser:mcpuser /app /etc/pgbouncer /var/log/pgbouncer /var/run/pgbouncer # Copy virtual environment from builder COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" # Set working directory WORKDIR /app # Copy application code COPY --chown=mcpuser:mcpuser src/ /app/src/ COPY --chown=mcpuser:mcpuser config/ /app/config/ # Copy PgBouncer configuration COPY --chown=mcpuser:mcpuser pgbouncer/pgbouncer.ini /etc/pgbouncer/pgbouncer.ini # Copy entrypoint script COPY --chown=mcpuser:mcpuser docker-entrypoint.sh /app/docker-entrypoint.sh RUN chmod +x /app/docker-entrypoint.sh # Switch to non-root user USER mcpuser # Set environment variables ENV PYTHONPATH=/app \ MCP_TRANSPORT=sse \ MCP_SSE_HOST=0.0.0.0 \ MCP_SSE_PORT=3000 \ PGBOUNCER_ENABLED=true # Expose SSE port and PgBouncer port EXPOSE 3000 6432 # Health check HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:3000/health').read()" || exit 1 # Run entrypoint script (starts PgBouncer if enabled, then MCP server) CMD ["/app/docker-entrypoint.sh"]

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yty-build/postgres_mcp_allaccess'

If you have feedback or need assistance with the MCP directory API, please join our Discord server