diff --git a/CLAUDE.md b/CLAUDE.md index 5ca9e23..2cfd4b5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ ## Overview -MCP server (TypeScript, ESM, Express 5, `@modelcontextprotocol/sdk`) that generates images by driving chatgpt.com with Playwright. Mirrors the MCP contract of ZenvairoMediaGenerator-MCP (submit + poll, signed public URLs). +MCP server (TypeScript, ESM, Express 5, `@modelcontextprotocol/sdk`) that generates images by driving chatgpt.com with Playwright. Mirrors the MCP contract of media-mcp (submit + poll, signed public URLs). ## Commands diff --git a/LESSONS.md b/LESSONS.md index 7b30a6a..0334516 100644 --- a/LESSONS.md +++ b/LESSONS.md @@ -1,6 +1,6 @@ # Lessons -Recurring mistakes and how to avoid them. Several of these come from ZenvairoProspect's earlier chatgpt.com automation. +Recurring mistakes and how to avoid them. Several of these come from an earlier internal chatgpt.com automation project. - **The composer is not a login signal.** chatgpt.com shows `#prompt-textarea` to logged-out guests too. Detect a login with profile and history markers, and detect logged-out state with login buttons. - **Don't scan the whole page for limit or error texts.** The user's prompt is on the page. Check only error banners and the assistant reply. diff --git a/README.md b/README.md index bc081bc..e4d0da6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Remote, stateless Streamable HTTP MCP server that generates images with **ChatGPT in the cloud**. It drives the chatgpt.com web UI with Playwright and a persistent, logged-in Chromium profile. Images come from the account's own ChatGPT image quota; no OpenAI API key is involved. -It uses the same submit + poll contract as ZenvairoMediaGenerator-MCP: `generate_image` returns a `generationId` immediately and `query_tasks` returns the result, including an expiring signed `publicUrl`. +It uses the same submit + poll contract as media-mcp: `generate_image` returns a `generationId` immediately and `query_tasks` returns the result, including an expiring signed `publicUrl`. ## Tools diff --git a/docs/architecture.md b/docs/architecture.md index b8266c4..2365bb2 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -28,7 +28,7 @@ Failures that survive the retries and look like frontend changes can trigger a c ## Lineage -Ported from ZenvairoProspect's `imagegen` package (Python, branch `legacy/whatsapp-mockup`): selectors as ordered fallback lists, the persistent profile with a manual login, turn detection through the stop button, usage-limit detection by text, downloads through `page.request`, HTML diagnostics and random pacing. The MCP surface, media storage and signed URLs follow ZenvairoMediaGenerator-MCP so clients can switch backends. +Ported from an earlier internal `imagegen` package (Python, branch `legacy/whatsapp-mockup`): selectors as ordered fallback lists, the persistent profile with a manual login, turn detection through the stop button, usage-limit detection by text, downloads through `page.request`, HTML diagnostics and random pacing. The MCP surface, media storage and signed URLs follow media-mcp so clients can switch backends. Changes from Prospect: - Limit and error texts are matched only against error banners and the assistant reply, never against the whole page. The user's prompt is on the page too. diff --git a/package-lock.json b/package-lock.json index 32b00c9..ee53219 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@zenvairo/chatgpt-imagegen-mcp", + "name": "chatgpt-imagegen-mcp", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@zenvairo/chatgpt-imagegen-mcp", + "name": "chatgpt-imagegen-mcp", "version": "0.1.0", "dependencies": { "@modelcontextprotocol/sdk": "1.30.0", diff --git a/package.json b/package.json index 395342a..f3d4d9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@zenvairo/chatgpt-imagegen-mcp", - "version": "0.1.1", + "name": "chatgpt-imagegen-mcp", + "version": "0.1.2", "description": "Remote Streamable HTTP MCP server that generates images through the chatgpt.com web UI driven by Playwright", "type": "module", "private": true, diff --git a/src/index.ts b/src/index.ts index 15b62ea..19e4740 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,7 @@ jobs.startCleanup(retentionHours); setInterval(() => void orphanCleanup().catch((error) => auditError("orphan_media_cleanup_failed", error)), 15 * 60 * 1000).unref(); function buildServer(): McpServer { - const server = new McpServer({ name: "zenvairo-chatgpt-imagegen", version: "0.1.0" }); + const server = new McpServer({ name: "chatgpt-imagegen", version: "0.1.0" }); registerTools(server, jobs); return server; } @@ -58,7 +58,7 @@ app.get("/public-media/:filename", async (req, res) => { registerUpdateRoutes(app); app.use(authenticate); -app.get("/health", (_req, res) => res.json({ ok: true, service: "zenvairo-chatgpt-imagegen", publicMediaSigningConfigured: publicMediaSigningConfigured(), ...jobs.status() })); +app.get("/health", (_req, res) => res.json({ ok: true, service: "chatgpt-imagegen", publicMediaSigningConfigured: publicMediaSigningConfigured(), ...jobs.status() })); app.get("/media/:filename", (req, res) => { if (!isOutputFilename(req.params.filename)) { res.status(404).json({ error: "not_found" }); diff --git a/src/public-media.ts b/src/public-media.ts index e66b4e5..bc1e45f 100644 --- a/src/public-media.ts +++ b/src/public-media.ts @@ -64,7 +64,7 @@ export function validatePublicMediaSignature( function sign(filename: string, expires: number, secret: string): string { return createHmac("sha256", secret) - .update(`zenvairo-public-media-v1\n${filename}\n${expires}`, "utf8") + .update(`chatgpt-imagegen-public-media-v1\n${filename}\n${expires}`, "utf8") .digest("base64url"); } diff --git a/src/tools.ts b/src/tools.ts index c2cdbdf..e15641f 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -22,7 +22,7 @@ export function registerTools(server: McpServer, jobs: JobManager): void { server.tool("who_am_i", "Describe the ChatGPT web image backend: model, accepted arguments, queue and session state.", { taskTraceId: taskTraceIdSchema, }, async ({ taskTraceId }) => jsonResult({ - service: "Zenvairo ChatGPT Image MCP", + service: "ChatGPT Image MCP", taskTraceId, backend: "chatgpt.com web UI automated with Playwright (unofficial; uses the logged-in account's image quota)", workflow: "generate_image returns a generationId immediately; poll query_tasks every 10-20 s. Jobs run one at a time and each image takes roughly 1-3 minutes plus queue time.",