Google Colab GPU MCP Bridge
Allows provisioning and controlling remote Google Colab GPU/TPU VM sessions, running Python/Bash, installing packages, and managing files via google-colab-cli.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Colab4WebGemini
English | 简体中文
Turn your local authenticated google-colab-cli into a Streamable HTTP MCP server so the Gemini Web App (Gemini Apps Developer Mode) can directly provision and control remote Google Colab GPUs (T4, L4, G4, A100, H100) and TPUs (v5e1, v6e1), run Python/Bash, install packages, and manage files — with optional single-tunnel proxying for gflow-cli.
Architecture
flowchart LR
GW["Gemini Web App<br/>(Custom MCP Connector)"] -- "HTTPS POST<br/>Streamable HTTP" --> TN["HTTPS Tunnel<br/>(Cloudflare Named / Quick<br/>or localhost.run fallback)"]
TN --> AG["Colab4WebGemini Gateway<br/>(Starlette + MCP 2.3.0)"]
AG -- "/<secret>/colab/mcp<br/>Per-session Queue Lock" --> CLI["google-colab-cli<br/>(Local OAuth2 / ADC)"]
CLI --> VM["Google Colab Cloud VM<br/>(T4 / L4 / A100 / H100 / TPU)"]
AG -. "/<secret>/gflow/mcp<br/>Optional Stream Proxy" .-> GF["gflow serve<br/>(Optional Companion)"]Related MCP server: mcp-server-colab-exec
Why a Dedicated Bridge for Gemini Web?
Exposing google-colab-cli to the Gemini Web App is not just wrapping stdio over HTTP. Colab4WebGemini solves the four real-world protocol and runtime pitfalls verified against live Gemini Web traffic:
Gemini-Clean Tool Schemas: All 15 tools expose pure scalar parameters (
string,number,boolean) withstructured_output=False— zeroanyOf,oneOf,additionalProperties,null, oroutputSchemafields that cause Gemini's tool converter to silently drop the entire toolset.Stateless Multi-Node Streamable HTTP: Gemini Web dispatches requests from distributed backend IPs. The gateway uses
stateless_http=True,json_response=True, disables loopback-only DNS rebinding rejection behind tunnels, and returns spec-compliant405 Method Not AllowedonGETprobes instead of hanging idle SSE streams.Per-Session Concurrency Lock & Proxy-Safe Timeouts: When Gemini emits parallel tool calls against the same Colab session, an
asyncio.Lockper(profile, session)serializes access to the remote Jupyter kernel WebSocket (eliminating deadlocks) while capping per-call timeout under Cloudflare's 100s edge timeout so the UI never hangs on"Connecting...".Reduced Confirmation Prompts (
ToolAnnotations): Unannotated MCP tools default toreadOnlyHint: false, destructiveHint: true, causing Gemini Web to repeatedly ask for confirmation or reset "Always allow".auto_approve_hints: true(configurable inconfig.json) annotates tools withreadOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false.
Additional quality-of-life features:
Auto-Fallback HTTPS Tunnel:
Cloudflare Named Tunnel->Cloudflare Quick Tunnel->localhost.runSSH reverse tunnel (automatically recovers fromtrycloudflare.com429rate limits).Hot-Reload Without Rotating Tunnel URL: Restarting
gateway.pypreserves the running tunnel process and its public HTTPS URL.Multi-Account Support: Every tool accepts an optional
profileargument forwarded viaCOLAB_PROFILE.Built-in JSON-RPC Trace Log: Full request/response diagnostics written to
logs/mcp_trace.log.
Prerequisites
Python 3.12+ and
uv(recommended) orpip.google-colab-cliinstalled and authenticated locally:uv tool install google-colab-cli colab whoami colab usage(Optional)
cloudflaredinPATHor./bin/cloudflared[.exe]for Cloudflare Tunnels. Without it (or if Quick Tunnel hits rate limit429), the supervisor automatically falls back to OpenSSH (localhost.run).
Quick Start
1. Clone and install dependencies
git clone https://github.com/birdbike/Colab4WebGemini.git
cd Colab4WebGemini
uv venv --python 3.12
uv pip install -e .2. Configure (optional)
On first run, config.json is auto-generated with a 32-hex high-entropy secret_path and auto-discovered colab binary. You can also copy config.example.json to config.json to customize:
colab_exe: Explicit path tocolab/colab.exeif it is inside a separate virtualenv instead ofPATH.enable_gflow/gflow_exe: Settrueto also proxy a localgflow serveinstance at/<secret_path>/gflow/mcp.auto_approve_hints:trueby default to prevent repeated confirmation dialogs in Gemini Web; setfalsefor strict read/write/destructive annotations.tunnel_provider:"auto"(default),"cloudflared","localhost.run", or"none".
3. Start the bridge
Windows (PowerShell background scripts):
powershell -ExecutionPolicy Bypass -File .\start.ps1
powershell -ExecutionPolicy Bypass -File .\status.ps1
powershell -ExecutionPolicy Bypass -File .\stop.ps1Linux / macOS / Cross-platform (foreground):
python run_stack.py
# Or using the installed console entry point:
colab4webgeminiThe console prints your ready-to-paste HTTPS endpoint:
================ MCP BRIDGE READY ================
Tunnel Provider : cloudflared-quick
Colab GPU MCP (Web Gemini) : https://<random>.trycloudflare.com/mcp-<32hex>/colab/mcp
Local Health : http://127.0.0.1:8765/health
==================================================4. Verify end-to-end over public HTTPS
python verify.py5. Connect in Gemini Web App
Open Gemini Web App -> Settings -> Gemini Apps Developer Mode -> Connect to an MCP server.
Paste the Colab GPU MCP
https://...URL into MCP Server URL.Leave OAuth Client ID and Client Secret empty and click Next.
Start a chat and test:
Call
@Google Colab GPU MCP Bridgecolab_usageto check my compute unit balance.
Built-in MCP Tools (15)
Every tool accepts an optional profile parameter to switch COLAB_PROFILE.
Tool | Description |
| Show compute-unit balance, hourly burn rate, and active assignments |
| Show authenticated account email, token expiry, and OAuth scopes |
| List all active backend Colab sessions |
| Show hardware type, shape, IDLE/BUSY status, and last execution |
| Provision a VM ( |
| Execute Python code on the persistent Jupyter kernel ( |
| Execute Bash commands/scripts via |
| Install Python packages on the VM via |
| List remote directory contents on the Colab VM |
| Delete a remote file on the Colab VM |
| Upload UTF-8 text (scripts, configs, JSON) directly to the Colab VM |
| Download and read UTF-8 text files/logs from the Colab VM |
| Restart the Jupyter kernel (keeps VM, clears RAM/VRAM) |
| Print the Colab browser URL attached to an active CLI session |
| Stop and release a VM session (or all sessions with |
Permanent Custom Domain (Recommended for Daily Use)
Quick tunnels rotate hostnames on restart. To keep a permanent URL in Gemini Web:
Create a Named Tunnel in Cloudflare Zero Trust pointing to
http://127.0.0.1:8765.Fill
cf_tunnel_tokenandcf_public_url(e.g."https://mcp.yourdomain.com") inconfig.json.Restart the bridge — your endpoint stays permanently at
https://mcp.yourdomain.com/<secret_path>/colab/mcp.
Security Notes
Never share your full MCP URL — the unauthenticated quick-start mode relies on the high-entropy
secret_pathto guard remote code execution on your Colab runtime.config.jsonandlogs/are gitignored by default. Keep them local.Stop idle GPUs via
colab_stopwhen finished to avoid burning compute units.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
QuLab MCP remote server (Streamable HTTP) for computational science and lab tools.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- AlicenseBqualityDmaintenanceLocal-first MCP server for controlling Google Colab as a development, shell, file, and training runtime, with tools for notebook editing, GPU acceleration, and file transfer.599Apache 2.0
- AlicenseAqualityDmaintenanceMCP server that allocates Google Colab GPU runtimes (T4/L4) and executes Python code on them. Lets any MCP-compatible AI assistant run GPU-accelerated code without local GPU hardware.39MIT
- FlicenseNot gradedqualityDmaintenanceEnables MCP clients to execute Python code on Google Colab GPU/TPU runtimes via the official Colab CLI, with session, file, and package management capabilities.-
- AlicenseBqualityDmaintenanceA Model Context Protocol server that gives Codex and other MCP clients access to Google Colab runtimes—allowing session allocation, command execution, notebook management, file operations, and data transfers.353Apache 2.0