Skip to main content
Google Agent Development Kit (ADK) is Google’s open-source framework for building AI agents. Unlike end-user AI tools that add the Transform MCP server through a settings screen, ADK connects to it from agent code: you declare the Transform MCP server as a toolset and hand its tools to an agent. Because Transform is a hosted remote MCP server, there is nothing to install or run locally. You point the toolset at the server URL and authenticate with your Unstructured API key. ADK ships two building blocks that make this work out of the box, so you do not need a custom transport:
  • The McpToolset class, which connects to a remote MCP server and exposes its tools to an agent.
  • The StreamableHTTPConnectionParams connection settings, which carry your Unstructured API key as an Authorization: Bearer header on every request, including the initial initialize handshake.

Requirements

Before you begin, you must have the following:
  • Python 3.10 or later on your local development machine. To check, in your terminal, run python --version or python3 --version. Install Python.
  • An Unstructured API key, which the Transform MCP server uses as a bearer token. Get an API key.
  • A Gemini API key for the agent’s underlying model. Get an API key.

Install the packages

In your terminal, install ADK with the mcp extra:
The [mcp] extra is required. A plain pip install google-adk does not install the MCP client dependency, and ADK then hides its MCP classes silently: from google.adk.tools.mcp_tool import McpToolset fails with an ImportError even though ADK itself installed correctly.
ADK is in active development and its APIs change between releases. This guide was verified against version 2.4.0. If you install a different version, check the ADK release notes for changes.

Connect to the Transform MCP server

Store your API keys in environment variables rather than hard-coding them:
In your agent code, declare the Transform MCP server as an McpToolset. The headers setting attaches the Authorization: Bearer header to every request, so the handshake and the tool calls are both authenticated:
Use the server URL exactly as shown. Do not add /mcp or /sse to the end of the URL.Also, set timeout explicitly. ADK’s default of 5 seconds is too short for a remote server handshake and causes intermittent connection failures.
The tools in the tool_filter list are the tools the transform job lifecycle uses. The filter exposes only these tools to the agent and ignores any others the server advertises.

Understand the transform job lifecycle

Transforming a document is an asynchronous, multi-step flow. Four of the steps are MCP tool calls, and two are plain HTTP transfers that are not MCP calls:
  1. request_file_upload_url: Returns a pre-signed upload_url and a file_ref for a local file.
  2. An HTTP PUT of the raw file bytes to the pre-signed upload_url. This is not an MCP call.
  3. start_transform_job: Starts a transform job for one or more file_ref values (or public HTTP(S) URLs) and returns a job_id.
  4. check_job_status: Reports whether the job is SCHEDULED, IN_PROGRESS, or COMPLETED.
  5. get_job_results: Returns a pre-signed download_url for the Markdown output of each transformed file.
  6. An HTTP GET of the Markdown from the pre-signed download_url. This is not an MCP call.
An agent cannot perform the two raw HTTP transfers through MCP tools alone, and an unpaced polling loop wastes model calls. Give the agent two small helper functions alongside the toolset: one that performs the PUT upload, and one that waits between status checks. Both helpers must be async: ADK runs tools on its event loop, so a helper that blocks (for example, with time.sleep or a synchronous HTTP call) freezes every other session the agent is serving, such as concurrent sessions under adk web.
The pre-signed upload_url and download_url carry their own credentials in the URL itself. The PUT and GET must not send the Authorization header, or the storage service rejects them.

Build the agent

Create an agent package with the standard ADK layout:
In __init__.py:
In agent.py (the httpx library it imports is installed with ADK):
The upload_local_file tool is a trust boundary: the agent chooses its arguments, so a maliciously crafted document or prompt could try to direct it at sensitive files or attacker-controlled URLs. The guards in the example restrict it to files inside the current working directory and to https:// destinations. Keep those guards, run the agent in a working directory that contains only the files you intend to upload, and treat any loosening of the checks as a deliberate security decision.
On the Gemini API free tier, some models allow as few as 5 requests per minute, and an agent spends one model request per step of the workflow. The wait_seconds(30) pacing in the instruction keeps a polling loop from hitting that limit; if you still see 429 RESOURCE_EXHAUSTED errors, increase the wait or switch to a model with a higher quota. Also, some older model IDs are not available to newly created API keys. If a model returns a 404 NOT_FOUND error, choose a current one from the Gemini model list.

Run the agent

From the directory that contains the transform_agent package, start the agent:
Then ask it to parse a file:
The agent starts the transform job, polls at a measured pace, fetches the results, and answers. The following abbreviated trace shows the tool calls and final answer from a successful run; the live adk run console prints the same activity with more verbose formatting:
If you do not use Google Cloud, ADK prints a warning at startup that it “Failed to configure mTLS” because default credentials were not found. The warning is harmless: the Transform MCP server authenticates with your Unstructured API key, not with Google Cloud credentials.

Next steps

Questions? Need help?