Colab Drive MCP

io.github.YummyTastyCode由 GitHub 账号 YummyTastyCode 发布v0.1.3更新于 Oct 24, 2026

Synchronize Colab notebook files through Google Drive without executing notebook code.

已验证STDIO仅桌面效率与工作流文件与存储

概览

AI 生成的概览

将 Google Colab 兼容的 .ipynb 笔记本文件与 Google Drive 同步,让助手在不执行代码的情况下检查和编辑单元格。

可以做什么
提供本地笔记本工具,用于列出、读取、创建和编辑 .ipynb 文件及其单元格;并提供 Drive 工具,用于列出、拉取、推送、复制和比较笔记本。它通过比较本地内容与 Drive 的 MD5 校验和来报告同步状态,并可返回 Colab 链接。下载时还会规范化 Colab 特有的流输出元数据。它从不执行笔记本代码,也不连接 Colab 运行时。
适用场景
适用于助手需要在本地准备笔记本、在 Google Drive 之间移动、检查已完成的输出,或把编辑后的笔记本交还给用户的场景。它不用于运行单元格、保持 Colab 会话存活或自动化 Colab 浏览器界面;请在 Colab、Jupyter 或 VS Code 中单独运行笔记本。
运行要求
通过 uvx 从 PyPI 包 colab-drive-mcp 运行的本地 Python 进程。需要环境变量 COLAB_MCP_ROOT,即限定笔记本访问范围的本地绝对目录。Google Drive 需要启用 Drive API 的 Google Cloud 项目、OAuth 桌面客户端 JSON 和令牌;路径可用 COLAB_MCP_GOOGLE_CREDENTIALS 和 COLAB_MCP_GOOGLE_TOKEN 设置。COLAB_MCP_DRIVE_ACCESS 选择 file 或 full 模式。访问 Drive 需要网络。
安装前请注意
Google OAuth 凭据和令牌保存在本地,不得提交到仓库。full 访问模式使用更宽的 Drive 权限范围,可查找并更新已有笔记本;默认的 file 模式范围更窄。推送和复制操作会覆盖或创建 Drive 文件,覆盖前请检查操作。本地文件访问仅限于 COLAB_MCP_ROOT。授权需要显式调用 authorize_google_drive,该调用会打开浏览器。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Colab Drive MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Colab Drive MCP

[CI] [Release] [PyPI] [License: MIT]

An MCP server for safely inspecting, editing, and synchronizing Google Colab-compatible .ipynb notebooks through Google Drive.

[!IMPORTANT] This is a notebook file synchronization server, not a notebook execution service. It transfers and edits .ipynb files through Google Drive. It does not connect to Colab runtimes, execute cells, click Run all, keep sessions alive, automate the Colab browser UI, or bypass Colab limits.

Use this MCP when an AI agent needs to prepare a notebook locally, synchronize it with Drive, inspect completed outputs, or return an edited notebook to the user. Open and execute the synchronized notebook separately in Colab, Jupyter, VS Code, or another notebook runtime.

Features

  • Inspect and edit notebook cells without loading the entire notebook.
  • Create, search, copy, upload, and download notebooks.
  • Report live upload and download progress to MCP clients that request it.
  • Compare local and Drive notebook copies using Drive metadata and content MD5.
  • Keep local file access inside a configured root directory.
  • Normalize Colab-specific stream output metadata during downloads.
  • Diagnose Google Drive setup without unexpectedly opening a browser.
  • Return actionable errors for missing credentials, expired authorization, permissions, missing files, and rate limits.

Non-goals

  • Starting, controlling, or monitoring a Google Colab runtime.
  • Detecting whether a Colab runtime is connected, busy, or executing a file.
  • Executing notebook cells locally or remotely.
  • Browser automation, automatic Run all, or unattended Colab sessions.
  • Circumventing Colab quotas, idle timeouts, access controls, or usage policies.
  • Deploying or running the project contained inside a notebook.

AI Contract

The MCP initialization response includes server-wide instructions that define this project as file synchronization only. Tool descriptions repeat the same boundary where it matters.

manifest.0 provides the same purpose, capabilities, and non-goals as a typed Zero language contract for agents and repository tooling.

Tools

Setup

  • get_google_drive_status: diagnose dependencies, credentials, token, and scope.
  • authorize_google_drive: explicitly open the Google OAuth browser flow.

Local notebooks

  • list_local_notebooks, get_local_notebook, create_local_notebook
  • add_local_cell, update_local_cell, delete_local_cell
  • search_local_cells, clear_local_outputs

Google Drive

  • list_drive_notebooks, pull_drive_notebook, push_local_notebook
  • get_notebook_sync_status, copy_drive_notebook, get_colab_url

pull_drive_notebook and push_local_notebook synchronize notebook files. They send MCP progress notifications when the client supplies a progress token, but clients decide whether and how to display those notifications. They never execute notebook code. get_colab_url returns a URL but does not open a browser.

get_notebook_sync_status compares the local notebook's upload representation with Drive's MD5 checksum and returns in_sync, differs, remote_only, or unknown. It also returns Drive metadata such as modification time and version. It cannot determine whether Colab is currently executing the notebook because Google Drive does not expose Colab runtime activity.

Install

Run directly from PyPI with uvx:

bash
COLAB_MCP_ROOT="$HOME/notebooks" uvx --from 'colab-drive-mcp[drive]' colab-drive-mcp

Or install from source:

bash
git clone https://github.com/YummyTastyCode/colab-drive-mcp.gitcd colab-drive-mcppython3 -m venv .venv.venv/bin/pip install -e '.[drive]'

Run the server:

bash
COLAB_MCP_ROOT="$HOME/notebooks" .venv/bin/colab-drive-mcp

Local tools can access only .ipynb files below COLAB_MCP_ROOT.

The server is published in the official MCP Registry as:

text
io.github.YummyTastyCode/colab-drive-mcp

Google Drive Setup

First call get_google_drive_status. It does not open a browser or modify files. Its response explains the next required step.

To enable Drive:

  1. Create a Google Cloud project.
  2. Enable the Google Drive API.
  3. Configure the OAuth consent screen and add your account as a test user.
  4. Create an OAuth Client ID with application type Desktop app.
  5. Download the JSON to ~/.config/colab-mcp/credentials.json.
  6. Call authorize_google_drive and complete the Google sign-in flow.

The resulting token is stored at ~/.config/colab-mcp/token.json.

Override these locations with:

  • COLAB_MCP_GOOGLE_CREDENTIALS
  • COLAB_MCP_GOOGLE_TOKEN

Never commit OAuth credentials or tokens.

Drive Access Modes

The default mode is file, using Google's narrower drive.file scope:

bash
COLAB_MCP_DRIVE_ACCESS=file

This mode can access files created or explicitly opened by this OAuth app. It cannot reliably list all existing notebooks in a user's Drive.

To find and update existing Drive notebooks, explicitly enable full access:

bash
COLAB_MCP_DRIVE_ACCESS=full

Changing access modes may require deleting token.json and calling authorize_google_drive again.

Codex Configuration

bash
codex mcp add colab-drive \  --env COLAB_MCP_ROOT="$HOME/notebooks" \  --env COLAB_MCP_DRIVE_ACCESS=file \  -- /absolute/path/to/colab-drive-mcp/.venv/bin/colab-drive-mcp

VS Code Configuration

Add this server to the VS Code MCP configuration:

json
{  "servers": {    "colab-drive": {      "type": "stdio",      "command": "/absolute/path/to/colab-drive-mcp/.venv/bin/colab-drive-mcp",      "env": {        "COLAB_MCP_ROOT": "/absolute/path/to/notebooks",        "COLAB_MCP_DRIVE_ACCESS": "file"      }    }  }}

Colab Compatibility

Google Colab may add a metadata property to stream outputs. That property is invalid under the standard nbformat v4 schema. During Drive downloads, this server removes only that incompatible property. Stream text and all other outputs are preserved.

Security

  • OAuth tokens stay on the local machine.
  • Local tools are restricted to COLAB_MCP_ROOT.
  • Authorization requires an explicit authorize_google_drive call.
  • Use file access unless full Drive discovery is required.
  • Review actions before overwriting an existing Drive file.

This project is not affiliated with or endorsed by Google.

Development

bash
.venv/bin/pip install -e '.[drive,test]'.venv/bin/pytest

来源:README.md,提交 765e1b0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.3最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分