Skip to main content
Glama
floreskemec

latamfx-mcp

by floreskemec

latamfx-mcp

An MCP server that exposes public LatAm FX data and an auditable reconciliation engine to AI agents (Claude Desktop, Claude Code, or any MCP client).

CI Python MCP Ruff Checked with mypy License: MIT

latamfx-mcp lets an LLM agent answer questions like "what's the blue dollar today?", "convert 1,500 USD to ARS at the MEP rate", or "reconcile these two ledgers and tell me what didn't match" — entirely from free, key-less public APIs. No credentials, no client data.

It doubles as a reference implementation of a production-shaped MCP server: hexagonal architecture, typed contracts, retries with backoff, a TTL cache, contract tests against mocked HTTP, CI, Docker and a Cloud Run deployment module.


Tools

Tool

What it does

list_fx_sources

List supported sources (oficial, blue, MEP, CCL, mayorista, cripto, tarjeta).

get_fx_quote

Latest buy/sell quote for a source.

get_fx_timeseries

Historical buy/sell series (most recent N points).

get_fx_stats

min / max / mean / volatility of the mid price (computed with Polars).

convert

Convert an amount between currencies using a source's quote (USD↔ARS).

reconcile

Match two ledgers with a multi-rule engine; returns matches, misses and a match rate.

Plus a resource: fx://sources (the source catalog as text).

The reconciliation engine

reconcile is a sanitized, generic version of intercompany / bank reconciliation engines used in real fintech work. Rules run in priority order and each right-side entry is consumed at most once, so the output is a valid one-to-one assignment where every match is traceable to the rule that produced it:

  1. exact_reference — same non-empty external reference (score 1.0).

  2. amount_date — equal amount within a day-tolerance window (score decays with the gap).

  3. fuzzy_description — equal amount + similar free-text description above a threshold.


Related MCP server: veradata

Architecture

Hexagonal (ports & adapters): the domain and application layers know nothing about HTTP or MCP, so the engine is pure and the data source is swappable.

flowchart TD
    Agent[AI agent / MCP client] -->|tools, resources| Server[server.py · FastMCP]
    Server --> App[application · FxService, ReconciliationService]
    App --> Domain[domain · models + reconciliation engine]
    App -->|FxProvider port| Port{{ports}}
    Port -.implemented by.-> Adapter[infrastructure · DolarApiProvider]
    Adapter -->|httpx + retries + TTL cache| Public[(dolarapi.com / argentinadatos.com)]
src/latamfx_mcp/
├── domain/           # pure models + reconciliation engine (no I/O)
├── ports/            # FxProvider Protocol (dependency inversion)
├── application/      # use cases: FX + reconciliation
├── infrastructure/   # httpx adapter, retry policy, TTL cache
├── config.py         # env-driven settings
└── server.py         # FastMCP wiring (tools + resource)

See docs/architecture.md and the ADRs for the design decisions.


Quickstart

Requires uv.

git clone https://github.com/floreskemec/latamfx-mcp.git
cd latamfx-mcp
uv sync
uv run latamfx-mcp     # starts the MCP server over stdio

Use it from Claude Code

claude mcp add latamfx -- uv --directory /absolute/path/to/latamfx-mcp run latamfx-mcp

Use it from Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "latamfx": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/latamfx-mcp", "run", "latamfx-mcp"]
    }
  }
}

Then ask Claude: "Using latamfx, convert 1500 USD to ARS at the blue rate and show me the last 7 days of the blue dollar."


Development

uv sync
uv run pytest            # tests + coverage
uv run ruff check .      # lint
uv run ruff format .     # format
uv run mypy              # static types

Configuration is read from environment variables (all optional):

Variable

Default

Purpose

LATAMFX_HTTP_TIMEOUT

10.0

HTTP timeout (seconds).

LATAMFX_HTTP_RETRIES

3

Max attempts on transient failures.

LATAMFX_CACHE_TTL

60.0

Quote/series cache TTL (seconds).


Deployment

A multi-stage Dockerfile builds a slim image, and deploy/terraform contains a minimal OpenTofu/Terraform module to run it on Google Cloud Run. See the deploy README.


Data sources

Both are free, community-maintained public APIs. This project is not affiliated with them; please review their terms before heavy use.

