Provides tools to manage Colab runtimes and execute code in them.
A Model Context Protocol (MCP) server acts as a proxy between an external service that provides context, data, or capabilities to a Large Language Model (LLM) or AI application. MCP servers connect AI applications to external systems such as databases and web services, translating their responses into a format that the AI application can understand.
Server Setup
You must enable MCP servers and set up authentication before use. For more information about using Google and Google Cloud remote MCP servers, see Google Cloud MCP servers overview.
Server Endpoints
An MCP service endpoint is the network address and communication interface (usually a URL) of the MCP server that an AI application (the Host for the MCP client) uses to establish a secure, standardized connection. It is the point of contact for the LLM to request context, call a tool, or access a resource.
The Colab API MCP server has the following global MCP endpoint:
- https://colaboratory.googleapis.com/mcp
MCP Tools
An MCP tool is a function or executable capability that an MCP server exposes to a LLM or AI application to perform an action in the real world.
Tools
The colaboratory.googleapis.com MCP server has the following tools:
| MCP Tools | |
|---|---|
create_runtime |
Creates a new Colab runtime assignment for the requesting user. Use Several requests-per-minute quotas are enforced on this tool call, so prefer to reuse an existing runtime from For state isolation, open a new Jupyter session using |
create_session |
Opens a Jupyter kernel session on a Colab runtime, identified by its resource name ( Sessions group subsequent An optional The session lives until the runtime is deleted or the session is closed via Reuse a session you opened instead of opening a new one. Rate limited. If a call fails with a rate limit error (RESOURCE_EXHAUSTED), it did not run. Retry with exponential backoff. |
delete_session |
Closes an open Jupyter kernel session on a Colab runtime, identified by its resource name ( The session's in-kernel Python state (variables, imports, etc.) is discarded. Files written by the session persist on the runtime's filesystem. The parent runtime itself is not removed. Any in-flight Rate limited. If a call fails with a rate limit error (RESOURCE_EXHAUSTED), it did not run. Retry with exponential backoff. |
execute_code |
Executes Python in a Colab runtime's Jupyter kernel and returns the captured stdout, stderr, the last expression's value, and any error. Target exactly one of stdout and stderr stream incrementally as progress notifications and are also returned aggregated in the result. To make an execution resumable, pass a stable Clients use the standard MCP Only text is returned. Rich outputs (images, plots, widgets) are not returned. Oversized output is truncated and flagged via A kernel runs one cell at a time, so parallel calls on one session queue and can time out. Each call that targets a Don't transfer files between your machine and the runtime by base64-encoding them through this tool, because the bytes fill your context. Use HTTP directly with the Rate limited. If a call fails with a rate limit error (RESOURCE_EXHAUSTED), it did not run. Retry with exponential backoff. |
get_subscription |
Gets the subscription of the requesting user. Use it when you need to know if the user subscription tier is free, pro or pro+. https://colab.research.google.com/signup shows the differences between tiers. |
list_sessions |
Lists the open Jupyter kernel sessions on a Colab runtime, identified by its resource name ( Returns every session currently open on the runtime, including sessions opened outside of MCP (for example by a browser pointing at the same runtime). The runtime is bound to the requesting user, so all returned sessions belong to the caller. Use this to find sessions you opened to reuse with Rate limited. If a call fails with a rate limit error (RESOURCE_EXHAUSTED), it did not run. Retry with exponential backoff. |
delete_runtime |
Unassigns and deletes a Colab runtime owned by the requesting user, identified by its resource name ( The runtime and its associated state are permanently removed. To preserve runtime state in an agentic session, this should only be called if a user reaches the For small, independent units of work within the same agentic session, prefer using |
get_runtime |
Retrieves a single Colab runtime assigned to the requesting user by its resource name ( To transfer files without passing their bytes through tool calls, send HTTP requests to Download: Upload: The token expires at |
list_runtimes |
Lists all Colab runtimes currently assigned to the requesting user. Each returned runtime includes its specification and the connection info needed to connect to it. |
list_runtime_specs |
Lists the Colab runtime specifications (combinations of variant, accelerator, and shape) that are available to the requesting user, along with whether the user is eligible for each. Use this to discover which machine configurations can be requested when creating a runtime. |
Get MCP tool specifications
To get the MCP tool specifications for all tools in an MCP server, use the tools/list method. The following example demonstrates how to use curl to list all tools and their specifications currently available within the MCP server.
| Curl Request |
|---|
curl --location 'https://colaboratory.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/list", "jsonrpc": "2.0", "id": 1 }' |