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 great introduction to the Model Context Protocol — but Coinbase only covers crypto. The moment you want USD → EUR, INR → LKR, or any of the 160+ fiat pairs your users actually transact in, you need a different tool.
This guide walks through replacing (or extending) the lab's Coinbase MCP tool with the @exchangerateapi/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, sourced from Reuters/Refinitiv interbank feeds.
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.
- Exchange Rate API MCP — for 160+ fiat currencies, historical rates, and multi-target lookups.
The agent picks the right tool based on the user's question. Ask about Bitcoin → Coinbase. Ask about euros → Exchange Rate API. No code changes required to switch.
Prerequisites
- Python 3.10+ with the ADK installed:
pip install google-adk - Node.js 18+ — the Exchange Rate API MCP server ships as an npm package;
npxdownloads and runs it. - A free Exchange Rate API key. Register here — no credit card. The key looks like
era_live_xxxxx. - A Google Cloud project with Vertex AI enabled (same setup as the original lab).
Why swap Coinbase for Exchange Rate API?
| Coinbase API | Exchange Rate API | |
|---|---|---|
| Crypto pairs | Yes | No |
| Fiat currencies | Limited (USD-quoted only) | 160+ pairs, any base |
| Historical data | Spot trades | 1d / 7d / 30d / 1y series |
| Data source | Coinbase exchange | Reuters / Refinitiv mid-market |
| Update frequency | Real-time | ~60 seconds |
| Auth | Public for spot | Free API key (higher limits) |
For agents that handle invoices, travel budgets, e-commerce conversions, or any cross-border money flow, fiat coverage is non-negotiable. Coinbase can stay for the crypto use case — the two MCP servers compose cleanly.
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 Exchange Rate API MCP server
Open agent.py (the file the lab had you edit when adding the Coinbase tool). It will look 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 for Exchange Rate API. The full file becomes:
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 Exchange Rate API tools for fiat currency conversions, "
"historical rates, and any non-crypto currency question. "
"Always cite the rate value you used."
),
tools=[
# Crypto via Coinbase (from the original lab)
MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@coinbase/mcp"],
),
),
# Fiat via Exchange Rate API
MCPToolset(
connection_params=StdioServerParameters(
command="npx",
args=["-y", "@exchangerateapi/mcp-server"],
env={
"EXCHANGE_RATE_API_KEY": os.environ["EXCHANGE_RATE_API_KEY"],
},
),
),
],
)
Two things to note:
- The
instructionnow tells Gemini when to pick each tool. Without this, the model might call Coinbase for euros and fail. - The MCP server reads
EXCHANGE_RATE_API_KEYfrom its environment. We pass it through explicitly so the subprocess inherits it.
Step 3: Export your API key
In the same shell where you'll run adk web:
export EXCHANGE_RATE_API_KEY="era_live_your_key_here"
For Cloud Shell or persistent setups, add it to ~/.bashrc or your project's .env file (the ADK auto-loads .env from the agent directory).
Step 4: Run the agent
adk web
The first time the agent starts, npx downloads @exchangerateapi/mcp-server. 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_rateswith 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 | source, target (csv), time, from, to, group | Multi-target rates with date ranges and aggregation. |
list_currencies | — | All 160+ 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 gives you 300 requests/month, which is enough for testing. For production agents that make several tool calls per user turn, the paid plans start at €4.99/month for 5,000 requests. 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 the user experience.
3. Deploying to Vertex AI Agent Engine
Once you push your ADK agent to Vertex AI, the subprocess that runs npx @exchangerateapi/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 Exchange Rate API (almost always an instruction wording issue).
What about deploying without MCP?
You can skip MCP entirely and call our REST API directly 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 are already published by 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
EXCHANGE_RATE_API_KEY is required on startup
The MCP server refuses to start without a key. Check echo $EXCHANGE_RATE_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 Exchange Rate API and crypto questions hit Coinbase.
- Open an issue on the MCP repo if you hit anything unexpected.
Add to your ADK agent in one line
npx -y @exchangerateapi/mcp-server
Ship an ADK agent with real fiat currency data
160+ currencies, mid-market rates from Reuters, free tier with no credit card.
Get Your Free API Key →