License

MIT © Gonzalo Flores Kemec

Available Tools

6 tools
convertB

Convert an amount between currencies using a source's quote (e.g. USD<->ARS).

ParametersJSON Schema
NameRequiredDescriptionDefault
amountYes
from_currencyYes
to_currencyYes
sourceNooficial

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only hints at dependency on the source parameter but does not explain side effects, authentication needs, error conditions, or whether the operation is read-only. Minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that immediately states the action and includes an example. No unnecessary words. It is front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 4 parameters (3 required) and an output schema, the description provides adequate top-level context but omits details like expected currency formats (ISO codes?), available source values, and error handling. The output schema reduces need for return value explanation, but parameter guidance is lacking. Adequate but with gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, leaving all 4 parameters undocumented. The description adds only a vague reference to 'source's quote' and an example (USD<->ARS) which hints at currency formats but does not define valid values, meaning, or constraints for any parameter. Insufficient compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action ('Convert an amount between currencies') and specifies the method ('using a source's quote') with an example (USD<->ARS). It distinguishes from siblings like get_fx_quote and reconcile by implying a direct conversion operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for conversion tasks but does not explicitly provide when-to-use or when-not-to-use guidance. No mention of alternatives or prerequisites. The context of siblings suggests differentiation but the description does not articulate it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_fx_quoteA

Get the latest buy/sell quote for an FX source (e.g. 'blue', 'oficial').

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description is sole source. It indicates a non-destructive read operation, but does not disclose error handling (e.g., invalid source), whether both buy and sell values are returned, or any rate limits. Adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no extraneous words. Purpose is front-loaded. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given simplicity (1 param, output schema exists), description is nearly complete. Could explicitly state that both buy and sell quotes are returned. Still, adequate for most agents.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only parameter 'source' lacks schema description (0% coverage). Description provides examples ('blue', 'oficial') but does not specify exact format, allowed values, or case sensitivity. Adds some value but incomplete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states action 'Get' and resource 'latest buy/sell quote for an FX source' with concrete examples ('blue', 'oficial'). It differentiates from siblings like 'convert' or 'list_fx_sources' by focusing on a single current quote.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for obtaining a current quote, but no explicit guidance on when to prefer this tool over alternatives like 'convert' or 'get_fx_stats'. No exclusions or when-not-to-use mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_fx_statsB

Summary statistics (min/max/mean/volatility) of a source's mid price.

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description only states output but omits behavioral traits like data freshness, error handling, or volatility calculation period.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded, no fluff. However, it sacrifices informativeness for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists, the description is adequate but lacks details like time window for volatility. A more complete description would aid selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% for the parameter 'source'. The description vaguely implies it's a source of mid price but doesn't clarify acceptable values (e.g., currency pair format).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns summary statistics (min/max/mean/volatility) of a source's mid price, distinguishing it from siblings like get_fx_quote (single quote) and get_fx_timeseries (time series).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. Lacks when/when-not context or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_fx_timeseriesB

Get the historical buy/sell series for a source (most recent last_n).

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes
last_nNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description only states it retrieves data, implying a read-only operation, but does not elaborate on behavior such as error handling, data ordering, or limitations. With no annotations, more detail is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 10 words, highly concise and without fluff. However, it could benefit from a slight structure, but given its brevity, it is efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return format need not be described. However, the description lacks context about source (e.g., what constitutes a source) and does not clarify that data is most recent N points. It is minimally adequate but missing some context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description explains last_n implicitly as 'most recent', but source is not described at all. The default and constraints for last_n are not mentioned.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves historical buy/sell series for a source, with a specific parameter for most recent N. This distinguishes it from sibling tools like convert, get_fx_quote, get_fx_stats, list_fx_sources, and reconcile, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It does not specify prerequisites, exclusions, or context for choosing this over get_fx_quote or get_fx_stats.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_fx_sourcesA

List the supported FX sources (Argentine dollar variants).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the read-only nature ('list') and the specific scope (Argentine dollar variants), which is sufficient for a simple listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 8 words with no wasted language, fully efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and the presence of an output schema, the description is complete enough—it clearly states the tool's function and scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has no parameters and schema coverage is 100% (trivially), so the description adds no extra parameter information. Baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List the supported FX sources (Argentine dollar variants)' clearly states the tool's purpose with a specific verb and resource, and distinguishes it from siblings like convert or get_fx_quote which perform different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when one needs to know available FX sources, but does not explicitly state when to use this tool versus alternatives, nor provide any exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

