A Chrome extension and local Python server bridge that allows remote reading, writing, and execution of Google Colab notebook cells directly from your local machine or an AI Agent.
- Read Cells: Extract code from any cell in the Colab notebook.
- Write Cells: Inject code into specific cells.
- Run Cells: Trigger execution of specific cells remotely.
- Local Server Bridge: Uses a lightweight Python HTTP server to queue commands and receive results from the Chrome extension.
- Bypasses API Limitations: Works directly through the browser's DOM and Monaco Editor, requiring no official API access.
- Python Server (
server.py): Acts as a command queue. AI Agents or local scripts send HTTP POST requests (/command) to enqueue actions. - Chrome Extension (
main-world.js): Runs in the context of the Colab page. It polls the local server for commands, executes them using the Colab UI and Monaco Editor instances, and sends the results back via HTTP POST (/result).
- Open Google Chrome and go to
chrome://extensions/. - Enable Developer mode (toggle in the top right corner).
- Click Load unpacked and select the
colab-extensionfolder.
Run the Python bridge server locally:
python server.pyThe server will start on http://localhost:8765.
Open any Google Colab notebook in your browser. The extension will automatically connect to the local server.
Send commands to the local server using HTTP POST requests.
import requests
payload = {
"action": "run_cell", # Available actions: 'read_cell', 'write_cell', 'run_cell'
"index": 0, # Cell index (0-based)
"code": "print('Hello from Agent!')" # Required only for 'write_cell'
}
requests.post("http://localhost:8765/command", json=payload)This tool is intended for educational purposes and personal automation. It relies on the DOM structure of Google Colab, which may change over time.
MIT License