Skip to main content
Glama

Colab-MCP

An MCP server that lets an AI agent (Claude, or any MCP client) use Google Colab end to end: create and stop GPU/TPU runtimes, run code, work in notebooks cell by cell, launch long background jobs, and move files and folders in and out of the VM.

It is a thin, safe layer over Google's official Colab CLI (google-colab-cli). It does not reimplement Colab and does not depend on a browser tab.

PyPI License

🇪🇸 Resumen en español al final de este archivo.

Quick start

You need uv and the official Colab CLI, signed in once (macOS or Linux):

uv tool install google-colab-cli
colab sessions        # sign in ONCE (open the link, paste the code)
claude mcp add colab-cli -e COLAB_MCP_WORKDIR="$HOME/colab-work" -- uvx colab-cli-mcp

That registers the server in Claude Code, and uvx downloads it from PyPI the first time. For Claude Desktop, other clients, secrets and the optional Drive tools, see Install.

Related MCP server: colab-cli-mcp

Status

  • Tested against a simulated CLI (118 checks, plus 129 for Drive against a simulated Drive API, 28 for the Drive mount and 17 for local cleanup; tests/): a real MCP client talks to the server over stdio and the code that normally runs on the VM is executed for real in a sandbox folder.

  • Validated live once. On a real Colab session (macOS, Claude as the client): creating a runtime, running code, a long background job with log polling, mounting Drive from the chat (below) and stopping the session, with one real batch workload (10 items, 0 errors). That is a single run, not a benchmark.

  • Published on PyPI as colab-cli-mcp 0.1.0. The published package was installed in a clean environment (pip, and uvx) and listed its 42 tools over stdio. That check ran on Linux; use of the uvx route with Claude on macOS has not been checked yet.

  • Not yet validated live: the Google Drive API tools (drive_*), notebook execution cell by cell, folder uploads and downloads, and the behaviours listed under Known unknowns. Other MCP clients (Cursor, Codex, Windsurf) and Linux are untested.

  • Linux and macOS only (the Colab CLI does not support Windows).

Tools (42 + 8 optional Drive tools)

Area

Tools

Runtimes

colab_new, colab_ensure_session, colab_sessions, colab_status, colab_runtime_info, colab_restart_kernel, colab_url, colab_usage, colab_stop, colab_install

Run code

colab_exec (code or file; kernel state persists between calls), colab_run (one-shot: fresh VM → script → release)

Notebooks (local .ipynb)

colab_notebook_create, _list, _read, _add_cell, _edit_cell, _delete_cell, _move_cell, _clear_outputs, _run_cell, _run_all, _to_script, _delete

Long jobs

colab_job_start, _status, _logs, _cancel, _list

Files

colab_upload, colab_download, colab_upload_dir, colab_download_dir, colab_ls, colab_rm, colab_log

Drive on the VM

colab_drive_status, colab_drive_mount_start, colab_drive_mount_finish, colab_drive_project_dir (see Big projects and Drive)

Local footprint

colab_local_footprint, colab_local_cleanup (see Where things live)

Typical flows:

  • Interactive: colab_ensure_session(gpu="T4") → colab_notebook_create → add cells → colab_notebook_run_cell one by one (variables persist) → read outputs → colab_stop.

  • Batch: colab_upload_dir → colab_job_start("python -u train.py") → poll colab_job_logs → colab_download_dir → colab_stop.

Google Drive projects and notebooks are a separate, opt-in feature (below). Deliberately not included anywhere: sign-in through a tool, colab auth, repl, console, ssh, edit. They are interactive and cannot work through a tool call.

Security model

  • Local paths are confined to COLAB_MCP_WORKDIR. ../, absolute paths and symlinks that escape are rejected before anything runs.

  • Secrets never reach the model. COLAB_MCP_ENV_FILE points to a local NAME=value file. The model only passes names (secrets=["OPENROUTER_API_KEY"]); values go to the kernel with --env and are scrubbed from every result. Known limit: while the command runs, the value is visible to other local users in the process list, because the CLI takes it as an argument.

  • No shell. The CLI is run with an argument list. Session names, GPU types, package specifiers and job ids are validated. Everything user-controlled that is embedded in code for the VM goes through repr().

  • Folder transfers are guarded. Uploads skip .git, caches, symlinks and likely secrets (.env, *.pem, *.key…); downloads reject archives with paths that escape the target (zip-slip) or exceed a size limit.

  • No hard deletes on your computer. colab_notebook_delete moves the file to .colab-mcp-trash/. colab_rm only touches the VM and refuses root-like paths.

  • Output is clipped to COLAB_MCP_MAX_OUTPUT characters, and terminal colour codes (tracebacks) are stripped.

  • Code you run executes on Google's machines under your account and spends your compute units. Stop sessions you no longer need.

