
There are some examples in the ADK documentation that use the StdioServerParameters
for connecting to a local MCP server — and I encourage you to try them out — but my focus will be on a remote MCP server using SseServerParams
.
(Link to my code repo can be found at the end)
FastMCP
I will be expanding on the FastMCP example and expand on its existing toolset so it can perform more than just addition:
Deploying with ngrok
While the original example deploys the FastMCP server to Cloud Run (which is great!), I chose a different approach for greater flexibility with frequent updates I was making to the FastMCP server. I have been using ngrok for a little while now and they have a decent free plan that works wonderfully for local testing with a little more “cloud-like” feel.
Once you’ve signed up for a free account and authenticated, simply run ngrok http http://localhost:8080
. This command creates a secure tunnel from a randomly generated public URL to localhost:8080, where your FastMCP server instance is running locally in a separate terminal window.
Math agent
On the agent side, I need to define tools for my agent, but instead of writing the logic for them, I can just connect to my FastMCP math server and pass the appropriate arguments.
NOTE: make sure you export the FASTMCP_SERVER_URL
environment variable before running the agent (whether it’s to the ngrok URL or the Cloud Run instance URL)
I want you to pay attention to how the tools are referred to on the agent’s side — they’re using list indices like tools[0]
, tools[1]
, tools[2]
, etc. This means you need to be careful to reference the correct tool using the right index number.
You should now be able to run your agent and ask it some math questions:
Source Credit: https://medium.com/google-cloud/developing-with-agent-development-kit-featuring-fastmcp-ngrok-807c552b90fd?source=rss—-e52cf94d98af—4