Files
chatgpt-imagegen-mcp/.env.example
T
dasemuandClaude Opus 5.5 550396d7ed feat: self-heal the chatgpt.com scraper with codex and open a PR
After SELFHEAL_FAILURE_THRESHOLD consecutive UI_CHANGED/TURN_TIMED_OUT
failures the queue snapshots the logged-in profile and runs
scripts/selfheal.sh: codex exec in yolo mode on a throwaway clone, with a
Playwright + playwright-stealth inspector to study the live frontend.
Changes are limited to src/chatgpt and test fixtures, must pass typecheck
and tests, and are pushed as a pull request for human review.
Disabled by default (SELFHEAL_ENABLED).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 20:13:11 +02:00

76 lines
2.6 KiB
Bash

# --- MCP server ---
HOST=127.0.0.1
PORT=8088
# Bearer token required on /mcp, /health and /media (generate with: openssl rand -hex 32)
MCP_SERVER_TOKEN=replace-with-a-long-random-secret
# External base URL used to build downloadUrl/publicUrl (no trailing slash)
PUBLIC_BASE_URL=https://mcp.example.com/chatgptimagegen
# HMAC secret for /public-media signed URLs (>= 32 chars)
PUBLIC_MEDIA_SIGNING_SECRET=replace-with-at-least-32-random-characters
PUBLIC_MEDIA_URL_TTL_SECONDS=86400
MAX_MCP_REQUEST_MB=40
# Express "trust proxy" value; set to 1 behind nginx
TRUST_PROXY=
# --- Media storage ---
MEDIA_DIR=media
MEDIA_RETENTION_HOURS=168
TOMBSTONE_RETENTION_DAYS=30
MAX_INLINE_MEDIA_MB=25
MAX_MEDIA_MB=50
MAX_REFERENCE_INPUT_MB=25
# --- ChatGPT browser ---
CHATGPT_URL=https://chatgpt.com/
# Persistent Chromium profile holding the chatgpt.com login (keep private, never commit)
CHATGPT_PROFILE_DIR=profiles/chatgpt
# Headed under Xvfb is the default in production; headless is blocked more often
CHATGPT_HEADLESS=false
# Optional: "chrome" to use an installed Google Chrome instead of Playwright's Chromium
CHATGPT_BROWSER_CHANNEL=
# Optional user agent override (leave empty to use the browser's own)
CHATGPT_USER_AGENT=
CHATGPT_LOCALE=es-ES
CHATGPT_TURN_TIMEOUT_SECONDS=600
CHATGPT_IMAGE_TIMEOUT_SECONDS=180
# Extra attempts (each in a new chat) for transient failures: timeouts, UI glitches, browser errors
CHATGPT_RETRIES=2
# Backoff base between attempts (multiplied by the attempt number)
CHATGPT_RETRY_DELAY_SECONDS=15
CHATGPT_BROWSER_IDLE_CLOSE_MINUTES=10
# Random pause between generations, in seconds (min..max)
CHATGPT_MIN_INTERVAL_SECONDS=30
CHATGPT_MAX_INTERVAL_SECONDS=90
# Circuit breaker cooldowns
CHATGPT_USAGE_LIMIT_COOLDOWN_MINUTES=60
CHATGPT_SESSION_RECHECK_MINUTES=5
MAX_QUEUE_LENGTH=20
# HTML + screenshot dumps on UI failures (may contain conversation text)
DIAGNOSTICS_DIR=diagnostics
MAX_DIAGNOSTICS=10
# --- Self-heal with codex (see docs/selfheal.md) ---
SELFHEAL_ENABLED=false
SELFHEAL_FAILURE_THRESHOLD=3
SELFHEAL_COOLDOWN_HOURS=6
SELFHEAL_SCRIPT=scripts/selfheal.sh
SELFHEAL_LOG_FILE=logs/selfheal.log
SELFHEAL_REMOTE=origin
SELFHEAL_BASE_BRANCH=main
SELFHEAL_CODEX_BIN=codex
SELFHEAL_CODEX_MODEL=
SELFHEAL_CODEX_TIMEOUT_SECONDS=2700
SELFHEAL_VENV=.selfheal-venv
SELFHEAL_PR_ASSIGNEES=
SELFHEAL_TEA_LOGIN=
SELFHEAL_DRY_RUN=false
# --- Update endpoint (/admin/update) ---
# Bearer secret, >= 32 chars; unset disables the endpoint
UPDATE_TOKEN=
UPDATE_SCRIPT=scripts/update.sh
UPDATE_LOG_FILE=logs/update.log
UPDATE_RATE_LIMIT_MAX=30
UPDATE_RATE_LIMIT_WINDOW_SECONDS=900
SERVICE_NAME=chatgpt-imagegen-mcp.service