Add AllRatesToday to a Google ADK Agent with MCP
If you finished the Google Skills lab Add Currency Tools to an Agent using MCP, you built a Google ADK agent that calls Coinbase for crypto prices. That's a clean introduction to the Model Context Protocol — but Coinbase only covers crypto. The moment you want USD → EUR, INR → LKR, or any of the 150+ fiat pairs your users actually transact in, you need a different tool.
This guide walks through extending (not replacing) that lab agent with the @allratestoday/mcp-server. By the end, your ADK agent will answer "what is 1,250 GBP in Singapore dollars right now?" with a live mid-market rate.
What you'll build
An ADK agent (Agent Development Kit) with two MCP tool sources wired in:
- Coinbase MCP — for crypto prices (BTC, ETH, etc.), kept from the original lab.
- AllRatesToday MCP — for 150+ fiat currencies, historical rates, and multi-target lookups.
Gemini picks the right tool based on the user's question. Crypto question → Coinbase. Fiat question → AllRatesToday. No code changes required to switch between them.
Prerequisites
- Python 3.10+ with the ADK installed:
pip install google-adk - Node.js 18+ — the AllRatesToday MCP server ships as an npm package;
npxhandles install on first run. - A free AllRatesToday API key. Register here — no credit card. The key looks like
art_live_xxxxx. - A Google Cloud project with Vertex AI enabled (same setup as the original lab).
Why extend with AllRatesToday?
| Coinbase API | AllRatesToday | |
|---|---|---|
| Crypto pairs | Yes | No |
| Fiat currencies | Limited (USD-quoted) | 150+, any base, any target |
| Historical data | Spot trades | 1d / 7d / 30d / 1y series |
| Data source | Coinbase exchange | Tier-1 financial providers |
| Update frequency | Real-time | ~60 seconds |
| Auth | Public for spot | Free API key |
For agents that handle invoices, travel budgets, e-commerce conversions, or any cross-border money flow, fiat coverage is non-negotiable. The two MCP servers compose cleanly — you don't have to pick one.
Step 1: Verify the lab agent runs
Open the project from the Google Skills lab and confirm it still works:
cd ~/currency-agent
adk web The ADK web UI opens at http://localhost:8000. Ask "What's the price of Bitcoin?" — it should call the Coinbase MCP and return a number. Stop the server (Ctrl+C) before continuing.
Step 2: Add the AllRatesToday MCP server
Open agent.py (the file the lab had you edit when adding the Coinbase tool). It looks roughly like this:
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, StdioServerParameters
root_agent = LlmAgent(
model="gemini-2.0-flash",
name="currency_agent",
description="Agent that answers questions about currency prices.",
instruction="Use the tools available to look up prices and exchange rates.",
tools=[
MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@coinbase/mcp"],
),
),
],
) Add a second MCPToolset entry and tighten the instruction so Gemini knows which tool to pick:
import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, StdioServerParameters
root_agent = LlmAgent(
model="gemini-2.0-flash",
name="currency_agent",
description="Agent that answers questions about crypto and fiat currency prices.",
instruction=(
"Use the Coinbase tool for cryptocurrency prices (BTC, ETH, etc.). "
"Use the AllRatesToday tools for fiat currency conversions, "
"historical rates, and any non-crypto currency question. "
"Always cite the rate value you used."
),
tools=[
# Crypto via Coinbase (kept from the original lab)
MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@coinbase/mcp"],
),
),
# Fiat via AllRatesToday
MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@allratestoday/mcp-server"],
env={
"ALLRATES_API_KEY": os.environ["ALLRATES_API_KEY"],
},
),
),
],
) Two things worth noting:
- The updated
instructionis load-bearing. Without it, Gemini routinely calls Coinbase for euros and gets nothing useful. Telling the model which tool maps to which domain fixes most tool-routing problems. - The
envis passed explicitly to the subprocess. The ADK doesn't forward your shell environment to MCP servers by default.
Step 3: Export your API key
In the same shell where you'll run adk web:
export ALLRATES_API_KEY="art_live_your_key_here" For Cloud Shell or persistent setups, add it to ~/.bashrc or a .env file in the agent directory (the ADK auto-loads .env).
Step 4: Run the agent
adk web The first start downloads @allratestoday/mcp-server via npx. Subsequent starts are instant. In the ADK web UI, the left panel should now show two MCP tool sources, with a combined total of 5–6 tools.
Try these prompts:
- "What's the current USD to EUR exchange rate?" → calls
get_exchange_rate. - "Convert 1,250 GBP to Singapore dollars." →
get_exchange_rate+ arithmetic. - "Show me the USD/JPY trend over the last 30 days." →
get_historical_rateswithperiod=30d. - "Give me today's EUR rates against USD, GBP, and CHF." →
get_rates_authenticatedwith comma-separated targets. - "What's the price of Bitcoin right now?" → still routes to Coinbase. Both worlds work.
The four tools you just gained
| Tool | Inputs | What it returns |
|---|---|---|
get_exchange_rate | source, target | Live mid-market rate between two ISO 4217 codes. |
get_historical_rates | source, target, period | Time series: 1d (hourly), 7d, 30d (daily), 1y (weekly). |
get_rates_authenticated | source, target (csv), optional time or group | Multi-target rates in one call with optional date / aggregation. |
list_currencies | — | All 150+ supported currencies with metadata. |
Production considerations
A few things to think about before shipping the agent past the demo stage.
1. Rate limits
The free tier is enough for testing. For production agents that make several tool calls per user turn, check the pricing page and set quota alerts in your dashboard.
2. Caching
Rates update every 60 seconds upstream. Wrapping your agent in a thin cache (e.g. Redis with 30–60 second TTL keyed on the currency pair) cuts API calls by an order of magnitude without changing user experience.
3. Deploying to Vertex AI Agent Engine
Once you push your ADK agent to Vertex AI, the subprocess that runs npx @allratestoday/mcp-server still needs Node.js in the container. The base ADK image includes it. If you use a custom image, install Node 18+ in your Dockerfile.
4. Logging tool calls
Enable ADK's built-in tracing (adk web --trace) to see exactly which tool each user turn invoked, with arguments and returned values. Useful when debugging why the agent picked Coinbase instead of AllRatesToday (almost always an instruction wording issue).
What about calling the REST API directly?
You can skip MCP entirely and call our REST API from a custom function tool. The trade-off:
- Direct REST: one less subprocess, slightly faster cold start, but you write and maintain the tool schema yourself.
- MCP: drop-in, the tool definitions come from the server, and the same package works in Claude Code, Cursor, and Claude Desktop without any rewrite.
For most agents, MCP wins on reusability — the same server you wired into ADK can power your IDE assistant tomorrow.
Common errors
ALLRATES_API_KEY is required on startup
The MCP server refuses to start without a key. Check echo $ALLRATES_API_KEY in the same shell where you ran adk web. If empty, re-export it.
Gemini calls Coinbase for "EUR to USD"
Tighten the instruction field to make the routing explicit (the snippet above already does this). You can also rename the toolsets to give Gemini a clearer hint.
command not found: npx
Node.js isn't installed (or isn't on PATH). Run node --version; if missing, install Node 18+ from nodejs.org.
Next steps
- Get your free API key — takes 30 seconds.
- Drop the
MCPToolsetblock above into your lab agent. - Try the example prompts. Confirm fiat questions hit AllRatesToday and crypto questions hit Coinbase.
- Open an issue on the MCP repo if you hit anything unexpected.
Ship an ADK agent with real fiat currency data
150+ currencies, mid-market rates updated every 60 seconds. Free tier, no credit card.
Get your free API key