Big projects and Drive on the VM

For big datasets, checkpoints or results that must survive the session, mount Google Drive on the VM. This is separate from the optional "Drive notebooks" feature below and uses the Colab CLI's own sign-in.

  1. Mount it from the chat, no terminal. colab_drive_mount_start runs the official colab drivemount in a pseudo-terminal (the CLI itself never opens a browser; it only prints a link and waits for Enter), opens Google's approval page in your browser. The link is not repeated in the chat (it contains your account e-mail); it is only returned if the browser could not be opened or with show_link=true. You click Allow (the agent never sees credentials or codes) and tell the agent; colab_drive_mount_finish then sends the Enter the CLI was waiting for and colab_drive_status confirms. Only https://*.google.com links are ever opened, a pending mount is killed after 15 minutes, and there is at most one per session. If you prefer, colab drivemount -s SESSION in a terminal still works. Mounting gives code running on that VM access to your whole Drive (Colab cannot scope it); only mount when you need it and stop the session afterwards.

  2. The agent calls colab_drive_project_dir("my-project"), which creates /content/drive/MyDrive/Colab-MCP/my-project and returns the path. Datasets, checkpoints and outputs go there.

  3. Stop the session when done. Files in that Drive folder remain; everything else on the VM is lost.

Guardrail: the file tools (colab_upload*, colab_download*, colab_ls, colab_rm) refuse any Drive path outside /content/drive/MyDrive/Colab-MCP/ (folder name configurable with COLAB_MCP_DRIVE_PROJECTS), including .., relative and case tricks. colab_drive_status never lists your files.

Residual risk, stated plainly: once Drive is mounted, any code that runs on the VM (colab_exec, colab_run, jobs, notebook cells) can read and change all of your Drive; the path guard only covers this server's file tools, and it cannot see symlinks created on the VM. Mount only when you need it, review the code you run, and stop the session afterwards.

Where things live (and how little stays on your computer)

Where

What

Why

The Colab VM disk (about 200 GB free observed on a T4 ⚠️ not guaranteed)

Datasets, training, anything heavy

Fast, free, gone when the session stops

Drive, folder Colab-MCP/<project>/

Notebooks and results that must persist

Survives sessions; the only part of Drive this tool can see

Your computer

Almost nothing: a temporary working copy while you edit a notebook

Auto-cleaned (below)

Local footprint rules (footprint.py):

  • Transfer zips are removed right after use and swept after 1 hour; saved plots after 2 days (COLAB_MCP_IMAGE_DAYS); locally "deleted" notebooks after 7 days (COLAB_MCP_TRASH_DAYS, 0 = keep); working copies of Drive notebooks after 24 h (COLAB_MCP_DRIVE_COPY_HOURS, 0 = keep) and immediately when you save. The sweep runs when the server starts and on colab_local_cleanup.

  • Only files inside .colab-mcp/ and .colab-mcp-trash/ are ever removed. Symlinks are not followed. Your own notebooks and data are never touched.

  • Guards before downloads: at least COLAB_MCP_MIN_FREE_GB (default 5) must stay free on the disk and the working folder may not exceed COLAB_MCP_WORKDIR_MAX_GB (default 20, 0 = no cap). colab_local_footprint shows the numbers. Keep big data on the VM or in Drive and download only results.

Google Drive: projects and notebooks (opt-in)

Off by default. With COLAB_MCP_DRIVE=1 (the installer sets it when you set Drive up) these tools appear, and only these:

Tool

What it does

drive_sign_in

Opens a browser window on your computer where you click Allow. No code or token ever passes through the chat

drive_project_create / drive_project_list

One folder per Colab project inside Colab-MCP. Folders can be created, never deleted or renamed

drive_notebook_create

Creates a notebook (empty starter, or a local .ipynb with outputs stripped), optionally inside a project

