AI Magicx
Back to Blog

Google Colab MCP Server: Running AI Agents in the Cloud for Free

Google shipped an official MCP server for Colab in April 2026. AI agents can now create notebooks, run code, manage dependencies, and return results — for free. Here is the complete setup guide.

13 min read
Share:

Google Colab MCP Server: Running AI Agents in the Cloud for Free

On April 14, 2026, Google published an open-source MCP server for Google Colab. The significance is not subtle: any MCP-compatible agent (Claude Code, Gemini CLI, Cursor, custom) can now spin up a Colab notebook, install Python packages, run cells against CPU or free T4 GPU runtime, and retrieve results — without the user writing any Python themselves.

This turns Colab's free compute tier into the most accessible agent execution sandbox in existence. This guide walks through the setup, the useful patterns, and the limits you will hit.

What the Colab MCP Server Does

The server exposes seven tools to MCP clients:

ToolWhat it does
create_notebookCreates a new notebook in the user's Drive
add_cellAdds a code or markdown cell at a specified position
execute_cellRuns a cell against the current runtime (CPU, T4, or TPU)
read_outputReturns stdout, stderr, images, and last expression value
install_packageRuns pip install for one or more packages
list_notebooksLists notebooks in Drive with modified time and sharing state
share_notebookGenerates a share link with specified permissions

The server authenticates via OAuth 2.0 with standard Colab/Drive scopes. There is no API key. The first time you connect, you approve access to Colab and Drive through a browser flow.

Setup

The server runs locally and bridges to Google's Colab API. Installation is one command.

# Install the MCP server
pip install google-colab-mcp

# Start it
google-colab-mcp serve --port 8765

First run triggers browser OAuth. Once authorized, a token is cached in ~/.config/google-colab-mcp/token.json and reused across restarts.

Wiring It to Claude Code

Add it to your Claude Code MCP config:

{
  "mcpServers": {
    "colab": {
      "type": "http",
      "url": "http://localhost:8765"
    }
  }
}

Restart Claude Code. The seven Colab tools appear in your available tool list.

Wiring It to Gemini CLI

gemini mcp add colab --type http --url http://localhost:8765

Wiring It to Cursor

Edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "colab": {
      "command": "google-colab-mcp",
      "args": ["serve", "--port", "8765"]
    }
  }
}

Five Workflows That Work Well

1. Quick data exploration without local setup

Drop a CSV into your Drive, then ask your agent: "Load the sales CSV from my Drive, show the top 10 customers by revenue, and chart monthly totals." The agent creates a notebook, installs pandas and matplotlib if needed, runs the analysis, and returns both the chart and the summary. Useful when you are on a Chromebook, a tablet, or a locked-down work laptop where you cannot install Python.

2. GPU-required work without a GPU

Colab's free T4 GPU is sufficient for Whisper transcription, Stable Diffusion previews, small model fine-tuning, and video frame processing. Your agent can now reach for GPU workflows without you thinking about whether your local machine has one.

Prompt pattern: "Use a Colab GPU runtime to transcribe this 30-minute audio file with Whisper and return the transcript plus timestamps."

3. Isolated experimentation

Testing a Python package with uncertain dependencies or side effects is safer in Colab than locally. The agent can install, test, and discard without touching your machine.

4. Shareable research notebooks

At the end of an exploration, ask the agent to share_notebook with view-only access. You get a link to send to a collaborator, with all code, markdown, and outputs preserved.

5. Long-running jobs that survive your laptop closing

Colab runtimes disconnect after 12 hours of inactivity (free tier) but run even when your laptop sleeps. Agents can kick off a job, you close your laptop, and the results are in Drive when you return.

The Limits

Pay once, own it

Skip the $19/mo subscription

One payment of $69 replaces years of monthly billing. 50+ AI models, yours forever.

Free-tier GPU availability is not guaranteed. On weekday afternoons US time, free T4 GPUs are often unavailable. Paid Colab Pro ($10/mo) gets you priority and an L4 GPU. Colab Pro+ ($50/mo) gets A100 access.

Session timeouts hit long agent runs. Free-tier sessions cap at 12 hours of runtime and ~90 minutes of idle time before disconnect. Agents running overnight data pipelines will hit these limits.

No guaranteed persistent filesystem. Anything saved to the Colab VM's /content disk is wiped on runtime restart. Save to /content/drive/MyDrive/... (which the server auto-mounts) to survive restarts.

Outbound network can be rate-limited. Colab throttles sustained high-throughput outbound requests. Scraping workloads will hit limits after a few hundred fast requests.

No private data at rest. Your notebook contents are in Google Drive. This is fine for exploration and public data, not for regulated workloads.

Security Notes

Three things to understand before you hand an agent Colab access:

  1. The OAuth scope grants full Drive access. The server needs this because Colab notebooks live in Drive. If you want to scope more tightly, use a dedicated Google account for agent work.

  2. Prompt injection from data the agent loads. If your agent reads a CSV or webpage containing adversarial instructions, those instructions could cause it to exfiltrate data via share_notebook or install_package with malicious packages. Use the --allow-packages and --deny-share flags in production.

  3. Runtime code visibility. Anything your agent runs in Colab is visible in Google's Colab logs. Do not run workflows that expose secrets (API keys, customer PII) in cells.

For higher-security agent workflows, Claude Managed Agents or self-hosted container runners are better answers.

Composing Colab with Other MCP Servers

The useful pattern we have converged on is layering Colab on top of other MCP tools:

User → Agent
  ├─ Filesystem MCP (read local project)
  ├─ GitHub MCP (read/write repo)
  ├─ Colab MCP (run heavy compute)
  └─ Slack MCP (post results)

The agent reads a notebook request from Slack, pulls relevant CSVs from GitHub, runs the analysis in Colab, and posts the chart back to Slack. You never touched Colab directly.

This is the MCP thesis in practice: small, focused servers composed into arbitrary workflows through a generalist agent runtime.

Why This Matters

Colab has been the on-ramp for Python data science since 2018. It is the single most widely used free compute resource in the world. Before April 2026, you had to drive it yourself through a browser. After April 2026, AI agents drive it for you.

This democratizes agent-based data work in a way that the enterprise-only agent platforms cannot. A small business owner can now ask a Claude Code session "chart my Shopify sales for the last 90 days and email it to my accountant," and the entire pipeline — data pull, GPU-accelerated analysis, chart generation, email — runs on free Google infrastructure.

MCP downloads hit 97 million monthly by March 2026, a 970x increase in 18 months. The Colab server will be among the most-installed by end of Q2. Our expectation: by Q4, a Google-native agent platform built on Colab plus Gemini plus Drive will ship, closing the loop.

Try It in 15 Minutes

The fastest way to understand the power of this is to install the server, connect it to Claude Code or Gemini CLI, and ask: "Create a Colab notebook, install pandas, load https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv, and show a pair plot of the four features colored by species."

You will get a shareable notebook with the correct chart in under 90 seconds. That is the new baseline.

AI Magicx orchestrates multi-model workflows across agents, MCP servers, and creative tools. Start for free to see how agent infrastructure composes with image, video, and copy generation.

Enjoyed this article? Own it for $69

Share:

Related Articles