# Colab-MCP (unofficial)

Colab-MCP (unofficial) is an MCP server for Claude Code that automates Google Colab runtimes. It delegates code execution to cloud GPU or TPU hardware directly from chat prompts.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 5 repo stars
- Author: amgallego8
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/amgallego8/Colab-MCP
- Updated: 2026-10-16
- Security check: automated, 2026-11-17 (text) — warning: a command downloads a script from astral.sh and runs it right away. Do not run such commands without an explicit yes from the human.
- HTML: https://affpapa.org/en/nevibecode/mcp/colab-mcp-unofficial

## What it does

The server exposes Colab features to LLMs by wrapping Google's official `google-colab-cli` package. An agent can spin up or terminate instances, execute single commands, follow long-running background training jobs, and inspect or run `.ipynb` notebooks step by step.

Local paths stay confined to `COLAB_MCP_WORKDIR`, while environment variables pass directly to the remote kernel without showing raw values to the model. File syncing handles directory uploads and downloads while skipping `.git` folders and sensitive keys. Google Drive can be mounted inside the instance using an interactive confirmation step in the browser.

Setup requires macOS or Linux, the `uv` tool runner, and `google-colab-cli`. The user must sign in once via `colab sessions` before registering the server. All code runs under the user's personal Google credentials and consumes their Colab compute units.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `COLAB_MCP_WORKDIR`, `COLAB_MCP_DRIVE` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env COLAB_MCP_WORKDIR=<COLAB_MCP_WORKDIR> --env COLAB_MCP_DRIVE=<COLAB_MCP_DRIVE> --transport stdio colab-mcp-unofficial -- uvx colab-cli-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from colab-cli-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add colab-mcp-unofficial --env COLAB_MCP_WORKDIR=<COLAB_MCP_WORKDIR> --env COLAB_MCP_DRIVE=<COLAB_MCP_DRIVE> -- uvx colab-cli-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from colab-cli-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "colab-mcp-unofficial": {
            "command": "uvx",
            "args": [
                "colab-cli-mcp"
            ],
            "env": {
                "COLAB_MCP_WORKDIR": "<COLAB_MCP_WORKDIR>",
                "COLAB_MCP_DRIVE": "<COLAB_MCP_DRIVE>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from colab-cli-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "colab-mcp-unofficial": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "colab-cli-mcp"
            ],
            "env": {
                "COLAB_MCP_WORKDIR": "<COLAB_MCP_WORKDIR>",
                "COLAB_MCP_DRIVE": "<COLAB_MCP_DRIVE>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from colab-cli-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e COLAB_MCP_WORKDIR=<COLAB_MCP_WORKDIR> -e COLAB_MCP_DRIVE=<COLAB_MCP_DRIVE> colab-mcp-unofficial uvx colab-cli-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from colab-cli-mcp <command>

## When to use it
- allocate a remote GPU runtime and verify its readiness
- execute local Jupyter notebook cells sequentially while keeping variables
- run background training tasks and tail remote output logs
- mount Google Drive inside a Colab session for dataset access

## Example prompts
- Start a new Colab runtime with a T4 GPU and report its status
- Upload the source directory to Colab and launch `python -u train.py` as a job
- Read `train.ipynb`, add an evaluation cell, and run the whole notebook

## Similar
- [mcp-server-colab-exec](https://affpapa.org/en/nevibecode/mcp/mcp-server-colab-exec.md) — MCP server · ★ 9 repo stars
- [azure-data-science-vm](https://affpapa.org/en/nevibecode/skills/azure-data-science-vm.md) — skill · 165 installs
- [flash](https://affpapa.org/en/nevibecode/skills/flash.md) — skill · 14700 installs
- [runpod](https://affpapa.org/en/nevibecode/skills/runpod-runpod.md) — skill · 14600 installs
- [dalonso-security-repo](https://affpapa.org/en/nevibecode/skills/dalonso-security-repo.md) — skill · 251 installs
- [gke-ai-troubleshooting-handle-disruption-gpu-tpu](https://affpapa.org/en/nevibecode/skills/gke-ai-troubleshooting-handle-disruption-gpu-tpu.md) — skill · 4700 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
