GoLab is a highly optimized, cross-platform server implementing the Model Context Protocol (MCP) for Google Colab. Written completely from scratch in Go, it serves as an independent, native alternative to the Python implementation. Wait no longer—bridge the gap between your local AI IDEs and remote Colab virtual machines instantly.
A major advantage of GoLab over the official Python implementation is its static tool architecture. GoLab does not require complex client support for notifications/tools/list_changed. This ensures guaranteed out-of-the-box compatibility with all standard MCP clients without dropping tools or enforcing strict dynamic listening requirements.
✨ Why GoLab?
- Blazing Fast: Written in compiled Go, offering near-zero overhead and immediate WebSocket communication.
- Universal Compatibility: Works fluently with Cursor, Claude Desktop, Gemini Code Assist, Windsurf, and Antigravity.
- Cross-Platform: Zero Python environment headaches. Seamless execution on Windows, macOS, and Linux.
- Persistent Stability: Employs static configurations ensuring safe browser reconnection without ephemeral token desyncs.
🚀 Quick Start
Getting started is identical whether you are running macOS, Linux, or Windows. By utilizing Go's module network, GoLab downloads and builds itself silently in the background.
Prerequisite: Ensure Go (Golang) is installed on your machine.
In your MCP client settings (e.g., Cursor, Claude Desktop, or Gemini Code Assist), you have three options to run the GoLab MCP server:
Option 1: Live Cloud Module (Recommended)
If you have Go installed on your machine, you don't even need to download anything! You can command the AI to pull and execute the server directly from Github in one step:
{
"mcpServers": {
"golab": {
"command": "go",
"args": ["run", "github.com/hoangnecon/golab/cmd/server@latest"],
"env": {
"COLAB_TOKEN": "replace-with-your-secure-token",
"COLAB_WS_PORT": "9090",
"GOPROXY": "direct"
}
}
}
}
Option 2: Pre-compiled Binary
Head over to the Releases Tab and download the binary for your system (Windows, Mac, Linux).
{
"mcpServers": {
"golab": {
"command": "/absolute/path/to/downloaded/golab.exe",
"env": {
"COLAB_TOKEN": "replace-with-your-secure-token",
"COLAB_WS_PORT": "9090"
}
}
}
}
⚙️ Configuration Parameters
📓 Notebook Preparation & Drive Mounting
GoLab drives incredible automation natively, but it must adhere to Google Colab's strict security sandbox boundaries:
- Providing Notebook URLs: When your AI Agent uses the
open_notebooktool, it needs the direct Google Drive Colab File URL (e.g.,https://colab.research.google.com/drive/1YUds...). GoLab will intercept this and automatically append the necessary MCP WebSocket mapping parameters. - Mounting Google Drive: If your workflow requires the AI agent to read/write files directly to Google Drive via the
list_driveorread_filetools, the user must manually mount Drive inside the Colab UI first. You can do this in two ways:- Method A (Native UI): Click the "Folder" icon in the left sidebar of the Colab interface, then click the "Mount Drive" icon.
- Method B (Python Cell): Execute the standard Drive mounting code:
from google.colab import drive drive.mount('/content/drive')
🧰 Available Tools Matrix
GoLab exposes 23 tools to grant your AI comprehensive control over remote execution pipelines.
Connection & Setup
Notebook Reading
Cell Management
Precision Editing
File I/O & Environment
📚 Concrete API Examples
Instead of prompting in natural language, here is exactly how your AI Agent and GoLab communicate payload schemas back-and-forth under the hood using the MCP Protocol:
1. Executing a Cell & Reading Output natively
Agent Payload (run_code_cell):
{
"cellId": "jH5vSMErxJwI"
}
GoLab Response:
{
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": ["Epoch 1/50 - loss: 0.4213\n"]
}
]
}
2. Slicing Model Architecture Parameters Directly
Agent Payload (insert_in_cell):
{
"cellId": "g24HDD5s9MNh",
"lineNumber": 4,
"content": "import torch\nimport torch.nn as nn"
}
GoLab Response:
{
"inserted": true,
"linesInserted": 2,
"totalLines": 15
}
❓ Troubleshooting
Not getting the latest version?
Go aggressively caches modules. If you're stuck on an old version:
# Option A: Add GOPROXY=direct to your MCP config env (recommended — see config above)
# Option B: Clear Go's module cache manually
go clean -modcache
Windows: Browser opens but WebSocket never connects?
Older versions of GoLab had a bug where Windows' cmd /c start treated the & character in the URL as a command separator, silently dropping the mcpProxyPort parameter. Upgrade to v1.2.0+ to fix this. If you're already on latest and it still fails, ensure GOPROXY=direct is set in your config.
🤝 Contributing & Issues
We welcome community contributions to make GoLab even better!
- Check the Issues tab for existing reports or feature requests.
- Fork the repository and create your feature branch.
- Ensure your Go code is formatted (
go fmt) and passes standard checks (go vet). - Submit a Pull Request with a clear description of your architectural changes.
📜 License
This project is an independent native Golang implementation. It is open-sourced under the Apache License 2.0.