This guide explains how to connect Claude Code — Anthropic’s AI coding tool — to a live Google Colab session using Colab MCP. After completing the setup, Claude can open a Colab notebook in your browser, read and write cells, and execute Python code on your behalf — all from within a Claude Code conversation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/googlecolab/colab-mcp/llms.txt
Use this file to discover all available pages before exploring further.
Configure Claude Code
Add Colab MCP to Claude Code’s MCP configuration file. Add the following
mcpServers entry:Start Claude Code
Launch Claude Code in your terminal or IDE. Claude Code will initialize and connect to the MCP servers defined in your configuration, including Colab MCP.
Open a Colab connection
Ask Claude to open a Colab browser connection. For example:
“Open a Colab browser connection”Claude will call the
open_colab_browser_connection tool. This starts a local WebSocket server, generates a secure token, and opens a Colab scratch notebook (empty.ipynb) in your default browser. The tool then waits up to 60 seconds for the browser tab to establish the connection.Confirm in browser
Switch to your browser and wait for the Colab notebook to finish loading. Once the notebook connects to the local WebSocket server, Claude will report a successful connection at step 3/3. Notebook editing tools will then become available in the conversation.
Claude Code supports the
notifications/tools/list_changed MCP notification, which is required for Colab MCP to work correctly. This notification signals to Claude Code that new tools (the notebook editing tools) have become available after the browser connection is established. If your MCP client does not support this notification, the notebook tools will not appear. See Troubleshooting for details.Edit and run notebooks
With the connection established, Claude has access to the full set of notebook-specific tools. You can ask Claude to:
- Execute Python code in the connected Colab notebook
- Read the output of notebook cells
- Write new cells or modify existing content
“Run a cell that installs pandas and prints its version”
“Show me the output of all cells in the notebook”