{"id":48749919,"url":"https://github.com/WJZ-P/gemini-skill","last_synced_at":"2026-04-28T14:00:57.959Z","repository":{"id":344010058,"uuid":"1180015183","full_name":"WJZ-P/gemini-skill","owner":"WJZ-P","description":"gemini drawing MCP \u0026 skill through browser, can be used in openclaw or any agent that supports MCP. Gemini画图 MCP和sill，支持龙虾或任何agent使用٩(๑\u003e◡\u003c๑)۶","archived":false,"fork":false,"pushed_at":"2026-04-07T15:32:43.000Z","size":3156,"stargazers_count":806,"open_issues_count":5,"forks_count":121,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-26T07:36:35.512Z","etag":null,"topics":["automation","browser-automation","drawing","gemini","mcp","mcp-client","mcp-server","openclaw","openclaw-agent","openclaw-skills","openclawskill"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WJZ-P.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T16:01:19.000Z","updated_at":"2026-04-25T21:16:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/WJZ-P/gemini-skill","commit_stats":null,"previous_names":["wjz-p/gemini-skill"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WJZ-P/gemini-skill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJZ-P%2Fgemini-skill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJZ-P%2Fgemini-skill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJZ-P%2Fgemini-skill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJZ-P%2Fgemini-skill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WJZ-P","download_url":"https://codeload.github.com/WJZ-P/gemini-skill/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJZ-P%2Fgemini-skill/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32383791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","browser-automation","drawing","gemini","mcp","mcp-client","mcp-server","openclaw","openclaw-agent","openclaw-skills","openclawskill"],"created_at":"2026-04-12T17:00:30.689Z","updated_at":"2026-04-28T14:00:57.940Z","avatar_url":"https://github.com/WJZ-P.png","language":"JavaScript","funding_links":[],"categories":["未分类","Image, Video \u0026 Multimodal"],"sub_categories":[],"readme":"## Automate Gemini web via CDP — AI image generation, conversations, image extraction, and more.\n\u003c!-- PROJECT SHIELDS --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/graphs/contributors\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/contributors/WJZ-P/gemini-skill.svg?style=flat-square\" alt=\"Contributors\" style=\"height: 30px\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/network/members\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/WJZ-P/gemini-skill.svg?style=flat-square\" alt=\"Forks\" style=\"height: 30px\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/WJZ-P/gemini-skill.svg?style=flat-square\" alt=\"Stargazers\" style=\"height: 30px\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/issues\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/WJZ-P/gemini-skill.svg?style=flat-square\" alt=\"Issues\" style=\"height: 30px\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/WJZ-P/gemini-skill.svg?style=flat-square\" alt=\"License\" style=\"height: 30px\"\u003e\n  \u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\u003c!-- PROJECT LOGO --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/\"\u003e\n    \u003cimg src=\"markdown/gemini-color.svg\" alt=\"Logo\" width=\"96\" height=\"96\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eGemini Skill\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#-usage\"\u003eQuick Start\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/issues\"\u003eReport Bug\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/WJZ-P/gemini-skill/issues\"\u003eRequest Feature\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  English | \u003ca href=\"./README.md\"\u003e中文\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.bilibili.com/video/BV1e54y1z7XM\"\u003e\n    \u003cimg src=\"markdown/home.png\" alt=\"Pure Blue\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003ch2 align=\"center\"\u003e\n\n\"Thorns peeled away, \u0026nbsp; yet just as you once said,\n\nThe tenderness we clung to is but a blank page,\n\nCradling shattered dreams and the story we made.\"\n\n\u003c/h2\u003e\n\n## Table of Contents\n\n- [Features](#-features)\n- [Architecture](#️-architecture)\n- [Installation](#-installation)\n- [Configuration](#️-configuration)\n- [Usage](#-usage)\n- [MCP Tools](#-mcp-tools)\n- [Daemon Lifecycle](#-daemon-lifecycle)\n- [Project Structure](#-project-structure)\n- [Notes](#️-notes)\n- [To Do List](#-to-do-list)\n- [License](#-license)\n\n\u003cbr\u003e\n\n\u003c!-- EXAMPLE --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./markdown/example.png\" alt=\"Gemini image generation example\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cem\u003e▲ Auto-generate sticker images through AI conversation\u003c/em\u003e\u003c/p\u003e\n\n\u003cbr\u003e\n\n## ✨ Features\n\n|  | Feature | Description |\n|:---:|---------|-------------|\n| 🎨 | **AI Image Generation** | Send prompts to generate images, with full-size high-res download support |\n| 💬 | **Text Conversations** | Multi-turn dialogue with Gemini |\n| 🖼️ | **Image Upload** | Upload reference images for image-to-image generation |\n| 📥 | **Image Extraction** | Extract images from sessions via base64 or CDP full-size download |\n| 🔄 | **Session Management** | New chat, temp chat, model switching, navigate to historical sessions |\n| 🧹 | **Auto Watermark Removal** | Downloaded images automatically have the Gemini watermark stripped |\n| 🤖 | **MCP Server** | Standard MCP protocol interface, callable by any MCP client |\n\n\u003cbr\u003e\n\n## 🏗️ Architecture\n\n```\n┌─────────────────────────────────────────────────────┐\n│                   MCP Client (AI)                   │\n│              Claude / CodeBuddy / ...               │\n└──────────────────────┬──────────────────────────────┘\n                       │ stdio (JSON-RPC)\n                       ▼\n┌─────────────────────────────────────────────────────┐\n│            mcp-server.js (MCP Protocol Layer)       │\n│          Registers all MCP tools, orchestrates      │\n└──────────────────────┬──────────────────────────────┘\n                       │\n                       ▼\n┌─────────────────────────────────────────────────────┐\n│           index.js → browser.js (Connection Layer)  │\n│   ensureBrowser() → auto-start Daemon → CDP link    │\n└──────────┬──────────────────────────────┬───────────┘\n           │ HTTP (acquire/status)        │ WebSocket (CDP)\n           ▼                              ▼\n┌──────────────────────┐    ┌─────────────────────────┐\n│   Browser Daemon     │    │     Chrome / Edge        │\n│  (standalone process)│───▶│   gemini.google.com     │\n│  daemon/server.js    │    │                         │\n│  ├─ engine.js        │    │  Stealth + anti-detect   │\n│  ├─ handlers.js      │    └─────────────────────────┘\n│  └─ lifecycle.js     │\n│     30-min idle TTL  │\n└──────────────────────┘\n```\n\n**Core Design Principles:**\n\n- **Daemon Mode** — The browser process is managed by a standalone Daemon. After MCP calls finish, the browser stays alive; it auto-terminates only after 30 minutes of inactivity.\n- **On-demand Auto-start** — If the Daemon isn't running, MCP tools will automatically spawn it. No manual startup required.\n- **Stealth Anti-detect** — Uses `puppeteer-extra-plugin-stealth` to bypass website bot detection.\n- **Separation of Concerns** — `mcp-server.js` (protocol) → `gemini-ops.js` (operations) → `browser.js` (connection) → `daemon/` (process management)\n\n\u003cbr\u003e\n\n## 📦 Installation\n\n### Prerequisites\n\n- **Node.js** ≥ 18\n- **Chrome / Edge / Chromium** — Any one of these must be installed on your system (or specify a path via `BROWSER_PATH`)\n- The browser must be **logged into a Google account** beforehand (Gemini requires authentication)\n\n### Install Dependencies\n\n```bash\ngit clone https://github.com/WJZ-P/gemini-skill.git\ncd gemini-skill\nnpm install\n```\n\n\u003cbr\u003e\n\n## ⚙️ Configuration\n\nAll configuration is done via environment variables or `.env` files. A `.env` template is provided in the project root — you can edit it directly.\n\n**Priority order:** `process.env` \u003e `.env.development` \u003e `.env` \u003e code defaults\n\n\u003e `.env.development` is git-ignored, making it ideal for local/private settings (e.g. browser path).\n\n### Browser Settings\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `BROWSER_PATH` | Auto-detect | Path to the browser executable (Chrome / Edge / Chromium). If unset, the system's installed browsers are detected automatically by priority |\n| `BROWSER_DEBUG_PORT` | `40821` | CDP remote debugging port. Multiple skills (e.g. douyin-upload-mcp-skill) sharing the same port will share the same browser instance |\n| `BROWSER_HEADLESS` | `false` | Headless mode. Keep it `false` for first-time use so you can log in to your Google account |\n| `BROWSER_USER_DATA_DIR` | Auto-resolve | Browser user data directory for persisting login sessions, cookies, etc. Auto-resolves to `~/.wjz_browser_data` → browser default dir |\n| `BROWSER_PROTOCOL_TIMEOUT` | `60000` | CDP protocol timeout (ms). Increase for long-running operations like image generation |\n\n### Daemon Settings\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `DAEMON_PORT` | `40225` | Daemon HTTP service port |\n| `DAEMON_TTL_MS` | `1800000` | Idle timeout (ms), default 30 minutes. After timeout, the browser is closed and the Daemon exits. It will auto-respawn on the next call |\n\n### Other Settings\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `OUTPUT_DIR` | `./gemini-image` | Image output directory |\n\n### Reusing OpenClaw's Browser Session\n\n[OpenClaw](https://github.com/)'s default CDP port is **18800**. If you want to reuse OpenClaw's existing browser session, set `BROWSER_DEBUG_PORT` to `18800`:\n\n```env\nBROWSER_DEBUG_PORT=18800\n```\n\n**However, please note**: OpenClaw's browser session **does not include the Stealth anti-detection plugin**, making it less resistant to bot detection compared to browser instances managed by this project. This project uses `puppeteer-extra-plugin-stealth` to provide comprehensive anti-detection measures (hiding the webdriver flag, simulating real browser fingerprints, etc.), which better avoids automated detection by websites.\n\n**Recommendation**: Unless you have specific needs, use the default port `40821` and let the project manage its own browser instance for the best anti-detection results.\n\n\u003cbr\u003e\n\n## 🚀 Usage\n\n### Option 1: As an MCP Server (Recommended)\n\nAdd the following to your MCP client configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"gemini\": {\n      \"command\": \"node\",\n      \"args\": [\"\u003cabsolute-path-to-project\u003e/src/mcp-server.js\"]\n    }\n  }\n}\n```\n\nOnce started, the AI can invoke all tools via the MCP protocol.\n\n### Option 2: Command Line\n\n```bash\n# Start MCP Server (stdio mode, for AI clients)\nnpm run mcp\n\n# Start Browser Daemon standalone (usually unnecessary — MCP auto-starts it)\nnpm run daemon\n\n# Run the demo\nnpm run demo\n```\n\n### Option 3: As a Library\n\n```javascript\nimport { createGeminiSession, disconnect } from './src/index.js';\n\nconst { ops } = await createGeminiSession();\n\n// Generate an image\nconst result = await ops.generateImage('Draw a cute cat', { fullSize: true });\nconsole.log('Image saved to:', result.filePath);\n\n// Disconnect when done (browser stays alive, managed by Daemon)\ndisconnect();\n```\n\n\u003cbr\u003e\n\n## 🔧 MCP Tools\n\n### Image Generation\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_generate_image` | Full image generation pipeline (takes 60–120s) | `prompt`, `newSession`, `referenceImages`, `fullSize`, `timeout` |\n\n### Session Management\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_new_chat` | Start a new blank conversation | — |\n| `gemini_temp_chat` | Enter temporary chat mode (no history saved) | — |\n| `gemini_navigate_to` | Navigate to a specific Gemini URL (e.g. a saved session) | `url`, `timeout` |\n\n### Model \u0026 Conversation\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_switch_model` | Switch model (pro / quick / think) | `model` |\n| `gemini_send_message` | Send text and wait for reply (takes 10–60s) | `message`, `timeout` |\n\n### Image Operations\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_upload_images` | Upload images to the input box | `images` |\n| `gemini_get_images` | List all images in the current session (metadata only) | — |\n| `gemini_extract_image` | Extract image base64 data and save locally | `imageUrl` |\n| `gemini_download_full_size_image` | Download full-size high-res image | `index` |\n| `gemini_share_latest_image` | Create a public share link and return `https://gemini.google.com/share/...` | `index`, `timeout`, `copyToClipboard`, `closeDialog` |\n\n### Text Responses\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_get_all_text_responses` | Get all text responses in the session | — |\n| `gemini_get_latest_text_response` | Get the latest text response | — |\n\n### Diagnostics \u0026 Management\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `gemini_check_login` | Check Google login status | — |\n| `gemini_probe` | Probe page element states | — |\n| `gemini_reload_page` | Reload the page | `timeout` |\n| `gemini_browser_info` | Get browser connection info | — |\n\n\u003cbr\u003e\n\n## 🔄 Daemon Lifecycle\n\n```\nFirst MCP call\n  │\n  ├─ Daemon not running → auto-spawn (detached + unref)\n  │                        → poll until ready (up to 15s)\n  │\n  ├─ GET /browser/acquire → launch/reuse browser + reset 30-min countdown\n  │\n  ├─ MCP tool finishes → disconnect() (closes WebSocket, keeps browser alive)\n  │\n  ├─ Another call within 30 min → countdown resets (extends TTL)\n  │\n  └─ 30 min with no activity → close browser + stop HTTP server + exit process\n                                 (next call will auto-respawn)\n```\n\n**Daemon API Endpoints:**\n\n| Endpoint | Description |\n|----------|-------------|\n| `GET /browser/acquire` | Acquire browser connection (resets TTL) |\n| `GET /browser/status` | Query browser status (does NOT reset TTL) |\n| `POST /browser/release` | Manually destroy the browser |\n| `GET /health` | Daemon health check |\n\n\u003cbr\u003e\n\n## 📁 Project Structure\n\n```\ngemini-skill/\n├── src/\n│   ├── index.js               # Unified entry point\n│   ├── mcp-server.js          # MCP protocol server (registers all tools)\n│   ├── gemini-ops.js          # Gemini page operations (core logic)\n│   ├── operator.js            # Low-level DOM operation wrappers\n│   ├── browser.js             # Browser connector (Skill-facing)\n│   ├── config.js              # Centralized configuration\n│   ├── util.js                # Utility functions\n│   ├── watermark-remover.js   # Image watermark removal (via sharp)\n│   ├── demo.js                # Usage examples\n│   ├── assets/                # Static assets\n│   └── daemon/                # Browser Daemon (standalone process)\n│       ├── server.js          # HTTP micro-service entry\n│       ├── engine.js          # Browser engine (launch/connect/terminate)\n│       ├── handlers.js        # API route handlers\n│       └── lifecycle.js       # Lifecycle control (lazy shutdown timer)\n├── references/                # Reference documentation\n├── SKILL.md                   # AI invocation spec (read by MCP clients)\n├── package.json\n└── .env                       # Environment config (create manually)\n```\n\n\u003cbr\u003e\n\n## ⚠️ Notes\n\n1. **First-time login required** — On the first run, the browser will open the Gemini page. Complete Google account login manually. Login state is persisted in `userDataDir`, so subsequent runs won't require re-login.\n\n2. **Single instance only** — Only one browser instance can use a given CDP port. Running multiple instances will cause port conflicts.\n\n3. **Windows Server considerations** — Path normalization and Safe Browsing bypass are built-in, but double-check:\n   - Chrome/Edge is properly installed\n   - The output directory is writable\n   - The firewall is not blocking localhost traffic\n\n4. **Image generation takes time** — Typically 60–120 seconds. Set your MCP client's `timeoutMs` to ≥ 180000 (3 minutes).\n\n\u003cbr\u003e\n\n## 📝 To Do List\n\n- [x] **Full MCP tool registration**\n- [x] **On-demand Daemon auto-start**\n- [x] **Full-size CDP image download**\n- [x] **Auto watermark removal**\n- [x] **Reference image upload \u0026 image-to-image**\n- [x] **Historical session navigation**\n- [ ] **Multi-browser instance parallel support**\n- [ ] **Music generation support**\n- [ ] **Video generation support**\n\n\u003cbr\u003e\n\n## 📄 License\n\nThis project is licensed under the MIT License — see [LICENSE](https://github.com/WJZ-P/gemini-skill/blob/main/LICENSE) for details.\n\n## LINUX DO\n\nThis project supports the [LINUX DO](https://linux.do) community.\n\n\u003cbr\u003e\n\n## If you find this useful, give it a ⭐!\n\n## ⭐ Star History\n\n[![Stargazers over time](https://starchart.cc/WJZ-P/gemini-skill.svg?variant=adaptive)](https://starchart.cc/WJZ-P/gemini-skill)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWJZ-P%2Fgemini-skill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWJZ-P%2Fgemini-skill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWJZ-P%2Fgemini-skill/lists"}