GnistAI GnistAI
Log in

Getting Started with ECB FX Rates

Simple currency conversion — quick FX lookups with auto-detected latest ECB reference rates.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Finance

Data source: European Central Bank

Overview

ECB FX Rates wraps European Central Bank, handling authentication, pagination, and rate limits for you. This tutorial covers all 4 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-ecb-fx": {
      "url": "https://context.gnist.ai/mcp/ecb-fx/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (4)

get_rate

Get the current exchange rate between two currencies. Uses ECB daily reference rates (updated ~16:00 CET). EUR is used as pivot for cross-currency conversions. Args: base: ISO 4217 currency code for the base currency (e.g. "USD", "EUR", "NOK"). target: ISO 4217 currency code for the target currency (e.g. "GBP", "JPY"). Returns: Exchange rate: 1 unit of base = rate units of target, plus the ECB publication date.

ParameterTypeRequiredDescription
basestringrequiredISO 4217 currency code for the base currency (e.g. "USD", "EUR", "NOK").
targetstringrequiredISO 4217 currency code for the target currency (e.g. "GBP", "JPY").
curl -X POST "https://context.gnist.ai/mcp/ecb-fx/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_rate", "arguments": {"base": "USD", "target": "GBP"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ecb-fx/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'base': 'USD', 'target': 'GBP'}, 'name': 'get_rate'}},
)
print(resp.json())

get_rates

Get current exchange rates for all ECB-covered currencies against a base currency. Uses ECB daily reference rates (updated ~16:00 CET). Covers ~30 major currencies. Args: base: ISO 4217 currency code (e.g. "USD", "EUR", "NOK"). Returns: Dictionary of all available currencies and their rates against the base, plus the ECB publication date.

ParameterTypeRequiredDescription
basestringrequiredISO 4217 currency code (e.g. "USD", "EUR", "NOK").
curl -X POST "https://context.gnist.ai/mcp/ecb-fx/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_rates", "arguments": {"base": "USD"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ecb-fx/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'base': 'USD'}, 'name': 'get_rates'}},
)
print(resp.json())

get_history

Get daily exchange rates for a currency pair over the past N days (up to 90). Uses ECB 90-day historical reference rates. Args: base: ISO 4217 currency code for the base currency (e.g. "USD", "EUR"). target: ISO 4217 currency code for the target currency (e.g. "NOK", "GBP"). days: Number of days of history to return (1–90, default 30). Returns: Time series of daily exchange rates, newest first.

ParameterTypeRequiredDescription
basestringrequiredISO 4217 currency code for the base currency (e.g. "USD", "EUR").
targetstringrequiredISO 4217 currency code for the target currency (e.g. "NOK", "GBP").
daysintegeroptionalNumber of days of history to return (1–90, default 30). (default: 30)
curl -X POST "https://context.gnist.ai/mcp/ecb-fx/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_history", "arguments": {"base": "USD", "target": "NOK"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ecb-fx/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'base': 'USD', 'target': 'NOK'},
            'name': 'get_history'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/ecb-fx/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ecb-fx/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

FAQ

What data does ECB FX Rates provide?

Simple currency conversion — quick FX lookups with auto-detected latest ECB reference rates. It exposes 4 tools: get_rate, get_rates, get_history, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the ECB FX Rates API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials