Skip to main content
Glama
by yty-build
docker-entrypoint.sh•1.99 kB
#!/bin/bash # Docker entrypoint for MCP Server with embedded PgBouncer set -e echo "šŸš€ Starting YT PostgreSQL MCP Server..." # Check if PgBouncer is enabled if [ "${PGBOUNCER_ENABLED}" = "true" ]; then echo "šŸ“¦ PgBouncer enabled - preparing configuration..." # Check required environment variables if [ -z "$POSTGRES_USER" ] || [ -z "$POSTGRES_PASSWORD" ]; then echo "āš ļø Warning: POSTGRES_USER or POSTGRES_PASSWORD not set" echo " PgBouncer will be configured, but may fail to connect" fi # Get real PostgreSQL host/port (what PgBouncer connects to) REAL_HOST="${POSTGRES_REAL_HOST:-${POSTGRES_HOST:-localhost}}" REAL_PORT="${POSTGRES_REAL_PORT:-${POSTGRES_PORT:-5432}}" # Update pgbouncer.ini with real PostgreSQL connection sed -i "s/\${POSTGRES_HOST}/${REAL_HOST}/g" /etc/pgbouncer/pgbouncer.ini sed -i "s/\${POSTGRES_PORT}/${REAL_PORT}/g" /etc/pgbouncer/pgbouncer.ini sed -i "s/\${POSTGRES_DATABASE}/${POSTGRES_DATABASE:-postgres}/g" /etc/pgbouncer/pgbouncer.ini # Generate userlist.txt with plain password echo "\"$POSTGRES_USER\" \"$POSTGRES_PASSWORD\"" > /etc/pgbouncer/userlist.txt chmod 600 /etc/pgbouncer/userlist.txt echo "āœ… PgBouncer configuration complete" echo " Connecting to PostgreSQL at ${REAL_HOST}:${REAL_PORT}/${POSTGRES_DATABASE}" echo " Listening on localhost:6432" # Start PgBouncer in background echo "šŸ”„ Starting PgBouncer..." pgbouncer -d /etc/pgbouncer/pgbouncer.ini # Wait a moment for PgBouncer to start sleep 2 # Check if PgBouncer is running if pgrep -x "pgbouncer" > /dev/null; then echo "āœ… PgBouncer started successfully (PID: $(pgrep -x pgbouncer))" else echo "āŒ PgBouncer failed to start" exit 1 fi else echo "šŸ“¦ PgBouncer disabled - connecting directly to PostgreSQL" fi # Start MCP Server echo "šŸ”„ Starting MCP Server..." exec python -m src.yt_postgres_mcp.server

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