drive_notebook_list

Lists the notebooks this server created

drive_notebook_open / drive_notebook_save

Download a notebook to a temporary local copy, edit it with the colab_notebook_* tools, write the content back to the same file. Saving removes the local copy

drive_notebook_delete

Moves one of them to the Drive trash (never permanent)

Layout in your Drive: Colab-MCP/<project>/<notebook>.ipynb. The Google permission (drive.file) only reaches files and folders this app created, so your existing "Colab Notebooks" folder and everything else stay invisible to it.

A skill that keeps the agent to exactly this lives in skills/colab-drive-notebooks/SKILL.md: copy that folder to ~/.claude/skills/ (Claude Code) or add it as a skill in your client.

Who is responsible for what

Nobody shares credentials. Each user signs in themselves, and the token lives only on their own disk. You choose once between two OAuth clients (below); this project never sees your token. The model never sees a sign-in link, code or token.

Quick start (every user)

From PyPI:

uvx --from colab-cli-mcp colab-cli-mcp-drive login     # asks once how you want to sign in, remembers it, signs you in
claude mcp add colab-cli -e COLAB_MCP_WORKDIR="$HOME/colab-work" -e COLAB_MCP_DRIVE=1 -- uvx colab-cli-mcp

From a clone of this repository, bash install.sh asks "Set up Drive now?", runs the one-time choice below, and registers the server with the Drive tools enabled. Manually:

git clone https://github.com/amgallego8/Colab-MCP ~/Colab-MCP && cd ~/Colab-MCP
uv sync
uv run colab-cli-mcp-drive login     # same login, run from the clone

login walks you through creating your own Google Cloud "Desktop app" client (about 10 minutes, once, free; steps below). When you give it the path of the JSON you downloaded it stores it for you (0600). You answer to Google for your project. After that, signing in is just: a link opens in your browser, you click Allow, done. There is no code to paste.

No shared one-click client is shipped yet. If this repository reaches 1,000 stars, the maintainer intends to publish one (a ready-made client so that signing in needs no Google Cloud setup at all). That is a plan, not a promise. The code for it already exists: if a build ships colab_cli_mcp/shared_client.json, login offers a menu with shared and own.

The shared client is never used without an explicit choice (a terminal answer or --shared). Your choice is remembered in ~/.config/colab-mcp/drive/preference.json. From then on, when a Drive tool needs access and there is no valid token (first use, or after the 7-day expiry of apps in Testing mode), the server itself opens the browser consent page and waits for your click; you then repeat the request. Sign-in, the drive.file scope, the token file and every guardrail are identical in both cases.

Then leave per-call approval on for drive_notebook_delete in your MCP client — that prompt is the real human confirmation; the server cannot force it. uvx --from colab-cli-mcp colab-cli-mcp-drive status (or uv run colab-cli-mcp-drive status from a clone) shows what is configured.

To leave: colab-cli-mcp-drive logout (deletes the token and revokes it at Google), and remove the app at https://myaccount.google.com/permissions if revocation could not be confirmed.

Creating your own client (what login asks you to do)

  1. In the Google Cloud console create a project and enable the Google Drive API (guide).

  2. Configure the consent screen / Google Auth Platform (guide): under Audience pick External and add yourself under Test users; under Data Access → Add or Remove Scopes add only .../auth/drive.file.

  3. Google Auth platform → Clients → Create Client → Desktop app (Google's steps). Download the JSON and give its path to login.

For the maintainer: publishing a shared client

Create the client as above (ideally in a dedicated Google account and project), then place the JSON at colab_cli_mcp/shared_client.json and commit it on purpose (git add -f; the file is git-ignored by default). Desktop-app client secrets are not confidential by design, but the project, its consent screen (support email, privacy policy link) and any Google verification requirements become yours. See TERMS.md.

Threat model (what this does and does not protect)

Layer

What it gives you

Scope drive.file only

The token can only reach files this OAuth client created. It cannot read or delete the rest of your Drive, even if everything below failed. Google classifies this scope as non-sensitive.

Your own OAuth client

Another user's or a vendor's client cannot touch your files, and you can revoke the whole client from your own project.

Token handling

0600 file, refused if group/world-readable, refused if it has any scope other than drive.file. Never returned by any tool. Separate from the Colab CLI's token (which has broader scopes).

Tool surface

Create folders; create / list / open / save / trash notebooks this server created. No permanent delete, no folder delete, no sharing, no permissions, no reading of other files, no free-form queries or ids. A test asserts that no DELETE request and no permissions/export/copy endpoint is ever used.

File guards (open, save, delete)

The file must carry this server's marker, be a Colab notebook, be owned by you, sit directly in the app folder or one of its project folders, and not be trashed. Delete also needs its exact name retyped. Save changes content only: never name, place or sharing.

Limits and trace

Per hour: 20 notebook creations, 10 project folders, 60 saves, 5 deletions, 6 sign-in attempts (COLAB_MCP_DRIVE_MAX_CREATES_PER_HOUR, _MAX_PROJECTS_PER_HOUR, _MAX_SAVES_PER_HOUR, _MAX_DELETES_PER_HOUR, _MAX_LOGINS_PER_HOUR); append-only audit log (audit.log, 0600) that never stores content.

Content hygiene

Notebooks uploaded from a file lose their outputs; saves keep outputs (turn off with keep_outputs=False). Any upload or save is refused if it contains a value from your secrets file. Names read back from Drive have control and bidi characters stripped and are labelled as data.

Residual risks, stated plainly. "Completely secure" is not a claim anyone can make; this is what remains:

  • A prompt-injected or mistaken agent can still create junk notebooks (rate-limited) or trash a notebook this server created if you approve the call. They stay recoverable in the Drive trash.

  • The confirmation-by-name check stops accidents, not a model that is determined to repeat the name; the human approval prompt in your client is the real control.

  • Anyone who can read your user account's files can use your token until you log out. Disk encryption and a locked account are on you.

  • Notebooks you create can contain code that will run later in Colab with your account; review what you open.

  • In Testing mode Google expires refresh tokens after 7 days for external apps, so you may need to log in again weekly.

  • If a Drive folder named Colab-MCP is also created by code running on a Drive-mounted VM, Drive can end up with two folders of that name that this tool treats separately (⚠️ not verified). Prefer one route per project.

  • Not yet run against live Google Drive (see Known unknowns).

Env: COLAB_MCP_DRIVE (enable), COLAB_MCP_DRIVE_COPY_HOURS, COLAB_MCP_DRIVE_DIR (default ~/.config/colab-mcp/drive), COLAB_MCP_DRIVE_CLIENT, COLAB_MCP_DRIVE_TOKEN, COLAB_MCP_DRIVE_AUDIT, COLAB_MCP_DRIVE_FOLDER (default Colab-MCP).

Install

Needs uv (curl -LsSf https://astral.sh/uv/install.sh | sh). The official Colab CLI must be installed and signed in first:

uv tool install google-colab-cli
colab sessions        # sign in ONCE (open the link, paste the code)

Claude Code:

claude mcp add colab-cli -e COLAB_MCP_WORKDIR="$HOME/colab-work" -- uvx colab-cli-mcp

Claude Desktop (claude_desktop_config.json; use the full path to uvx if the app cannot find it, see which uvx):

{
  "mcpServers": {
    "colab-cli": {
      "command": "uvx",
      "args": ["colab-cli-mcp"],
      "env": { "COLAB_MCP_WORKDIR": "/Users/YOU/colab-work" }
    }
  }
}

Other MCP clients: any client that can start a stdio server can run uvx colab-cli-mcp (untested, see Status).

Optional secrets file (outside any repository, readable only by you) and the Drive tools:

mkdir -p ~/.config/colab-mcp
printf 'OPENROUTER_API_KEY=your-key-here\n' > ~/.config/colab-mcp/secrets.env
chmod 600 ~/.config/colab-mcp/secrets.env

Add -e COLAB_MCP_ENV_FILE="$HOME/.config/colab-mcp/secrets.env" to the command above (or the same key under env in the JSON). For the optional Drive tools add -e COLAB_MCP_DRIVE=1 and sign in once as described in Google Drive.

Every person who uses it repeats these steps with their own Google account: the sign-in token is personal and must not be shared.

From source (to modify the code)

bash install.sh (macOS/Linux) from a clone asks before installing anything, signs you in to Colab, and registers the server with Claude Code (or prints the Claude Desktop config). The manual steps are below.

# 1. uv and the official CLI
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install google-colab-cli

# 2. Sign in ONCE (open the link, paste the code)
colab sessions

# 3. This server
git clone https://github.com/amgallego8/Colab-MCP ~/Colab-MCP

Optional secrets file (outside any repository, readable only by you):

mkdir -p ~/.config/colab-mcp
printf 'OPENROUTER_API_KEY=your-key-here\n' > ~/.config/colab-mcp/secrets.env
chmod 600 ~/.config/colab-mcp/secrets.env

Register in Claude Code:

claude mcp add colab-cli \
  -e COLAB_MCP_WORKDIR="$HOME/colab-work" \
  -e COLAB_MCP_ENV_FILE="$HOME/.config/colab-mcp/secrets.env" \
  -- uv run --directory ~/Colab-MCP colab-cli-mcp

Register in Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "colab-cli": {
      "command": "uv",
      "args": ["run", "--directory", "/Users/YOU/Colab-MCP", "colab-cli-mcp"],
      "env": {
        "COLAB_MCP_WORKDIR": "/Users/YOU/colab-work",
        "COLAB_MCP_ENV_FILE": "/Users/YOU/.config/colab-mcp/secrets.env"
      }
    }
  }
}

