
exchange-rates-mcp-server
io.github.cyanheads/exchange-rates-mcp-server
Query daily Frankfurter rates and convert currencies using fixed euro adoption rates.
Documentation
@cyanheads/exchange-rates-mcp-server
Query daily Frankfurter rates and convert currencies using fixed euro adoption rates. STDIO or Streamable HTTP.
Public Hosted Server: https://exchange-rates.caseyjhand.com/mcp
Overview
Market rates come from Frankfurter v1, with observations from 1999-01-04. On its official configuration the server also converts 21 former euro-area currencies at irrevocable rates from each adoption date. For example, a BGN/USD conversion on 2026-03-02 uses 1.95583 BGN per EUR and that day’s USD observation. No API key is required.
Tools
| Tool | Description |
|---|---|
fx_list_currencies | Current currency discovery with full names and the latest served rate date |
fx_get_rates | Snapshot of all rates for a base currency at latest or a historical date |
fx_get_rate | Exchange rate for a single currency pair at latest or a historical date |
fx_convert_currency | Convert an amount between two currencies at latest or a historical rate |
fx_get_timeseries | Historical daily rates for a currency pair over a date range |
fx_dataframe_describe | List DataCanvas tables and columns staged by a prior fx_get_timeseries call |
fx_dataframe_query | Run a read-only SQL SELECT against a staged DataCanvas table |
fx_dataframe_drop | Remove one staged DataCanvas table or view (opt-in, destructive) |
DataCanvas (DuckDB) is on by default. Set CANVAS_PROVIDER_TYPE=none to turn it off: the three fx_dataframe_* tools then drop out of tools/list, and fx_get_timeseries returns ranges inline when canvas_id and stage are omitted; explicit staging (canvas_id or stage: true) fails canvas_unavailable. The Claude Desktop bundle (.mcpb) ships without DuckDB's native binding, so it runs with DataCanvas off. fx_dataframe_drop additionally needs FX_ENABLE_CANVAS_DROP=true.
The four rate tools accept base. Pair tools also accept quote, from_currency and to_currency. For fx_get_rate and fx_convert_currency, from and to identify the currencies. symbol is a quote alias on fx_get_rate and fx_get_timeseries. Supply one spelling per field. The advertised schemas use canonical names.
Currency values, including symbols, are trimmed and uppercased. Point dates accept YYYY-MM-DD or latest. Ranges require both ISO dates. Malformed calendar dates return invalid_date_format. Historical official rates in RON before 2005-07-01 and TRY before 2005-01-01 use restated units. Convert old amounts first. 10,000 ROL equals 1 RON and 1,000,000 TRL equals 1 TRY.
Resources
| Resource | Description |
|---|---|
fx://currencies | Current Frankfurter currencies as a stable reference document |
fx://rates/latest/{base} | Latest rates snapshot for a base currency as a stable URI |
All resource data is also reachable via tools — use fx_list_currencies or fx_get_rates for programmatic access.
Skill
exchange-rates-guide covers historical currency coverage, observed-day summaries, paging and SQL comparisons. It ships with npm, Docker and MCPB installs and is available over MCP at skill://exchange-rates-guide/SKILL.md.
Cancelling a tool call or resource read stops its upstream fetch, response-body read, and retry backoff. V1 requests retain two retries and a 10-second timeout per attempt within a 12-second total budget per read. Optional coverage metadata gets one 1-second request without retries.
Capability reference
fx_list_currencies tool
- Optional
include_retired(defaultfalse) adds historical codes absent from current v1 discovery; the rows it appends carryretired: true - Each currency has a code, name and
retiredflag. Optional ECB start and end dates describe outer bounds that can contain gaps. Discovery also returnscount,sourceandas_of, the latest served market date. - Metadata is cached for a day (a failed read is retried after five minutes) and queried only for the default official v1 base. Unavailable metadata leaves current discovery intact with a notice; valid v1 rate requests never depend on metadata.
- With
include_retired: true, each statutory currency hasadoption_dateandunits_per_eur. The response names their legal source infixed_rate_source. These factors are available even when optional ECB market coverage metadata is unavailable.
fx_get_rates tool
base_currencyrequired;dateoptional (default latest, market history from 1999-01-04, no future dates); optionalsymbolsarray narrows the response and must name at least one code- Returns a
ratesmap (quote code → rate), the actualrate_date, anddate_snapped: truewhen a weekend, a holiday, or a day whose fix is not yet published snapped to the prior published date - Naming the base currency in
symbolsis valid — answered locally with a rate of 1 rather than sent upstream - Missing observations from a served snapshot identify the offending
fieldand sorted, deduplicatedmissing_codes, pluscurrency_windowsand a sentence naming the bound (coverage begins or ends, or a date or range inside the bounds that can contain gaps) when ECB coverage metadata is available; unknown currencies retainunsupported_currencyprecedence. A response without any snapshot remains an unattributedupstream_no_datafailure. - Typed failures:
invalid_date_format,unsupported_currency,date_out_of_range,upstream_no_data
fx_get_rate tool
base_currency,quote_currencyrequired;dateoptional (default latest, market history from 1999-01-04, no future dates)- Returns
rate,rate_date, anddate_snapped: truewhen a weekend, a holiday, or a day whose fix is not yet published snapped to the prior published date - Rates divide the quote EUR leg by the base EUR leg without intermediate rounding. A statutory-only pair resolves locally, including an identity pair. A market leg requires a published observation.
- Typed failures:
invalid_date_format,unsupported_currency,date_out_of_range,upstream_no_data
fx_convert_currency tool
base_currency,quote_currency,amount(must be > 0) required;dateoptional (default latest, market history from 1999-01-04, no future dates)- A mixed conversion combines the market publication with the statutory factor effective on the requested date.
fixed_ratesidentifies each affected leg. When the two dates differ,fixed_rate_datedistinguishes the statutory date fromrate_date. A fully fixed conversion uses the requested date (today in UTC forlatest) and needs no upstream call. - Returns
quote_amount,rate,rate_date,date_snapped,rate_typeandsource. Market conversions useamount * rate. Statutory cross-conversions divide by the base units per EUR and multiply by the quote units per EUR. They useamount * ratewhen the EUR intermediate overflows, rounds to zero, or is subnormal. Payment rounding is left to the caller. - Typed failures include
invalid_date_format,unsupported_currency,date_out_of_range,upstream_no_dataandamount_out_of_range. The last indicates the converted amount exceeds the numeric range.
fx_get_timeseries tool
base_currency,quote_currency,start_date,end_daterequired (market history from 1999-01-04, no future dates, start ≤ end); optionalcanvas_idappends to an existing canvas- Optional
stage(defaultfalse):truestages the complete series on a new canvas whosecanvas_idis returned, even for short or empty ranges. To stage another series beside it, pass thatcanvas_idrather thanstage: trueagain, sincefx_dataframe_queryreads one canvas at a time.canvas_idalways stages, whateverstagesays. - Optional integer
limit(default 500, minimum 0) bounds returned observations, clamping values above 500 with a notice.limit: 0returns summary and metadata with emptyrates; a nonempty inline result then pointsnext_start_dateat the first observation. Repeat with a positive limit to advance. Counts, summary, bounds, staging eligibility and complete staged tables are independent of the limit. - Inline results page at up to 500 observations —
rate_countis always the range total;truncated: trueplusnext_start_datecontinue the page - Ranges over
FX_TIMESERIES_CANVAS_THRESHOLD_DAYS(default 90 days) are considered for DataCanvas staging. Series over the 40,000-character preview budget returnspilled: true,canvas_id, andtable_name; smaller series and deployments withCANVAS_PROVIDER_TYPE=nonepage inline - Market series follow served publication dates. A pair of wholly fixed legs has one rate per calendar day from adoption. Series that cross an adoption date can contain both kinds of observation. For affected staged tables, the
sourcecolumn identifies the provenance of each row. - A coverage notice names the missing currencies, counts each affected publication day once, and gives first/last affected dates. Where available it adds each currency’s ECB coverage bounds. Paging and staging preserve that notice.
- An empty range (weekends, holidays, a fix not yet published, or currency gaps) returns
rate_count: 0with an explanatorynotice, distinguishable from an error - Whether a long range overflows the preview is measured before any canvas is acquired, so a series that fits inline never acquires one (pending cyanheads/mcp-ts-core#501); a failed or cancelled staging call releases the canvas it acquired. A supplied canvas remains available.
- An explicit
canvas_idorstage: truealways stages the complete result, including short and empty ranges, usingrate DOUBLE. Each table name has a fresh identifier suffix; repeated and concurrent calls preserve all earlier tables. Unknown IDs failcanvas_not_found, whose recovery namesstage: true; disabled DataCanvas failscanvas_unavailable.truncatedis false when the preview includes every observation. - Nonempty results include
summary: { mean, min: { rate, date }, max: { rate, date }, first: { rate, date }, last: { rate, date }, change_pct }. It covers all observations in the requested interval before paging or staging; a continuation summarizes its shorter requested interval. Tied extrema select the earliest date; singleton and identity movement is 0. Empty series omit summary. Mean is the unweighted arithmetic average of daily observations, not a tax-authority or accounting-policy prescription.
fx_dataframe_describe tool
canvas_idrequired (from a priorfx_get_timeseriescall)- Returns each staged table's
kind,row_count, and column schema (name,type,nullable), plusexpires_at - Required first step before
fx_dataframe_query; unregistered whenCANVAS_PROVIDER_TYPE=none canvas_not_foundwhen the ID doesn't exist or has expired
fx_dataframe_query tool
canvas_idand a read-only SQLqueryrequired;row_limitis a positive integer (default 150). Values above the canvas row cap (CANVAS_DEFAULT_ROW_LIMIT, 10,000 by default) clamp to it, the default 150 included, with requested/effective values in a notice; clamping and truncation notices coexist and paging guidance uses the effective limit.- Supports aggregations, GROUP BY, window functions, and JOINs across tables from multiple
fx_get_timeseriescalls - Returns at most
row_limitrows;truncated: trueplus anoticegive theORDER BY <column> LIMIT <n> OFFSET <m>shape for the next page — ORDER BY is required for stable paging - Nested SQL results (STRUCT, MAP and LIST) render as JSON in Markdown cells. Table escaping preserves embedded pipes and markup. SQL NULL renders as an empty cell. In DuckDB 2, integer
//or%by zero returnsinvalid_query. UseTRY(expression)for SQL NULL. - Unregistered when
CANVAS_PROVIDER_TYPE=none; typed failures:canvas_not_found,missing_table,invalid_query
fx_dataframe_drop tool
canvas_idand exacttable_name(fromfx_dataframe_describe) required- Removes one staged table or view; upstream rate data is untouched and the series can be re-staged via
fx_get_timeseries - Returns
dropped: true/falsedepending on whether the table existed - Disabled unless
FX_ENABLE_CANVAS_DROP=true— otherwise absent fromtools/list, named with its enable hint only in the startup log and the HTTP landing page; also unregistered whenCANVAS_PROVIDER_TYPE=none
fx://currencies resource
- No parameters; returns current discovery with optional coverage dates,
count,source,as_ofand any metadata-unavailability notice asapplication/json. Usefx_list_currencieswithinclude_retired: truefor historical discovery. - Listed as a single static resource
fx://rates/latest/{base} resource
baseis an ISO 4217 currency code in the URI- Returns
base_currency,rate_date, aratesmap,rate_type, andsourcefor the latest served daily snapshot - Listed with four sample URIs (EUR, USD, GBP, JPY) as discovery hints
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Rate data:
- Keyless daily data via Frankfurter v1
- Market cross-rates share one unfiltered EUR snapshot or range. Statutory-only calls resolve locally.
- Date-snap semantics:
date_snappedsurfaces when the API returns a different date than requested, whether the day was a weekend, a holiday, or a day whose fix is not yet published - A market identity returns 1 on observed publication dates. A wholly statutory identity returns 1 on calendar dates from adoption.
- Long time-series that exceed the inline preview budget stage on DataCanvas (DuckDB, on by default) for SQL aggregation over the full range
Agent-friendly output:
- Rate provenance on every rate response —
rate_typeandsource, plusrate_dateanddate_snappedon point lookups, so agents can reason about trust and freshness - Structured error contracts — typed
reasonfields (unsupported_currency,date_out_of_range,invalid_query, …) let callers branch on failure type, not string parsing - Bounded responses — inline time-series pages continue from
next_start_date, and SQL results cap atrow_limit, so no call returns an unbounded payload - Success-path
noticeenrichment — explains an empty series, where to continue a paged series, or which tools read a staged one, so a legitimate zero-result never reads as a failure
Getting started
Public Hosted Instance
A public instance is available at https://exchange-rates.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"exchange-rates-mcp-server": {
"type": "streamable-http",
"url": "https://exchange-rates.caseyjhand.com/mcp"
}
}
}
Self-Hosted / Local
No API key required — Frankfurter is keyless. Add the following to your MCP client configuration file:
{
"mcpServers": {
"exchange-rates-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/exchange-rates-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"exchange-rates-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/exchange-rates-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"exchange-rates-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/exchange-rates-mcp-server:latest"
]
}
}
}
DataCanvas (DuckDB) is on by default for long time-series SQL analytics. To turn it off, add CANVAS_PROVIDER_TYPE=none: the dataframe tools drop out of tools/list, and fx_get_timeseries pages inline when canvas_id and stage are omitted. Explicit staging (canvas_id or stage: true) fails canvas_unavailable.
{
"mcpServers": {
"exchange-rates-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/exchange-rates-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"CANVAS_PROVIDER_TYPE": "none"
}
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
Prerequisites
- Bun v1.4.4 or higher (or Node.js v24+).
- No API key — Frankfurter is free and keyless.
Installation
- Clone the repository:
git clone https://github.com/cyanheads/exchange-rates-mcp-server.git
- Navigate into the directory:
cd exchange-rates-mcp-server
- Install dependencies:
bun install
- Configure environment:
cp .env.example .env
# edit .env as needed (all vars are optional — no keys required)
Configuration
All configuration is validated at startup via Zod schemas. Environment variables:
| Variable | Description | Default |
|---|---|---|
FRANKFURTER_BASE_URL | Frankfurter API base URL. Override for local testing or a self-hosted instance. | https://api.frankfurter.dev/v1 |
FX_TIMESERIES_CANVAS_THRESHOLD_DAYS | Day range above which fx_get_timeseries considers automatic DataCanvas staging; without canvas_id or stage: true, series that fit the preview remain inline. Explicit canvas_id or stage: true always requests staging. | 90 |
FX_ENABLE_CANVAS_DROP | Enable the destructive fx_dataframe_drop tool. Off by default: the tool is not registered and is absent from tools/list. | false |
CANVAS_PROVIDER_TYPE | Canvas engine. duckdb enables DataCanvas for fx_get_timeseries long-range spillover and registers the three fx_dataframe_* tools; none disables it and skips them from tools/list. An empty value takes the default. The .mcpb bundle sets none. | duckdb |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for HTTP server. | 3010 |
MCP_SESSION_MODE | HTTP session mode: auto, stateful, or stateless. The server declares stateless in code — no handler here asks the client for input mid-call, so nothing needs a session to resume — and setting this variable overrides that declaration. | stateless |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_REQUEST_STATE_KEY | Opt-in key (≥ 32 bytes, the same on every instance) that seals the requestState a handler returns between rounds. No tool here returns one. | — |
MCP_LOG_LEVEL | Log level (RFC 5424: debug, info, notice, warning, error). Also the floor for logs mirrored to the client. | info |
LOG_TOOL_FAILURE_PAYLOADS | Log each failed tool call's arguments and result (redacted by key name only). | false |
LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES | Per-payload cap for LOG_TOOL_FAILURE_PAYLOADS, in UTF-8 bytes. | 16384 |
OTEL_ENABLED | Enable OpenTelemetry instrumentation. | false |
OTEL_EXPORTER_OTLP_ENDPOINT | OTLP base URL; traces go to /v1/traces, metrics to /v1/metrics. | — |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT | Opt-in OTLP log export (e.g. http://localhost:4318/v1/logs); the base endpoint never enables it. | — |
See .env.example for the full list of optional overrides including storage, session, and telemetry vars.
Running the server
Local development
-
Build and run:
bun run rebuild bun run start:stdio # or bun run start:http -
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security, changelog sync bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t exchange-rates-mcp-server .
docker run --rm -p 3010:3010 exchange-rates-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/exchange-rates-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them. Production dependencies, DuckDB's native binding included, are cross-installed for the target platform in a separate deps stage, so multi-arch builds never run Bun under emulation and the runtime image carries node_modules/, dist/ and the published skills/ tree.
Project structure
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools, resources, and canvas accessor. |
src/config/ | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools/ | Tool definitions (*.tool.ts) — fx_* tools. |
src/mcp-server/resources/ | Resource definitions — fx://currencies and fx://rates/latest/{base}. |
src/services/frankfurter/ | Frankfurter HTTP client, retry logic, and domain types. |
src/services/canvas/ | Module-level DataCanvas accessor for fx_get_timeseries spillover. |
src/utils/ | Output helpers — Markdown table-cell escaping for fx_dataframe_query. |
tests/ | Unit and integration tests mirroring src/. |
skills/ | Published agent guidance for historical FX analysis. |
docs/ | Design document and idea notes. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storage - Register new tools and resources via the barrels in
src/mcp-server/*/definitions/index.ts - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
- Preserve the origin of every rate in
rate_typeandsource, including calculations that combine a statutory factor with a market observation.
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.
@cyanheads/exchange-rates-mcp-servernpm install @cyanheads/exchange-rates-mcp-server@cyanheads/exchange-rates-mcp-servernpm install @cyanheads/exchange-rates-mcp-serverRemote
Related Servers
io.github.cyanheads/anime-mcp-server
Search anime/manga, franchise relations, schedule, characters, rankings, studio filmography.
io.github.cyanheads/art-institute-chicago-mcp-server
Search the Art Institute of Chicago collection: artworks, artists, exhibitions, and audio guides.
io.github.cyanheads/arxiv-mcp-server
Search arXiv, fetch paper metadata, and read full-text content.