# mcp-server-colab-exec [Health: Active]

**Category:** 👨‍💻 Code Execution  
**Repository:** https://github.com/pdwi2020/mcp-server-colab-exec  
**GitHub Stars:** 9  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-server-colab-exec

## Description
Execute Python code on Google Colab GPU runtimes (T4/L4) from any MCP client

## Tools
Capabilities this server exposes over MCP:

- **colab_execute** — Execute inline Python code on a Colab GPU runtime.
- **colab_execute_file** — Execute a local `.py` file on a Colab GPU runtime.
- **colab_execute_notebook** — Execute code and collect all generated artifacts (images, CSVs, models, etc.).

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "mcp-server-colab-exec": {
    "command": "uvx",
    "args": ["mcp-server-colab-exec"]
  }
}
```

## Documentation

## What mcp-server-colab-exec MCP server does

The mcp-server-colab-exec MCP server gives MCP-compatible assistants access to Google Colab GPU runtimes. It can execute inline Python, run a local Python file, or execute code while collecting files produced during the run. Supported accelerator choices are T4, which is the default, and L4, which is described as premium.

This is useful for GPU-dependent work such as checking CUDA availability, running `nvidia-smi`, executing PyTorch or TensorFlow code, and training a model whose output needs to be downloaded. The server does not require the machine running the MCP client to have its own GPU.

## How it works

When a tool is called, the server provisions a Google Colab GPU runtime and sends the requested Python workload to it. Each execution accepts a timeout, with 300 seconds as the default. Inline execution returns JSON containing cell output, errors, and standard error.

`colab_execute_file` sends a local `.py` file to Colab. For safety, the file must use the `.py` extension and be located inside the current workspace, identified by the server process's working directory.

`colab_execute_notebook` is intended for runs that create files. It downloads generated artifacts as a ZIP archive and extracts them into the required local output directory. ZIP members are checked before extraction to block path traversal and writes involving special files.

## Setup and configuration

Install the package with `pip install mcp-server-colab-exec`, or launch it directly with `uvx mcp-server-colab-exec`. The server requires Python 3.10 or newer and a Google account with Google Colab access.

On first use, a browser-based Google OAuth consent flow is required. Credentials are cached at `~/.config/colab-exec/token.json`; later executions reuse and refresh the cached token. Headless environments need an alternate authentication workflow: authenticate on a machine with a browser, then copy the token file to the target environment.

The server uses a stdio command configuration. Claude Code, Claude Desktop, and Gemini CLI can register `mcp-server-colab-exec` as the command for an MCP server named `colab-exec`.

## Tools and capabilities

- `colab_execute` runs required inline Python with a selected accelerator and timeout.
- `colab_execute_file` runs a workspace-local `.py` file with the same accelerator and timeout controls.
- `colab_execute_notebook` runs code and places downloaded images, CSV files, models, and other generated artifacts in a specified directory.
- T4 and L4 runtimes are available as accelerator options.
- Execution responses can include output, errors, and standard error.

## Limitations and notes

Google Colab usage limits can prevent a runtime from starting when GPU quota is exhausted. Runtime creation can also take longer during busy periods, causing a timeout; retrying is the documented response. If authentication fails, removing the cached token and completing OAuth again may resolve the issue.

A browser is needed for the initial OAuth consent step unless authentication is completed elsewhere and the token is copied over.

_Full upstream README: https://allmcps.com/mcp/mcp-server-colab-exec/readme_

