Tutorial/Gemini CLI and FX

Use live exchange rates from Gemini CLI with MCP

Connect Gemini CLI to exchangerate.dev over Streamable HTTP, discover its tools, and ask for current USD/JPY or USD/KRW rates without writing a REST client.

ERexchangerate.dev·Sep 5, 2026·6 min read

Gemini CLI can call an MCP server during a session. This guide connects it to exchangerate.dev, starts anonymously so you can verify the tool surface, and then shows the optional API-key configuration for regular use. Rates are indicative and for reference or analytics, not settlement or trading.

Key points
Install Gemini CLI using the current instructions at geminicli.com; do not paste an API key into a prompt or commit it to settings.
Gemini CLI accepts a remote MCP server with the httpUrl property in .gemini/settings.json.
The server exposes list_currencies, get_rate, convert, get_range, search_docs, and a human-confirmed start_checkout tool.
Start with no key to test anonymous access. Add EXCHANGERATE_API_KEY through environment expansion when you need a regular quota.
Keep Gemini CLI confirmation prompts enabled. Never use --yolo for an untrusted project or MCP server.

Install Gemini CLI

Follow the official Gemini CLI installation guide. The command and supported package manager can change, so use the current instructions there rather than an old global-install snippet. Start gemini in a project directory you trust and follow its sign-in prompts. Gemini CLI authentication and usage limits are separate from the exchangerate.dev API key and quota.

Add the anonymous MCP server first

Gemini CLI reads project settings from .gemini/settings.json. Create that file and add the server below. httpUrl is Gemini CLI’s remote Streamable HTTP configuration field; the MCP endpoint is not a page you open in a browser.

.gemini/settings.json · anonymous
{
  "mcpServers": {
    "exchangerate": {
      "httpUrl": "https://api.exchangerate.dev/v1/mcp/"
    }
  }
}

This uses the same live data without an API key, subject to anonymous IP limits. It lets you confirm that Gemini CLI can connect before you add credentials.

Add a key through an environment variable

For repeated work, keep the key outside the file and prompt. Gemini CLI supports environment-variable expansion in MCP settings. Export the variable in your shell or load it from your normal secret manager, then use $EXCHANGERATE_API_KEY in the header value:

.gemini/settings.json · keyed
{
  "mcpServers": {
    "exchangerate": {
      "httpUrl": "https://api.exchangerate.dev/v1/mcp/",
      "headers": {
        "Authorization": "Bearer $EXCHANGERATE_API_KEY"
      }
    }
  }
}

Set EXCHANGERATE_API_KEY in your shell before launching Gemini CLI. Do not replace the placeholder with a real key in a tutorial, chat transcript, repository, or shared settings file.

Check the connection and discover tools

Start Gemini CLI in the project where you saved the settings, then run /mcp list (or gemini mcp list from the shell) to inspect the configured server and tools. If the server shows Disabled because the folder is untrusted, review Gemini CLI’s normal workspace-trust prompt for your own project; keep the trust checks enabled. The exchangerate.dev server provides list_currencies, get_rate, convert, get_range, and search_docs; start_checkout opens a billing handoff only after explicit human confirmation.

Gemini CLI prompt · discovery
Use the exchangerate MCP server's list_currencies tool.
Tell me whether JPY and KRW are supported, then stop.
Do not call any billing or checkout tool.

Ask for USD/JPY and USD/KRW

Use prompts that name the pair, direction, and observation requirement. Ask Gemini CLI to show the returned timestamp and freshness fields so a reader can distinguish an indicative reference value from an executable quote.

Gemini CLI prompts · latest and conversion
Use get_rate with base USD and quote JPY.
Report the rate, timestamp, source, and market_session.
Call it an indicative reference rate, not a trading quote.

Use convert to calculate 2500 USD in KRW.
Show the amount, pair, returned rate, timestamp, source, and market_session.
Do not invent a rate if the tool returns an error.

Fetch history without guessing

For a chart or comparison, use get_range with an explicit base, symbol, and ISO date range. The result is a daily series and may include forward-filled non-trading days. Preserve the response metadata when you export or explain it.

Gemini CLI prompt · historical series
Use get_range for base USD and symbols JPY,KRW
from 2026-01-01 through 2026-03-31.
Summarize the first and last available observations for both pairs.
Report only metadata fields returned by the tool, and mention when a requested field is absent. Identify any is_forward_filled rows.
Do not treat indicative rates as settlement prices.

Handle errors and keep approvals on

If the server is disconnected, inspect /mcp and the CLI diagnostic output, then check the URL and JSON syntax. A 401 or 403 indicates an authentication or access configuration problem; a 429 means the anonymous or keyed limit was reached. Do not ask the model to retry indefinitely or make up a value. MCP tool calls consume the API quota; initialization and tool discovery do not.

Keep confirmation prompts enabled
Review Gemini CLI’s confirmation prompt before tool calls, especially billing actions. Keep the default approval flow enabled.

Do not confuse Gemini CLI with Gemini consumer chat

This setup is for Google’s terminal agent, Gemini CLI. It is not a configuration for the Gemini consumer web or mobile application. The CLI loads MCP servers from its settings and invokes their tools during a session.

Read the contracts

See the exchangerate.dev MCP setup hub for the API-side tool contract and quota behavior, and the official Gemini CLI MCP documentation for current settings, remote-server, environment-expansion, and confirmation behavior.

ER
exchangerate.dev
Integration guides for developers.

Keep reading

GuideGive your LLM agent live FX rates over MCPRead GuideGoogle Sheets exchange-rate tutorialRead ReferenceUSD/JPY exchange rateRead
More ComparisonsFixer vs exchangerate.devOpen Exchange Rates vs exchangerate.devCurrencylayer vs exchangerate.devCurrencylayer vs ExchangeRate-API
LearnReading source and market_session in your pipelineIndicative vs executable FX rates: what a rates API actually gives youECB reference rates, explained
Live RatesEUR/USDGBP/USDUSD/JPY