Every person who uses it repeats these steps with their own Google account: the sign-in token is personal and must not be shared.

Environment variables

Variable

Default

Purpose

COLAB_MCP_WORKDIR

current directory

The only local folder the server touches

COLAB_MCP_ENV_FILE

—

NAME=value file with secrets

COLAB_MCP_AUTH

CLI default

oauth2 or adc (the CLI's --auth)

COLAB_MCP_MAX_OUTPUT

20000

Max characters returned per call

COLAB_MCP_MAX_UPLOAD_MB

100

Per-file/zip upload cap (the CLI sends a file in one request)

COLAB_MCP_MAX_DOWNLOAD_MB

1024

Cap for unpacked directory downloads

COLAB_BIN

colab

Path to the CLI executable

COLAB_MCP_MIN_FREE_GB

5

Free disk that must remain after a download

COLAB_MCP_WORKDIR_MAX_GB

20

Budget for the working folder (0 = no cap)

COLAB_MCP_IMAGE_DAYS / COLAB_MCP_TRASH_DAYS / COLAB_MCP_DRIVE_COPY_HOURS

2 / 7 / 24

Age after which saved plots, locally trashed notebooks and Drive working copies are swept (0 = keep trash/copies)

COLAB_MCP_DRIVE_PROJECTS

Colab-MCP

The only Drive folder (under MyDrive) the file tools may use when Drive is mounted on the VM

How notebooks work

Notebooks are ordinary .ipynb files inside the working directory, edited locally with nbformat, so editing needs no runtime. colab_notebook_run_cell sends one cell to the runtime through colab exec; the kernel keeps its variables between calls, and the cell's output (text, errors, a displayed plot) is written back into the notebook. Cells are addressed by id (stable) or index. Plots are saved under .colab-mcp/images/.

colab_exec with a .ipynb file runs the whole notebook and the CLI saves <name>_output.ipynb beside it.

Known unknowns (to confirm against live Colab)

These come from reading the CLI's source and docs. The live run described under Status did not cover them:

  • Kernel variables persisting across exec calls (the source reuses the same kernel id, so it should).

  • Cell success/failure detection relies on get_ipython().run_cell being available in the Colab kernel.

  • Whether --output-image saves every image form (it handles PNG/JPEG display data).

  • The real upload size limit (the CLI sends a file in a single request; the 100 MB cap is a conservative guess).

  • Whether Colab Secrets (userdata) are readable in the kernel when running through the CLI — undocumented. Use secrets=[...] instead.

  • Google Drive (opt-in, see below): the Colab MIME type application/vnd.google.colaboratory was not found in Google's Drive documentation. The server checks what Drive stored after each creation and undoes it if it differs, but this has not been run against real Drive yet.

  • Whether a Google Cloud app that stays unverified can be used by its owner without the 7-day refresh-token expiry of "Testing" mode (Google's docs say refresh tokens of external apps in Testing expire after 7 days; the rules for unverified apps "In production" were not confirmed).

Develop

pip install "mcp<2" nbformat google-auth google-auth-oauthlib requests
python tests/test_server.py   # the Colab tools, with a simulated CLI
python tests/test_drive.py    # the Drive tools, with a simulated Drive API
python tests/test_footprint.py # local cleanup and disk guards
python tests/test_mount.py     # Drive mount from the chat, with a simulated CLI

The SDK pin mcp<2 is intentional: 2.x renamed FastMCP to MCPServer.

Terms of use and privacy

See TERMS.md: no server and no data collection by the maintainer, what is stored locally, user responsibilities, who answers to Google under each sign-in option, and the no-warranty clause.

License

Apache License 2.0 — see LICENSE. Copyright 2026 the Colab-MCP contributors (amgallego8). The official Colab CLI this project wraps is a separate work, also Apache-2.0, and is not included here.


Resumen en español

Servidor MCP para que un agente use Google Colab de punta a punta: crear y detener runtimes con GPU/TPU, ejecutar código, trabajar en cuadernos celda por celda, lanzar trabajos largos en segundo plano y mover archivos y carpetas hacia y desde la VM. Envuelve el Colab CLI oficial de Google.

  • Estado: probado con un CLI simulado (292 comprobaciones: 118 + 129 + 28 + 17). Validado una vez en vivo en una sesión real de Colab (macOS y Claude): crear runtime, ejecutar código, un trabajo largo con logs y montar Drive desde el chat. Sin validar en vivo: las herramientas drive_*, cuadernos celda por celda, carpetas, otros clientes (ver «Known unknowns»).

  • Seguridad: las rutas locales quedan confinadas a COLAB_MCP_WORKDIR; las claves viven en un archivo local y nunca se devuelven al modelo; no hay shell; los borrados de cuadernos van a una papelera recuperable.

  • Instalación: desde PyPI con uvx colab-cli-mcp (o desde el código con install.sh); cada persona repite los pasos de «Install» con su propia cuenta de Google. El token de sesión es personal.

  • Google Drive (opcional): carpetas de proyecto y cuadernos de Colab en Colab-MCP/<proyecto>/ de tu Drive (crear, abrir, guardar, borrar a la papelera), nada más. Creas una sola vez tu propio cliente de Google (todavía no se publica un cliente compartido); después el propio servidor abre el navegador cuando haga falta y tú solo pulsas «Permitir» (el código y el token nunca pasan por el chat). El permiso es drive.file: solo ve lo que esta herramienta crea. Tu computador queda casi vacío: los temporales se limpian solos y lo pesado va al disco de la VM o a Drive. Hay una skill (skills/colab-drive-notebooks) que limita al agente a eso. Ver «Google Drive» y el modelo de amenazas, con sus riesgos residuales. Aún sin probar contra la API de Drive real.

  • Costo: lo que ejecutes consume tus unidades de cómputo de Colab. Detén las sesiones que no uses.

Available Tools

42 tools
colab_downloadC

Download one file from the VM into the working directory.

Inputs: local_path (required), remote_path (required), session. Returns: result

colab_download_dirA

Download a whole VM folder into local_dir (inside the working directory) via one zip. Refuses archives whose paths escape the target or exceed COLAB_MCP_MAX_DOWNLOAD_MB (default 1024).

Inputs: local_dir (required), remote_dir (required), session. Returns: result

colab_drive_mount_finishA

Step 2 of mounting Google Drive: call it AFTER the user says they clicked Allow. Completes the mount; then verify with colab_drive_status. cancel=true abandons a pending mount.

Inputs: session (required), cancel. Returns: result

colab_drive_mount_startA

Step 1 of mounting Google Drive on a session: opens Google's approval page in the user's browser. The link itself is NOT returned (it contains the account e-mail) unless the browser could not be opened or show_link=true. The USER must click Allow; never ask for or handle passwords or codes. WARNING: once mounted, code running on the VM can reach the user's WHOLE Drive; mount only when asked, and stop the session afterwards. Then call colab_drive_mount_finish.

Inputs: session (required), show_link. Returns: result

colab_drive_project_dirA

Create (if missing) and return a project folder on the mounted Drive: /content/drive/MyDrive//. Use it for big datasets, checkpoints and results that must survive the session. Requires Drive to be mounted (see colab_drive_status).

Inputs: name (required), session. Returns: result

colab_drive_statusA

Is Google Drive mounted on this session? Reports yes/no and free space only (never lists your files). If it is not mounted, use colab_drive_mount_start (the user approves in the browser).

Inputs: session. Returns: result

colab_ensure_sessionB

Make sure a named session exists: reuse it if colab status finds it, otherwise create it. Safe to call repeatedly.

Inputs: session (required), gpu, tpu, high_mem. Returns: result

colab_execA

Run Python on the runtime; variables persist between calls (same kernel). Give code (text) or file (local .py/.ipynb inside the working directory), not both.

A .ipynb file runs the whole notebook and the CLI writes 'output.ipynb' beside it; for cell-by-cell work use the colab_notebook* tools. secrets: NAMES of variables from the user's secrets file (e.g. ["OPENROUTER_API_KEY"]); they become environment variables in the kernel and their values are never returned. plot_path: local path (inside the working directory) where a displayed image is saved. timeout: seconds (the CLI default is 30).

Inputs: code, file, secrets, session, +2 more. Returns: result

colab_installB

Install Python packages on the runtime (uses uv, falls back to pip). Names/specifiers only, e.g. 'qiskit', 'pandas>=2.0'.

Inputs: packages (required), session. Returns: result

colab_job_cancelB

Terminate a running background job (SIGTERM to its process group).

Inputs: job_id (required), session. Returns: result

colab_job_listC

List all background jobs started on this VM.

Inputs: session. Returns: result

colab_job_logsC

Last tail lines of a background job's combined stdout/stderr, plus its state.

Inputs: job_id (required), tail, session. Returns: result

colab_job_startA

Start a shell command in the background on the VM (e.g. 'python -u train.py --epochs 50') and return a job id. Use for anything longer than a few minutes; poll with colab_job_status / colab_job_logs. Jobs die if the VM is stopped.

Inputs: command (required), name, session. Returns: result

colab_job_statusB

State of a background job: running, finished (with exit code), cancelled, or lost.

Inputs: job_id (required), session. Returns: result

colab_local_cleanupA

Delete everything this tool keeps only temporarily on your computer: transfer zips, saved plots and old local trash. Never touches your notebooks, data or anything outside those folders.

Inputs: no named parameters. Returns: result

colab_local_footprintA

Show how much this tool keeps on your computer (temp files, plots, local trash), free disk and the working-directory budget. Read-only.

Inputs: no named parameters. Returns: result

colab_logA

Last lines entries of a session's history (event_type e.g. execution, file_operation). Without a session, lists sessions that have logs.

Inputs: lines, session, event_type. Returns: result

colab_lsC

List files in a VM directory (default /content).

Inputs: path, session. Returns: result

colab_newB

Create a runtime. CPU by default; gpu: T4, L4, G4, H100 or A100; tpu: v5e1 or v6e1; high_mem needs Colab Pro. Consumes compute units until stopped.

Inputs: gpu, tpu, session, high_mem. Returns: result

colab_notebook_add_cellB

Insert a cell. Default is at the end; or give position (index) or after (cell id/index). cell_type: code or markdown.

Inputs: path (required), source (required), after, position, +1 more. Returns: result

colab_notebook_clear_outputsC

Clear saved outputs of one cell, or of all cells.

Inputs: path (required), cell. Returns: result

colab_notebook_createB

Create a local .ipynb inside the working directory. cells: list of {"type": "code"|"markdown", "source": "..."}.

Inputs: path (required), cells, overwrite. Returns: result

colab_notebook_deleteB

Delete a local notebook by moving it to .colab-mcp-trash/ inside the working directory (recoverable, never a hard delete).

Inputs: path (required). Returns: result

colab_notebook_delete_cellC

Delete one cell by id or index.

Inputs: cell (required), path (required). Returns: result

colab_notebook_edit_cellB

Replace a cell's source (and optionally its type). cell is an id or an index. Clears that cell's stale outputs.

Inputs: cell (required), path (required), source (required), cell_type. Returns: result

colab_notebook_listC

List .ipynb files under a directory of the working directory.

Inputs: directory. Returns: result

colab_notebook_move_cellC

Move a cell to a new index.

Inputs: cell (required), path (required), to_index (required). Returns: result

colab_notebook_readA

Show a notebook's cells (index, id, type, source) and, optionally, their saved outputs. Use start/end to page through big notebooks.

Inputs: path (required), end, start, include_outputs. Returns: result

colab_notebook_run_allA

Run every code cell in order (from index start), storing outputs in the notebook. Stops at the first failing cell unless stop_on_error=false.

Inputs: path (required), start, session, stop_on_error, +1 more. Returns: result

colab_notebook_run_cellA

Run ONE code cell on the runtime (state persists between cells) and store its output in the notebook. Reports ok/ERROR status. A displayed plot is saved under .colab-mcp/images/.

Inputs: cell (required), path (required), session, timeout. Returns: result

colab_notebook_to_scriptA

Convert a notebook to a .py script (markdown becomes comments; lines starting with ! or % are commented out). With out_path, writes the file; otherwise returns the text. Handy before colab_run.

Inputs: path (required), out_path. Returns: result

colab_restart_kernelA

Restart the Jupyter kernel of a session: clears all Python variables but keeps the VM and its files.

Inputs: session. Returns: result

colab_rmB

Delete ONE file on the VM (not on the user's computer). Refuses root-like paths.

Inputs: path (required), session. Returns: result

colab_runA

One-shot job: allocate a fresh VM, run a local script (inside the working directory) with args, then release the VM (or keep it with keep=true).

Inputs: script (required), gpu, args, keep, +2 more. Returns: result

colab_runtime_infoB

Report the VM's Python version, CPUs, RAM, free disk and GPU (if any).

Inputs: session. Returns: result

colab_sessionsA

List active Colab runtimes (sessions). Also a quick check that Google sign-in works.

Inputs: no named parameters. Returns: result

colab_statusB

Show hardware, machine shape and state of a session (or the only active one).

Inputs: session. Returns: result

colab_stopB

Stop a session and release the VM (stops consuming compute units). Files not downloaded are lost.

Inputs: session. Returns: result

colab_uploadA

Upload one local file (inside the working directory) to the VM, e.g. remote_path '/content/data.csv'. Limited by COLAB_MCP_MAX_UPLOAD_MB (default 100): for big data, download it on the VM instead (colab_exec / colab_job_start).

Inputs: local_path (required), remote_path (required), session. Returns: result

colab_upload_dirA

Upload a whole local folder (inside the working directory) to the VM as one zip, extracted at remote_dir. Skips .git, caches, symlinks and likely secret files (.env, *.key, *.pem...).

Inputs: local_dir (required), remote_dir (required), session. Returns: result

colab_urlB

Print the browser URL that attaches the Colab UI to this session (does not open a browser).

Inputs: session. Returns: result

colab_usageA

Show the account's compute-unit balance and current burn rate.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 42 tools

    Disambiguation4/5

    Most tools target a distinct resource+action, and descriptions carefully distinguish near-pairs (colab_exec vs colab_run vs colab_job_start; colab_upload vs colab_upload_dir). Some boundary blur remains between session-inspection tools (colab_sessions, colab_status, colab_runtime_info) and between colab_new and colab_ensure_session, but guidance is generally clear.

    Naming Consistency4/5

    All tools share the colab_ prefix and snake_case, with clear resource-grouping (colab_notebook_*, colab_job_*, colab_drive_*). Minor deviation: a mix of noun-style (colab_sessions, colab_status) and verb-style (colab_new, colab_stop) names, and colab_new is less descriptive than its siblings.

    Tool Count2/5

    42 tools is well above the comfortable range for a single server. Although the domain is broad (sessions, exec, jobs, notebooks, files, Drive), the granular cell-level notebook surface (create, add/edit/delete/move/clear/run_cell/run_all/read/list/to_script) plus parallel file vs directory transfer tools inflate the count considerably.

    Completeness4/5

    Coverage is broad and lifecycle-complete: session create/ensure/status/stop, exec and one-shot runs, background jobs with status/logs/cancel/list, full notebook and cell CRUD, upload/download for files and directories, and Drive mount/status/project-dir. Minor gaps like no kernel interrupt (only restart) and no directory-delete operation are easy to work around.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Local-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.
      59
      9
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to execute Python code on Google Colab GPU/TPU runtimes via the official Colab CLI, with session, file, and package management capabilities.
      -
    • A
      license
      B
      quality
      C
      maintenance
      Lets any MCP-compatible agent use Google Colab or Jupyter runtimes as an execution backend, enabling code execution, notebook management, package installation, hardware introspection, training jobs, and file handling.
      40
      1
      MIT