reconcileA

Reconcile two ledgers with a multi-rule engine (exact ref, amount+date, fuzzy).

Returns matched pairs (with the rule and a confidence score), unmatched ids on each side, and the overall match rate.

ParametersJSON Schema
NameRequiredDescriptionDefault
leftYes
rightYes
day_toleranceNo
fuzzy_thresholdNo
enable_fuzzyNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It clearly states the output: 'Returns matched pairs (with the rule and a confidence score), unmatched ids on each side, and the overall match rate.' It does not mention any side effects, but the tool appears to be a pure computation. Could be improved by explicitly stating it does not modify data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two well-structured sentences: first covers purpose and method, second covers output. No redundancy, front-loaded with key action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters (2 required) and a nested input schema, the description covers the matching rules and output structure. However, it lacks details on parameter ranges (e.g., day_tolerance 0-30, fuzzy_threshold 0-1) and their effect on matching. Output schema exists but is not detailed here; the description sufficiently summarizes it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It explains matching methods (exact ref, amount+date, fuzzy), which relate to 'day_tolerance' and 'fuzzy_threshold', but does not describe 'left' and 'right' explicitly (though they are clear from context). The parameter 'reference' in the nested schema is also not mentioned. Partial compensation but insufficient for full clarity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Reconcile two ledgers with a multi-rule engine (exact ref, amount+date, fuzzy).' It specifies the resource (ledgers) and the action (reconcile) with distinct matching methods, and distinguishes itself from sibling FX tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for reconciling two sets of ledger entries, and the sibling tools are all FX-related, so usage context is clear. However, it lacks explicit guidance on when not to use this tool or when to prefer alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.1.0
    • First observedconvert
    • First observedget_fx_quote
    • First observedget_fx_stats
    • First observedget_fx_timeseries
    • First observedlist_fx_sources
    • First observedreconcile

TDQS

A3.5/5.0

Scored across 6 tools

Disambiguation4/5

Most tools have distinct purposes (conversion, quotes, stats, timeseries, source listing). However, 'reconcile' introduces a separate domain (ledger reconciliation) which could be confusing but does not overlap with FX tools.

Naming Consistency3/5

Naming conventions are mixed: 'convert' and 'reconcile' are bare verbs, while others use 'get_fx_*' or 'list_fx_*' pattern. This inconsistency could be confusing.

Tool Count4/5

6 tools is a reasonable number for an FX-focused server plus a reconciliation tool. It feels slightly heavy but still manageable.

Completeness4/5

Core FX operations (list sources, get quote, timeseries, stats, convert) are covered. The inclusion of reconciliation is a bonus but not part of the expected surface, so minor gap.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Provides real-time foreign-exchange rates, historical data, and multi-currency lookups to MCP-compatible AI coding assistants like Claude Code and Cursor.
    4
    53 npm
    MIT
  • F
    license
    A
    quality
    B
    maintenance
    MCP server providing verified Latin American data via x402 micropayments. 4 MCP tools: vera_rates (central bank rates CO/MX/BR/CL/PE), vera_sanctions (OFAC+SARLAFT+CNBV+COAF+UAF screening, EU AI Act Art.13), vera_entity (RUES/CNPJ/RFC enrichment), vera_context (AI market intelligence). $0.02–$0.10 USDC per call.
    4
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Validates LatAm banking and tax IDs (Mexican CLABE, Brazilian CNPJ/CPF checksums) and performs BrasilAPI company, CEP, and bank lookups, enabling AI agents to verify financial and tax information in Latin America.
    3 npm
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Verified Latin American data for autonomous AI agents via x402 micropayments. Sanctions screening (OFAC SDN + SARLAFT + CNBV + COAF + UAF) with EU AI Act Art.12/13 compliant hash-chain audit trail, entity enrichment (RUES/CNPJ/RFC), and real-time LATAM central bank rates including Argentina dólar blue. $0.02–$0.10 USDC per call on Base and Solana. No API key required.
    4
    1
    -