Access Google Colab directly from your local VS Code or Cursor editor using remote tunnels.
Screen.Recording.2023-04-18.at.2.16.16.PM.mp4
Warning
This tool is only allowed by Google Colab's TOS if you are a paid user and have subscription to Colab Pro.
You can make a copy of this notebook to get started.
On Google Colab, run these cells:
- Install the library:
!pip install -U git+https://github.com/KiritoMiao/colab-connect.gitOptional (uv install path):
!command -v uv >/dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh
!uv pip install --system -U git+https://github.com/KiritoMiao/colab-connect.git- Import and start the connector:
from colabconnect import colabconnect
# Default: VS Code editor + VS Code mapper preset
colabconnect()
# Cursor editor + Cursor mapper preset
colabconnect(editor="cursor")
# Persist multiple preset configs
colabconnect(editor="vscode", use_mapper=["vscode", "cursor", "opencode"])
# Add custom persistent mapping: {persistent_subdir: local_path}
colabconnect(
editor="vscode",
extra_mappers={"my-tool-cache": "~/.cache/my-tool"},
)
# Override runtime directory (default: Colab Notebooks/runtime)
colabconnect(runtime_dir="/content/drive/MyDrive/Colab Notebooks/my-runtime")
# Optional: use uv and/or create runtime virtualenv explicitly
colabconnect(use_uv=True)
colabconnect(create_venv=True)
colabconnect(use_uv=True, create_venv=True)use_mappersupports"vscode","cursor", and"opencode".- If
use_mapperis not passed, it defaults to[editor]. extra_mappersaccepts a dict or(name, path)pairs.
- Default runtime directory:
/content/drive/MyDrive/Colab Notebooks/runtime. - A
/colabsymlink is created and points toruntime_dir. - By default, the connector installs Python tools with
pipin the current environment (no virtualenv). - Set
create_venv=Trueto createruntime_dir/.venv. - Set
use_uv=Trueto useuvfor Python tool installation. - Tunnel auth is checked first (
tunnel user show) and login is skipped when auth is still valid.
- After running the code, copy the given code, click the GitHub link and paste the code.
- Paste your unique code on the github link and press "Continue".
- Open your local VSCode Editor. Install the Remote Tunnels extension if you haven't already installed. Then, open the command prompt and select Remote-Tunnels: Connect to Tunnel
- You will be shown a list of tunnels. Select the first tunnel name that has online beside it.
- You will be connected to the virtual machine and can access the folders. Open
/colab(linked toruntime_dir) and store your code there for persistence on Google Drive. The workflow is similar to the Remote SSH plugin.





