Communitygithub.com

Gemini Web MCP

使用於 gemini-web-mcp 儲存庫或其 Gemini Web MCP/技能伺服器時:檢查工具清單、選擇安全的 Gemini Web 工具、管理聊天記錄與原生筆記本、驗證 Pro Web 功能涵蓋範圍、生成與驗證媒體產出、更新文件/測試/評估,或避免不安全的破壞性/私人帳戶操作。

Gemini Web MCP 是什麼?

這項技能專為 Gemini Web MCP 伺服器與低令牌技能伺服器設計,提供一套結構化的工作流程,用以安全且有效率地與 Gemini Web 功能互動。它的主要價值在於防止意外使用破壞性或隱私相關工具,要求在使用前先透過工具清單進行探索,並區分唯讀與需要明確使用者意圖的操作。此技能支援兩種伺服器表面:主要的 MCP 伺服器 (`src.server`) 適用於廣泛的內容工作流程,而低令牌技能伺服器 (`src.skill_server`) 則提供更精簡的帳戶與歷史操作。技能的文件強調了操作的明確順序,例如在搜尋聊天內容前先掃描元資料、將聊天移至原生筆記本前先識別目標,以及在確認後才執行刪除。它還包含用於驗證 Pro Web 功能涵蓋範圍的規則,以及生成音樂、影片和圖像等媒體的特定工作流程,並教導代理程式如何從原始聊天負載中復原媒體。最後,技能提供了完整的驗證指令,包括執行測試、編譯關鍵檔案、檢查 git diff,以及執行技能驗證器以確保變更正確。

相容平台~Claude Code✓Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/Luckycat133/gemini-web-mcp/tree/main/.agents/skills/gemini-web-mcp

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Gemini Web MCP 是做什麼的?

請在處理此儲存庫的 Gemini Web MCP 伺服器和低令牌技能伺服器時使用此技能。

開始使用

  1. 在選擇主要伺服器工具前,優先使用 gemini_get_tool_manifest。即使設定 GEMINI_TOOLS=core 或 GEMINI_TOOLS=prompts,src.server 仍會始終暴露此工具。
  2. 檢查 manifest 中的 current_enabled、groups 和 workflows;不要硬編碼工具數量,因為靜態 manifest 可能包含未在當前進程中載入的群組。
  3. 在低令牌伺服器上,優先使用無需驗證的 account(action="manifest") 和 account(action="capabilities"),然後再執行需要初始化 Gemini 的帳戶呼叫。
  4. 優先進行唯讀探索:gemini_doctor、manifest/capabilities、gemini_probe_web_features、僅含元資料的歷史搜尋、設定檔診斷以及庫存/列表工具。
  5. 將 privacy=reads_private_chat_text 及其他處理私人文字的工具視為需要明確使用者意圖的工具:gemini_read_chat、gemini_export_chat、gemini_search_chats(scan_turns=true),以及會讀取聊天文字的研究報告建立動作。
  6. 將破壞性工具視為需要明確使用者意圖的工具:gemini_delete_chat、gemini_cleanup_test_artifacts(dry_run=false)、gemini_delete_scheduled_action、gemini_reset_session、gemini_manage_gems(action="delete") 以及提示詞刪除。

工具表面

  • 主要 MCP 伺服器:src.server
    • 當代理程式僅需呼叫 Gemini 模型時,使用 GEMINI_TOOLS=model 或 chat。
    • 當代理程式僅需使用 gemini_history 進行聊天歷史記錄的列表/掃描/搜尋/讀取/匯出時,使用 GEMINI_TOOLS=history。
    • 當代理程式需要 gemini_history、gemini_notebooks 以及明確的聊天轉移至筆記本時,使用 GEMINI_TOOLS=history-organize。
    • 當代理程式僅需使用 gemini_account_inventory 進行唯讀 Web 表面庫存時,使用 GEMINI_TOOLS=account-read。
    • 僅在明確授權的排程動作建立/刪除工作流程中使用 GEMINI_TOOLS=scheduled-admin。
    • 預設的 GEMINI_TOOLS=core 仍然是最廣泛的內容工作流程:聊天、媒體、檔案和研究。
    • GEMINI_TOOLS=all 是完整的維護/驗證表面,不適合用作一般代理程式的預設值。
    • GEMINI_TOOLS=prompts 添加本地提示詞管理,以及始終在線的 manifest/cookie 輔助工具。
  • 低令牌技能伺服器:src.skill_server
    • 使用 account(action="manifest") 獲取精簡的工具指引。
    • 使用 account(action="capabilities") 獲取無需 cookie 的靜態 Web 功能地圖。
    • 使用 account(action="features|links|usage|library|notebooks|scheduled|modes") 獲取精簡的帳戶表面庫存。
    • 使用 history(action="list|search|read|export|delete") 處理聊天歷史記錄。
    • 在根據標記刪除測試聊天或排程動作之前,使用 cleanup(dry_run=true)。
    • 使用 scheduled(action="list|get|create|delete") 處理精簡的排程動作工作流程。
    • 使用 create(type="music", model="pro") 或主要的 gemini_generate_music 發送 Lyria 3 Pro 音樂請求。
    • 在執行即時帳戶工作流程之前,使用 doctor(validate_browser=false) 進行低成本的本機預檢。
    • 當 Chrome 有多個已登入的設定檔時,在 cookie(action="get", profile="...") 之前,先使用 cookie(action="profiles")。

聊天歷史記錄工作流程

  1. 當完整性重要時,深度掃描元資料來源:
    • gemini_history(action="scan", limit=..., offset=..., response_format="json")
  2. 先列出或搜尋元資料:
    • gemini_history(action="list", limit=..., offset=..., response_format="json")
    • gemini_history(action="search", query=..., scan_turns=false, response_format="json")
  3. 僅在使用者要求內容搜尋時,才掃描對話輪次文字:
    • gemini_history(action="search", query=..., scan_turns=true, turns_per_chat=..., max_chars_per_turn=...)
  4. 僅在使用者指明目標後,才讀取/匯出選定的單一聊天:
    • gemini_history(action="read", chat_id=...)
    • gemini_history(action="export", chat_id=..., response_format="markdown"|"json")
  5. 僅在識別出目標聊天和筆記本後,才將聊天移至原生筆記本:
    • gemini_notebooks(action="list", ...)
    • gemini_move_chat_to_notebook(chat_id=..., notebook_id=...)
    • gemini_notebooks(action="chats", notebook_id=...)
  6. 僅在獲得明確確認後才執行刪除:
    • gemini_delete_chat(chat_id=...)

Web Pro 涵蓋範圍規則

  • gemini_get_web_capabilities 是靜態觀測到的 Pro Web 表面地圖。
  • gemini_probe_web_features 檢查觀測到的唯讀 RPC 可達性,且不得暴露原始私人 RPC 主體。
  • 使用 gemini_account_inventory(surface=...) 或 manifest 的 web_surface_inventory 工作流程進行唯讀帳戶庫存:公開連結、使用限制、原生筆記本、函式庫功能、排程動作和工具模式狀態。
  • 將 gemini_list_library_capabilities 視為本地化範本/功能探索,而非私人 Library 資產匯出。
  • 將 gemini_get_tool_mode_status 視為唯讀的 Canvas/引導式學習模式狀態探測;Canvas 文件修改仍處於禁用狀態。
  • 引導式學習透過聊天 learning_mode 暴露;優先使用此功能而非 UI 假設。
  • 在穩定的 RPC 合約和明確的使用者授權出現之前,保持停用 Drive 選擇器、Canvas 突變、設定突變、記憶體匯入突變、公開連結突變以及不支援的排程動作重複/編輯/切換變體。

媒體工作流程

  • 對於音樂/影片/圖像生成請求,使用 MCP 工具路徑,並僅在工具報告已儲存本地媒體檔案或明確匯出失敗時才完成。
  • 對於 Lyria 3 Pro/fullsong 聲明,驗證原始後端標記和已儲存媒體的持續時間;不要僅依賴包裝標籤、模型名稱或聊天內文。
  • 即使 response.media 為空,gemini_generate_music 也能從原始聊天負載中復原媒體;在先總結成功之前,檢查回傳的檔案路徑和持續時間元資料。

排程動作

  • 透過 gemini_create_scheduled_action、gemini_list_scheduled_actions、gemini_get_scheduled_action 和 gemini_delete_scheduled_action,使用觀測到的每日建立、註冊表列表、依 ID 取得和依 ID 明確刪除。
  • 當帳戶上下文重要時,先重新整理 Chrome cookie。如果註冊表意外為空,請呼叫 gemini_list_browser_cookie_profiles,然後為具有 Gemini cookie 或排程註冊表項目的設定檔呼叫 gemini_get_cookie_from_browser(profile="...")。
  • 在建立/刪除後,檢查 verification_status;建立後也檢查 readable_by_id_after_create,刪除後則檢查 deleted_by_id_after_delete 或 task_state_after_delete=deleted,然後才能聲明任務已消失。

驗證

在完成變更之前,請執行:

./.venv/bin/pytest -q
./.venv/bin/python -m py_compile src/tools/annotations.py src/tools/chat.py src/tools/media.py src/tools/file.py src/tools/research.py src/tools/prompts.py src/tools/manage.py src/server.py src/skill_server.py src/client_wrapper.py src/thinking_client.py src/constants.py
git diff --check

當變更 manifest 或能力元資料時,也請驗證:

GEMINI_TOOLS=core ./.venv/bin/python - <<'PY'
import asyncio
from src.server import mcp
async def main():
    tools = await mcp.list_tools()
    print(len(tools), [t.name for t in tools if t.annotations is None])
asyncio.run(main())
PY

僅針對技能的變更,至少需要對本地專案副本和公開儲存庫技能副本執行技能驗證器:

for path in .codex/skills/gemini-web-mcp .agents/skills/gemini-web-mcp; do
  ./.venv/bin/python /Users/jack/.codex/skills/.system/skill-creator/scripts/quick_validate.py "$path"
done

保持 evaluations/gemini_web_mcp_contract.xml 與 gemini_get_tool_manifest 和 gemini_get_web_capabilities 一致。

相關技能