PluginBench
MCP Server
Maintained
MIT

io.github.pdwi2020/mcp-server-colab-exec MCP Server

io.github.pdwi2020/mcp-server-colab-exec

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

What is the io.github.pdwi2020/mcp-server-colab-exec MCP server?

The mcp-server-colab-exec MCP server allocates Google Colab GPU runtimes and executes Python code on them, enabling any MCP-compatible AI assistant to run GPU-accelerated workloads (CUDA, PyTorch, TensorFlow) without local hardware. It supports both inline code execution and file/notebook-based workflows with artifact collection.

This server bridges your AI assistant to Google Colab's free and premium GPU resources. You can execute Python code, train models, run data processing pipelines, and download generated artifacts—all without owning a GPU. Authentication uses OAuth2 with cached tokens for seamless subsequent runs.

How to install io.github.pdwi2020/mcp-server-colab-exec

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-server-colab-exec": {
      "command": "uvx",
      "args": [
        "mcp-server-colab-exec"
      ]
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • colab_execute — Execute inline Python code on a Colab GPU runtime with configurable accelerator (T4/L4) and timeout.
  • colab_execute_file — Execute a local .py file on a Colab GPU runtime with security validation to prevent path traversal.
  • colab_execute_notebook — Execute code on Colab and download all generated artifacts (images, CSVs, models) as a validated zip file.

Use cases

  • Run GPU-accelerated machine learning training and inference without local hardware
  • Execute data processing and analysis pipelines on Colab's free T4 GPUs
  • Train and export PyTorch or TensorFlow models, downloading weights and checkpoints
  • Generate visualizations, plots, and reports that are automatically collected and downloaded
  • Prototype CUDA code and GPU-intensive computations in an AI-assisted workflow

io.github.pdwi2020/mcp-server-colab-exec MCP server FAQ

What is the mcp-server-colab-exec?

It's an MCP server that lets your AI assistant (Claude, Gemini, Cline, etc.) execute Python code on Google Colab's GPU runtimes (T4 or L4), enabling GPU-accelerated computing without local hardware.

Is it free to use?

Yes, it uses Google Colab's free tier with T4 GPUs. Premium L4 GPUs require a Colab Pro subscription.

How do I install it in Claude Desktop?

Add the server to your claude_desktop_config.json with the command 'mcp-server-colab-exec', or use 'claude mcp add colab-exec mcp-server-colab-exec'.

What authentication is required?

On first run, you authenticate via Google OAuth2 in a browser window. The token is cached at ~/.config/colab-exec/token.json for subsequent runs.

Can I download files generated during execution?

Yes, use colab_execute_notebook to run code and automatically download all artifacts (images, CSVs, models, etc.) as a zip file.

What Python versions and dependencies are supported?

Python 3.10+ is required. The server supports any Python library available in Colab, including PyTorch, TensorFlow, and standard data science tools.

README (reference)

Source of truth, from the repository.

mcp-server-colab-exec

<!-- mcp-name: io.github.pdwi2020/mcp-server-colab-exec -->

MCP server that allocates Google Colab GPU runtimes (T4/L4) and executes Python code on them. Lets any MCP-compatible AI assistant — Claude Code, Claude Desktop, Gemini CLI, Cline, and others — run GPU-accelerated code (CUDA, PyTorch, TensorFlow) without local GPU hardware.

Prerequisites

  • Python 3.10+
  • A Google account with access to Google Colab
  • On first run, a browser window opens for OAuth2 consent. The token is cached at ~/.config/colab-exec/token.json for subsequent runs.

Installation

pip install mcp-server-colab-exec

Or run directly with uvx:

uvx mcp-server-colab-exec

Configuration

Claude Code

Add to your project's .mcp.json or ~/.claude/.mcp.json:

{
  "mcpServers": {
    "colab-exec": {
      "command": "mcp-server-colab-exec"
    }
  }
}

Or via the CLI:

claude mcp add colab-exec mcp-server-colab-exec

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "colab-exec": {
      "command": "mcp-server-colab-exec"
    }
  }
}

Gemini CLI

gemini mcp add colab-exec -- mcp-server-colab-exec

Tools

colab_execute

Execute inline Python code on a Colab GPU runtime.

ParameterTypeDefaultDescription
codestring—Python code to execute (required)
acceleratorstring"T4"GPU type: "T4" (free) or "L4" (premium)
timeoutint300Max execution time in seconds

Returns JSON with per-cell output, errors, and stderr.

colab_execute_file

Execute a local .py file on a Colab GPU runtime.

ParameterTypeDefaultDescription
file_pathstring—Path to a local .py file (required)
acceleratorstring"T4"GPU type: "T4" (free) or "L4" (premium)
timeoutint300Max execution time in seconds

Security policy: file_path must be a .py file inside the current workspace (cwd).

colab_execute_notebook

Execute code and collect all generated artifacts (images, CSVs, models, etc.).

ParameterTypeDefaultDescription
codestring—Python code to execute (required)
output_dirstring—Local directory for downloaded artifacts (required)
acceleratorstring"T4"GPU type: "T4" (free) or "L4" (premium)
timeoutint300Max execution time in seconds

Artifacts are downloaded as a zip and extracted into output_dir. Zip members are validated before extraction to prevent path traversal and special-file writes.

Examples

Check GPU availability:

colab_execute(code="import torch; print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0))")

Run nvidia-smi:

colab_execute(code="import subprocess; print(subprocess.run(['nvidia-smi'], capture_output=True, text=True).stdout)")

Train a model and download weights:

colab_execute_notebook(
    code="import torch; model = torch.nn.Linear(10, 1); torch.save(model.state_dict(), '/tmp/model.pt')",
    output_dir="./outputs"
)

Authentication

On first use, the server opens a browser window for Google OAuth2 consent. The access token and refresh token are cached at ~/.config/colab-exec/token.json. Subsequent runs use the cached token and refresh it automatically.

The OAuth2 client credentials are the same ones used by the official Google Colab VS Code extension (google.colab@0.3.0). They are intentionally public.

Troubleshooting

"GPU quota exceeded" — Colab has usage limits. Wait and retry, or use a different Google account.

"Timed out creating kernel session" — The runtime took too long to start. Retry — Colab sometimes has delays during peak usage.

"Authentication failed" — Delete ~/.config/colab-exec/token.json and re-authenticate.

OAuth browser window doesn't open — Ensure you're running in an environment with a browser. For headless servers, authenticate on a machine with a browser first and copy the token file.

License

MIT

Related MCP servers

Portable signed records for agent, API, MCP, and cross-runtime interactions with offline verification.

14
TypeScript
Apache-2.0
View repository →
PEPeak Answer logo

Whether AI search recommends your brand, which questions rivals win, and why engines skip your site.

0
View repository →
INInvoiceIn logo

InvoiceIn

Active

XRechnung, Factur-X, Peppol, PINT AE, FatturaPA, KSeF → JSON + fix hints. Hosted; MIT=examples only

0
Python
MIT
View repository →
PEPedra logo

Pedra

Maintained

AI real-estate photo editing via the Pedra API: virtual staging, renovation, enhancement, video.

1
TypeScript
MIT
View repository →

MCP de solo lectura del directorio, Radar y Observatorio de humanista.digital.

MCP server for Android automation with UI interaction, screenshots, and device control

5
Python
View repository →