Leveraging the Gemini CLI with ADK deployment on Cloud Run using MCP Operations
What is the Point of All this?
This lab takes an existing Google Codelab and extends it to use the Gemini CLI for code explanation and generation- even with the specific Python code format for AI Agents that use the ADK and MCP.
Google Agents in Action: ADK MCP on Google Cloud
Google Cloud provides a sample Codelab that showcases various approaches for implementing a MCP Server and implementing Agents using the ADK. The full Codelab is available here:
Initial Environment Setup
The environment is meant to be run from a Bash like shell. You can run this from a Linux VM, ChromeOS Linux VM, Firebase Studio environment, or any environment that provides a basic shell.
Gemini CLI
If not pre-installed you can install the Gemini CLI to interact with the source files and provide real-time assistance:
sudo npm install -g @google/gemini-cli
Note- if you are an a non standard environment — you will need to make sure to have at least Node version 20 available in order to run Gemini CLI.
Testing the CLI Environment from the VM
Once you have all the tools and the correct Node.js version in place- you can test the startup of Gemini CLI. You will need to authenticate with a Key or your Google Account:
gemini
Pulling it All Together — Gemini CLI with MCP, ADK, and Cloud Run in the Chrome VM
Now that the Gemini CLI has been validated from the base shell – you can clone the GitHub Repo:
git clone https://github.com/xbill9/adk-on-cloudrun
Then run init.sh from the cloned directory. The script will attempt to determine your shell environment and set the correct variables:
cd adk-on-cloudrun
source init.sh
Build and Deploy to Cloud Run
A sample script is provided to run a basic deployment to Cloud Run:
xbill@penguin:~/adk-on-cloudrun$ source cloudrun.sh
Deploying ADK code to Cloud Run
Check The Connection to the Cloud Run Endpoint
Check the messages in the console for the direct URL to the ADK agent hosted on a cloud run endpoint:
Service [zoo-tour-guide] revision [zoo-tour-guide-00010-hlm] has been deployed and is serving 100 percent of traffic.
Service URL: https://zoo-tour-guide-1056842563084.europe-west1.run.app
Select Token Streaming in the upper right top bar and send Hello to the agent to make sure it is responding:
Validate the Agent is Making MCP Calls
At this point — ask the agent about an animal that is available on the Zoo MCP server-
Next Steps
At this point the agent is validated and making ADK and MCP calls. Because the source files are local — Gemini CLI has access to the Agent source code and you can use this to analyze and explain the agent code and summarize the project.
Project Summary
You can use the Gemini CLI to summarize the entire project. A Readme.md has been included in the GitHub source repo as a starting point. Gemini CLI also has access direct to all the source files from the cloned GitHub repo:
Agent Analysis
Start the Gemini CLI and ask it to break down the agent code:
gemini
with @zoo_guide_agent/agent.py explain how it works
Extending the Agent
This is where the true power of the Gemini CLI and the agent approach becomes apparent. If you want to extend the existing agent with new functionality — just use Gemini CLI to analyze and generate the code for you:
MCP Server Analysis From Code
What does the MCP Server provide for the this agent? Just ask Gemini CLI:
Summary
The Google provided Codelab sample code provides a working example where you can use the Agent ADK, and MCP to deploy AI agent technology to Cloud Run. The true possibilities open up when you allow Gemini CLI access to the project code and use it to analyze, explain, extend, and improve your agent project.
Source Credit: https://medium.com/google-cloud/agent-development-with-gemini-cli-800d2c6f18ed?source=rss—-e52cf94d98af—4
