
GeminiBastionMCP — Remote MCP Bastion for Web Gemini, Claude & ChatGPT
io.github.Kaiserunix由 GitHub 帳號 Kaiserunix 發布v0.3.0更新於 Nov 21, 2026
OAuth 2.1 MCP bastion for Web Gemini, Claude & ChatGPT: 10 tools, 1 gate, bwrap & multi-agent.
發布方自己的服務:Claude Platform Docs
概覽
自架 OAuth 2.1 MCP 閘道,讓網頁與行動端 AI 用戶端探索程式碼、在沙箱中執行指令與代理,並透過單一審批關卡發布變更。
- 可以做什麼
- 管理工作區:列出工作區、同步 GitHub 儲存庫、初始化 Cloudflare 維運、查看檢查點並回復,以及儲存與取用持久化工作區記憶。
- 探索程式碼:打包儲存庫、以 ripgrep 搜尋、執行 AST 查詢、讀取指定行與產出物、檢視 git 差異。
- 編輯程式碼:套用原子化多檔案修補、建立或覆寫檔案、刪除檔案,並自動建立檢查點與驗證。
- 執行指令與代理:在沙箱中執行 shell 指令,將背景任務派送給 Codex、Claude Code、Gemini CLI 或 OpenCode 驅動程式,並輪詢或取消任務。
- 唯讀檢視外部系統:GitHub 拉取請求、議題與失敗的 Actions 日誌,以及 Cloudflare 的區域、DNS、Workers、Pages、KV、D1 與 WAF。
- 暫存與發布:產生可回復的變更計畫,然後建立拉取請求、留言或審查、部署 Workers 或 Pages,或執行與回復已暫存的計畫。
- 適用情境
- 適合想從瀏覽器或行動裝置 AI 用戶端(例如 Gemini Connected Apps、Claude.ai 連接器或 ChatGPT)驅動寫程式、測試與部署,而不在主機上暴露原始 shell 的情境。也適合希望以單一可稽核的寫入關卡取代大量逐項確認的維運人員。
- 執行需求
- 以 Docker 映像(lite 或 full)執行,或在本機以 Node.js 22.23.4 以上版本執行。需要 PUBLIC_DOMAIN、至少 32 字元的隨機 OAUTH_SIGNING_SECRET,以及供維運登入的 ADMIN_PASSWORD_HASH。遠端用戶端還需要公開 HTTPS 入口(Cloudflare Tunnel 或 Nginx)。選用憑證包括 GitHub 與 Cloudflare 權杖、代理 API 金鑰、OAuth SSO 用戶端 ID 以及側車權杖。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 GeminiBastionMCP — Remote MCP Bastion for Web Gemini, Claude & ChatGPT,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[GeminiBastionMCP — Self-Hosted OAuth 2.1 Remote MCP Server for Web Gemini, Claude.ai & ChatGPT]
GeminiBastionMCP (gemini-bastion-mcp)
Built for Web Gemini (gemini.google.com) Connected Apps, Claude.ai Custom Connectors & ChatGPT MCP Connectors — NOT Gemini-Only.
[CI] [Docker Publish] [Deploy GitHub Pages] [Release v0.3.0] [GHCR lite | full] [MCP Registry] [Node.js >= 22.23.4] [MCP 2025-11-25] [OAuth 2.1 + PKCE + DCR] [Issues Welcome] [License: MIT]
English | 简体中文
Live Showcase · Why This Exists · Architecture · 10 Tools & Memory · Gem Prompt & MCP Prompts · CI Watchdog · Quick Start · Security v2 · MCP Registry
- 100% Standard Remote MCP for Web Gemini, Claude.ai & ChatGPT: Named
GeminiBastionMCPbecause it conqueredgemini.google.comConnected Apps' strict OAuth 2.1 DCR rules first (16 redirect URIs, 8KBstate, RFC 8707/9728) — while speaking pure MCP 2025-11-25 Streamable HTTP for Claude.ai Custom Connectors, ChatGPT MCP Connectors, Cursor & MCP Inspector. - Code, Test & Deploy from Mobile or Any Browser: Sync GitHub repos, explore AST/files (
ripgrep,ast-grep,repomix), apply atomic multi-file patches, and run L0/L1/L2 checks inside a per-workspacebwrapFS & network jail (--unshare-netby default). - Pluggable Multi-Agent Drivers & 1-Gate Blast Radius: Delegate background tasks to OpenAI Codex SDK, Claude Code CLI, Gemini CLI, or OpenCode CLI (
workspace_execauto-promotes after 15s), with zero gateway secret leakage and every external write funneled through one single approval gate (publish_changes).
[!TIP] Skip the build! Pull pre-built multi-variant GHCR images (
ghcr.io/kaiserunix/gemini-bastion-mcp:lite~350MB or:full) and launch in under 60 seconds withdocker compose pull && docker compose up -d.
Why This Exists
Most Remote MCP Servers force an unpleasant tradeoff: either expose dozens of fine-grained tools (triggering endless confirmation popups on every file read or test run) or run an unguarded shell directly on your host.
Architecture Overview
10 Tools, 1 Approval Gate
Instead of exposing 40+ granular tools that bury mobile/web users under approval prompts, GeminiBastionMCP groups capabilities by blast radius so you can configure client permissions cleanly:
Tier 1 — Sandbox Autonomy & Read-Only Inspection (Set to Always Allow)
Tier 2 — Zero-Side-Effect Change Staging (Set to Always Allow)
Tier 3 — Single External Write Gate (Set to Ask Before Running)
Pluggable Multi-Agent Drivers
Set a default driver via DEFAULT_AGENT_DRIVER in .env or select one per job with dispatch_runner (runner_type: "agent_readonly" | "agent_write", agent_driver):
Visual UI Preview
1-Minute Quick Start (GHCR Zero-Build)
docker/docker-compose.yml runs gateway with zero host ports exposed (expose: ["8787"] only), pulling pre-built GHCR images in seconds (lite ~350MB by default, or full with Python 3.12 + uv, mise, ruff, biome, pyright, ast-grep, repomix, shellcheck, hadolint, actionlint, gitleaks, gh, wrangler).
Option A: Zero-Build GHCR Pull + Cloudflare Tunnel (Recommended)
-
Pull directly or clone the Compose stack:
-
Generate
ADMIN_PASSWORD_HASH(scrypt:) andOAUTH_SIGNING_SECRET: Supported formats in production arescrypt:<saltHex>:<keyHex>(recommended, Docker-Compose-safe without$escaping) andsha256:<hex>(legacyscrypt$<saltHex>$<keyHex>/sha256$<hex>are also supported; escape$as$$in Docker Compose.env): -
Set core values in
.env, point your Cloudflare Tunnel Public Hostname (mcp.yourdomain.com) tohttp://gateway:8787, putCLOUDFLARE_TUNNEL_TOKEN=<token>indocker/.env(or export it in your shell), and start in 30 seconds:To switch to the
:fulltoolchain image, setBASTION_IMAGE_TAG=fullindocker/.env(or build locally withBASTION_TARGET=runtime-full docker compose -f docker/docker-compose.yml up -d --build).
[!IMPORTANT] Node 22 Security Baseline: Both
runtime-liteandruntime-fullindocker/DockerfileenforceNode >= 22.23.4at build time.cloudflaredreceives onlyTUNNEL_TOKEN(never mounts../.env).
Environment Variable Reference (.env)
Option B: Reverse Proxy with Nginx (Loopback Host Port)
Bind gateway strictly to loopback (127.0.0.1:8787:8787 or 127.0.0.1:39120:8787) via a docker-compose.override.yml, set TRUST_CF_CONNECTING_IP=false in .env, and run gateway without cloudflared:
Nginx Reverse Proxy Config (Streamable HTTP, SSE & 8KB OAuth State)
Option C: Local Development
Verify at http://127.0.0.1:8787/healthz and http://127.0.0.1:8787/. Both npm run dev and npm start automatically load .env via Node's --env-file-if-exists=.env.
Connecting AI Clients
GeminiBastionMCP implements MCP 2025-11-25 Streamable HTTP (stateless /mcp, zero legacy HTTP+SSE) with OAuth 2.1 + PKCE (S256) + RFC 8707 Resource Indicators + RFC 9728 Protected Resource Metadata.
- Web Gemini (
gemini.google.comConnected Apps):- Confirm
PUBLIC_DOMAINmatches your public HTTPS URL andOAUTH_ALLOWED_REDIRECT_HOSTSincludesgemini.google.com,aistudio.google.com,accounts.google.com(default in.env.example). - Add
https://mcp.yourdomain.com/mcpin Gemini Connected Apps / Custom MCP connector settings. - Gemini automatically discovers
/.well-known/oauth-protected-resource,/.well-known/oauth-authorization-server, and registers viaPOST /oauth/register(up to 16 redirect URIs per client andstateup to 8192 bytes).
- Confirm
- Claude.ai Custom Connectors, ChatGPT MCP & MCP Inspector:
- Automatic DCR: Point directly to
https://mcp.yourdomain.com/mcp. - Static Client Fallback: Set
OAUTH_STATIC_CLIENT_IDandOAUTH_STATIC_CLIENT_SECRETin.env, restartgateway, and point Authorization URL to/oauth/authorizeand Token URL to/oauth/token.
- Automatic DCR: Point directly to
Upstream Operator Login (Google & GitHub OAuth)
In addition to ADMIN_PASSWORD_HASH, you can enable Google OAuth and/or GitHub OAuth SSO for one-tap operator sign-in on /admin/login and MCP consent approval on /oauth/authorize:
- Register Callback URLs:
- Google Cloud Console (OAuth 2.0 Web Application):
https://<PUBLIC_DOMAIN>/auth/idp/google/callback - GitHub Developer Settings (OAuth App):
https://<PUBLIC_DOMAIN>/auth/idp/github/callback
- Google Cloud Console (OAuth 2.0 Web Application):
- Set
.envCredentials & Allowlists:- Google:
GOOGLE_OAUTH_CLIENT_ID,GOOGLE_OAUTH_CLIENT_SECRET,GOOGLE_OAUTH_ALLOWED_EMAILS - GitHub:
GITHUB_OAUTH_CLIENT_ID,GITHUB_OAUTH_CLIENT_SECRET,GITHUB_OAUTH_ALLOWED_USERS, optionalGITHUB_OAUTH_ALLOWED_IDS(when both users & IDs are set, both must match)
- Google:
[!IMPORTANT] Fail-Closed Single-Operator Security: Both IdPs stay disabled unless credentials and a non-empty allowlist are configured — and in
NODE_ENV=production, providing client credentials without an allowlist fails startup closed. Google requiresemail_verified: true, and all upstream flows enforce PKCES256,HttpOnlybinding cookies, and CSRF validation.
Security Architecture v2 (6-Layer Defense-in-Depth)
- Per-Workspace
bwrapFS & Network Jail: On Linux (SANDBOX_BWRAP_ISOLATION=true),workspace_execand CLI agent drivers execute insidebubblewrap(--ro-bind / / --tmpfs /workspaces --bind <workspaceDir> --tmpfs /data --unshare-net) so sibling workspaces are invisible and network egress is disabled unless explicitly opted in (allow_network: true). SetSANDBOX_STRICT_ISOLATION=trueto fail closed ifbwrapnamespaces are unavailable. - Zero Gateway Secret Leakage &
SecretScrubber:buildSandboxedEnv()stripsGH_TOKEN,CLOUDFLARE_*,OAUTH_SIGNING_SECRET,ADMIN_PASSWORD_HASH,NOTIFY_WEBHOOK_URL,OPS_MCP_AUTH_TOKEN,AGENT_RUNNER_AUTH_TOKEN, and unused LLM keys. All outputs, artifacts, and webhooks pass throughSecretScrubber. - Linux UID 1001 / 1002 Isolation + Optional
isolated-runnerSidecar:gateway(UID1001) owns/data(0700, SQLite DB,/data/artifacts,/data/codex), whileworker(UID1002) owns/workspaces. Enable--profile isolated-runner(AGENT_RUNNER_URL=http://isolated-runner:8788,AGENT_RUNNER_AUTH_TOKEN >= 24 chars) to run autonomous coding agents in a separate UID1002container with no/data, no SQLite, and no GH/CF/OAuth secrets. - Authenticated
ops-mcpBearer Proxy:docker/ops-mcp-auth-proxy.mjswrapsops-mcpon port9000, fails closed unlessOPS_MCP_AUTH_TOKEN >= 24chars is set, and validatesAuthorization: Bearerwithcrypto.timingSafeEqual.DownstreamMcpBridgeinjects per-request tokens viaauthTokenEnv. - Non-Destructive Git Checkpoints & Protected Branch Guard: Pre-patch and pre-agent snapshots use a temporary
GIT_INDEX_FILE(refs/mcp-checkpoints/*).publish_changesblocks direct pushes tomain/master/default and blocks sensitive files (.env*,*.pem,*.key,id_rsa*,.dev.vars*). - OAuth 2.1 Family Rotation & Untrusted Boundary: Refresh token reuse outside the 60s grace window revokes the entire family; external GitHub/Cloudflare/MCP-2 data is wrapped as untrusted content.
[!NOTE] Data Privacy & Platform Policy Note:
GeminiBastionMCPuses official Custom Connected Apps / MCP Streamable HTTP + OAuth 2.1 protocols only (never browser automation, scraping, or cookie-hijacking against consumer web apps). Tool outputs returned to consumer web AI chats are processed under that AI provider's activity and privacy policy — avoid connecting regulated PII or strictly confidential corporate repositories to personal consumer accounts, and keep the built-in sensitive-file blacklist andSecretScrubberenabled.
Running Optional Sidecars (--profile isolated-runner, --profile ops & Webhooks)
- Dedicated
isolated-runnerSidecar: SetAGENT_RUNNER_URL=http://isolated-runner:8788andAGENT_RUNNER_AUTH_TOKEN=<24+ char random token>in.env(and export or putAGENT_RUNNER_AUTH_TOKENindocker/.env): - Authenticated
ops-mcpSidecar (OPS_MCP_AUTH_TOKEN): Createdocker/ops-ssh/with your restrictedconfig.json& SSH key, copydocker/ops-mcp-config.example.jsontodocker/ops-mcp-config.json(url: "http://ops-mcp:9000/mcp",authTokenEnv: "OPS_MCP_AUTH_TOKEN"), uncomment the volume mount indocker/docker-compose.yml, setOPS_MCP_AUTH_TOKEN(>= 24chars) +DOWNSTREAM_MCPS_FILE=/etc/gemini-bastion/ops-mcp-config.json, and launch: - Webhook Notifications: Set
NOTIFY_WEBHOOK_URLin.envfor scrubbed JSON POST alerts on job completion/failure or staged plan execution/rollback.
Gemini Gem Prompt, Persistent Memory & MCP Prompts
- Ready-to-Paste Gem / Claude Project System Prompt: Use
docs/GEMINI_GEM_PROMPT.md(English & 简体中文) when creating a dedicated Gemini Gem (gemini.google.com/gems), Claude Project, or ChatGPT Custom GPT so the model follows the 10-tool SOP automatically. - MCP
instructions& 4 Built-In Prompts:McpServerships conciseinstructionsoninitializeplus 4 official MCP Prompts (review_pr,fix_issue,resume_workspace_task,ops_health_check). - Cross-Session Persistent Workspace Memory (
workspace_memories):- Store durable
task_state,decision,pitfall,preference, andnoteentries viaworkspace_manage(memory_list,memory_upsert,memory_delete— secret-scanned before saving, up to 100 entries / 8KB per entry). workspace_manage(list,sync_github,init_cf_ops) automatically recalls pinned/recent memories,dispatch_runner(include_memory: true) injects[Workspace Persistent Memory]into background agents, and/adminincludes a Memory tab to inspect or delete entries.
- Store durable
Optional Read-Only GitHub CI Watchdog
Enable WATCHDOG_ENABLED=true with GITHUB_WEBHOOK_SECRET (>= 24 chars) and WATCHDOG_ALLOWED_REPOS=owner/repo to point GitHub workflow_run webhooks at https://<PUBLIC_DOMAIN>/webhooks/github:
- Requests are rate-limited, capped at 64KB (
413), HMAC-SHA256 verified (X-Hub-Signature-256->401on mismatch), and restricted toWATCHDOG_ALLOWED_REPOS(403otherwise). - When a workflow fails (
action: "completed",conclusion: "failure"), the Watchdog dispatches a strictlyreadonlydiagnostic job, saves a pinnedci-failure-<runId>task_statememory, and sends a scrubbedNOTIFY_WEBHOOK_URLalert so you can open Web Gemini and take over immediately. - 100% Policy-Compliant: Never writes repo code, never calls
publish_changes, and never automates any consumer web UI.
Official MCP Registry & GHCR Images
- Official MCP Registry:
server.json(io.github.Kaiserunix/gemini-bastion-mcp, schema2025-12-11, validated viamcp-publisher). - Automated OIDC Publishing (
github-oidc): Taggingv*triggers.github/workflows/docker-publish.ymlto push GHCR images first and then runpublish-mcp-registry(mcp-publisher validate->mcp-publisher login github-oidc->mcp-publisher publish server.json). - GHCR Images:
ghcr.io/kaiserunix/gemini-bastion-mcp:lite/:latest/:<version>-lite(~350MB slim gateway +bwrap+git+ripgrep)ghcr.io/kaiserunix/gemini-bastion-mcp:full/:<version>-full(adds Python 3.12 +uv,mise,ruff,pyright,biome,ast-grep,repomix,shellcheck,hadolint,actionlint,gitleaks,gh,wrangler)ghcr.io/kaiserunix/gemini-bastion-mcp-ops:latest/:<version>(authenticatedops-mcpBearer proxy sidecar)
Feedback, Issues & Contributions Welcome
[!TIP] Have a bug report, new agent driver idea, or client OAuth quirk (Gemini / Claude / ChatGPT)? Please open a GitHub Issue, submit a PR, or start a thread in GitHub Discussions — community feedback directly shapes our next release!
- Roadmap: Per-job ephemeral container/microVM worker isolation (
v0.3) and multi-operator RBAC policies. - Contributing: See CONTRIBUTING.md for local setup, architectural guardrails, and PR checklist.
- Security Policy: See SECURITY.md for threat model and private vulnerability reporting.
- Release History & License: CHANGELOG.md · MIT License
來源:README.md,提交 13bf26b
工具
0版本歷史
1- v0.3.0最新Nov 21, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Claude 整合
Claude Platform Docs
com.claude.platform官方發布者
遠端 MCP 伺服器,讓助理搜尋並閱讀 Claude 平台文件與 API 參考。

Claude Roslyn Lsp
由 GitHub 帳號 lahma 發布
把微軟 Roslyn C# 語言伺服器接進助理,用於語意符號查找、引用、診斷、程式碼動作、重新命名與格式化。

Claude SEO Skills
由 GitHub 帳號 NoteSupreme 發布
免費、唯讀的遠端 MCP 伺服器,讓助理搜尋並閱讀兩套開源 SEO 技能包,並依其中的說明執行。

Mcp Claude Usage Guard
由 GitHub 帳號 GuardBee 發布
本機 MCP 伺服器,將 Claude 方案用量表與本機 Claude Code 用量比對,標出並非來自本機的用量。

WebDesk for Claude
由 GitHub 帳號 Red-Center-Studio 發布
通過 Claude 建立併發布小型企業網站。免費方案,使用電子郵件驗證碼登入。AI 翻譯