Skip to main content
Glama
Colab MCP
by ALiwoto

Colab MCP

A local stdio MCP server that connects an agent to a Colab browser tab. Python 3.13+; the only runtime dependency is websockets==17.4.

Run from the checkout without installing the project or creating a virtual environment:

# Skip this if websockets is already installed.
python -m pip install --only-binary=:all: websockets==17.4
cd src
python -m colab_mcp

The server waits for MCP messages on stdin. Normally your MCP client launches it. For Codex, use this configuration with your actual checkout path and Python executable:

[mcp_servers.colab]
command = "python"
args = ["-m", "colab_mcp"]
cwd = 'D:\path\to\colab-mcp\src'
tool_timeout_sec = 120

Call open_colab_browser_connection to open a scratch notebook. Its optional notebook_url argument opens an existing HTTPS Colab notebook. Sign in and accept Colab's connection prompt in the browser. Notebook tools appear after connection; the MCP client must handle notifications/tools/list_changed. Keep the tab open. If the browser cannot open or connection times out, the tool returns a manual URL.

src/minimcp contains the independent, standard-library-only protocol code: JSON-RPC, initialization, notifications, cancellation, and stdio. It supports MCP 2025-11-25, 2025-06-18, and 2024-11-05; it does not implement HTTP/OAuth or task extensions. src/colab_mcp handles browser authentication and forwards tools, resources, prompts, progress, and supported client callbacks.

Logs go to stderr, or to a directory supplied with --log. The WebSocket listener binds to 127.0.0.1, accepts one tab, and checks its token and Colab origin.

Run checks from the repository root with python -m pytest. Tests need only pytest and websockets; they do not open a real browser or contact Google.

Building an installable wheel uses Hatchling, declared in pyproject.toml. Running from src does not load or require that build backend.

Available Tools

11 tools
call_notebook_toolA

Call a tool provided by the connected Colab browser. First use list_notebook_tools to get its exact name and argument schema.

Inputs: name (required), arguments (required).

cancel_transferB

Cancel a file transfer and remove its incomplete temporary files where the connection is still available.

Inputs: transfer_id (required).

connect_colab_tabA

Move this MCP connection to an existing Colab tab from list_colab_tabs. The Chrome companion transfers the token automatically without reloading the target notebook. Does not change its runtime or execute cells. Finish or cancel file transfers first.

Inputs: tab_id (required).

download_fileA
Destructive

Download a Colab file to the local machine, creating parent directories as needed. Supports arbitrary file types. Requires the Chrome companion and a connected runtime. Returns a transfer_id immediately; use transfer_status to check progress. File bytes do not enter the conversation. Only one transfer runs at a time. Existing files require overwrite=true.

Inputs: colab_path (required), local_path (required), overwrite.

list_colab_tabsA
Read-only

List open Colab tabs using the optional Chrome companion. Returns tab IDs, titles, URLs, and which tab is connected. Open a Colab connection first.

Inputs: no named parameters.

list_notebook_toolsA
Read-only

List the connected Colab browser's tools and their input schemas. Call after open_colab_browser_connection, then use call_notebook_tool. If nextCursor is returned, pass it as cursor to read the next page.

Inputs: cursor.

open_colab_browser_connectionA

Connect to a Colab notebook in the browser and unlock its notebook tools. When disconnected, opens a scratch notebook or the supplied notebook_url. Waits up to 60 seconds for a connection. The optional Chrome companion accepts the matching MCP connection prompt automatically.

Inputs: notebook_url. Returns: result

runtime_actionA
Destructive

Manage this notebook's runtime using the optional Chrome companion. Returns immediately; check runtime_status for completion or errors. Connect uses the notebook's selected runtime. Disconnect detaches the tab; delete releases its runtime and loses its files and memory. Restart clears kernel memory. Configure changes runtime settings and may replace a running runtime. GPU/TPU and high-memory availability depend on the user's account. The user handles any Colab permission or confirmation dialogs.

Inputs: action (required), accelerator, high_memory, accelerator_model.

runtime_statusA
Read-only

Report whether the optional Chrome companion is connected, the current Colab runtime state and settings, and the last runtime operation. Use this to check completion after runtime_action.

Inputs: no named parameters.

transfer_statusA
Read-only

Get progress, completion, or error details for a file transfer. The last 20 transfers are retained.

Inputs: transfer_id (required).

upload_fileA
Destructive

Upload a local file to Colab, creating parent directories as needed. Supports arbitrary file types. Requires the Chrome companion and a connected runtime. Returns a transfer_id immediately; use transfer_status to check progress. File bytes do not enter the conversation. Only one transfer runs at a time. Existing files require overwrite=true.

Inputs: colab_path (required), local_path (required), overwrite.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 11 tools

    Disambiguation4/5

    Most tools have clearly distinct roles, and the async status/cancel companions make transfer and runtime workflows easy to separate. The main overlap is around connection setup: open_colab_browser_connection, connect_colab_tab, and runtime_action's connect option all use similar 'connect' language, so an agent may need to read descriptions carefully.

    Naming Consistency4/5

    All tool names use snake_case and are mostly verb_noun patterns such as upload_file, list_colab_tabs, and call_notebook_tool. runtime_status, runtime_action, and transfer_status use noun+status/action instead, but this is a minor and readable deviation.

    Tool Count5/5

    Eleven tools is well-scoped for a Colab bridge: runtime control, file transfer, tab connection, and notebook-tool proxying each get a small, purposeful set. No tool appears redundant or included merely to pad the count.

    Completeness4/5

    The surface covers connection setup, runtime control, bidirectional file transfer with progress/cancel, and dynamic notebook tool discovery/invocation. Minor gaps remain, such as no explicit remote file listing/deletion or browser-connection close tool, though these may be handled through notebook tools or runtime disconnect.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers