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 Colab runtime and waits until it's ready. Creation is slow and quota-limited, so reuse a runtime from Set FAILED_PRECONDITION means the user can't get this runtime now, for example because there's no capacity for the accelerator, their usage quota is used up, or they have too many active runtimes. Try another eligible spec, reuse a runtime, or retry later. On RESOURCE_EXHAUSTED (rate limit), nothing was created; retry with exponential backoff. |
create_session |
Opens a Jupyter kernel session on a runtime (
|
delete_session |
Closes a session (runtimes/{runtime_id}/sessions/{session_id}), discarding its kernel state and aborting any execute_code call running in it. Files it wrote stay on the runtime, and the runtime keeps running.
|
execute_code |
Runs Python in a Colab runtime's Jupyter kernel. Returns stdout, stderr, the value of the last expression ( Set exactly one target:
Calls to one session run one at a time, so parallel calls to it only queue and can time out. For parallel work, use a session per task and close each when it's done. For code that may run long, pass a new UUID as Cancelling a call ( NOT_FOUND means the runtime doesn't exist, or has stopped. Find one with To move files between your machine and the runtime, use HTTP as described in |
get_subscription |
Gets the user's Colab subscription tier: free, Pro or Pro+. https://colab.research.google.com/signup compares the tiers. |
list_sessions |
Lists the open sessions on a runtime (runtimes/{runtime_id}), including ones you didn't open, such as the user's notebooks. Use it to find a session of yours to reuse or close. Close only sessions you opened. It returns names only, not what is running in them.
|
delete_runtime |
Deletes a runtime ( Delete a runtime only when the user asks, or to free up one you created when |
get_runtime |
Gets a runtime ( To transfer files without passing their bytes through tool calls, send HTTP requests to Download: Upload: The token expires at |
list_runtimes |
Lists the user's Colab runtimes, with their specs and connectionInfo. Check here for a runtime to reuse before calling create_runtime.
|
list_runtime_specs |
Lists the runtime specs (variant, accelerator and shape) and whether the user is eligible for each. Call it before create_runtime to pick a spec.
|
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 }' |