Skip to main content
Glama
sek-fx-mcp

sek-fx-mcp

by bromaniac

sek-fx-mcp

En MCP-server (Model Context Protocol) skriven i Python som låter en LLM slå upp växlingskursen för en valuta mot svenska kronor.

Servern kontaktar Riksbankens API och hämtar senaste mittkurs (PMI) för en valuta. Den accepterar ISO 4217-koden för valutor dvs NOK (norska kronor), EUR (Euro), GBP (brittiska pund) etc. Svaret är strukturerat och anger priset i SEK för en enhet av valutan samt vilket datum kursen publicerades. Kurser publiceras bankdagar, så datumet kan vara tidigare än dagens.

Kräver Python 3.14 och uv. Testad i Claude Desktop i macOS.

Installation

Claude Desktop:

uv run mcp install server.py

Claude Code:

claude mcp add sek-fx -- uv run --directory /sökväg/till/sek-fx-mcp server.py

Servern kan också startas direkt (stdio) med uv run server.py.

Related MCP server: Traktamente MCP Server

API-nyckel

Utan API-nyckel begränsar Riksbanken antalet anrop från samma ip-adress (5 anrop per minut och maximalt 1000 anrop per dygn). Med en nyckel kan du göra 200 anrop per minut, med ett tak på 30 000 anrop per vecka.

Så skaffar du en nyckel:

  1. Gå till Riksbankens API-portal, välj Sign Up uppe till höger och registrera dig.

  2. Gå till fliken Products och skapa en subscription.

  3. Nycklarna visas under fliken Profile som Primary och Secondary key. Du kan använda vilken som helst av dem.

Observera att testmiljön (developer.api-test.riksbank.se) och produktionsmiljön (developer.api.riksbank.se) har olika nycklar. Servern använder produktionsmiljön.

Sätt nyckeln i miljövariabeln RIKSBANKEN_API_KEY, så skickas den i headern Ocp-Apim-Subscription-Key:

uv run mcp install server.py -v RIKSBANKEN_API_KEY=<din-nyckel>
# eller
claude mcp add sek-fx -e RIKSBANKEN_API_KEY=<din-nyckel> -- uv run --directory /sökväg/till/sek-fx-mcp server.py

Utveckling

uv run pytest          # tester, Riksbankens API mockas
uv run ruff check .
uv run ruff format .
uv run mcp dev server.py   # MCP Inspector

Vidare läsning:

https://en.wikipedia.org/wiki/ISO_4217

https://github.com/modelcontextprotocol/python-sdk

https://www.riksbank.se/sv/statistik/rantor-och-valutakurser/hamta-rantor-och-valutakurser-via-api/

https://modelcontextprotocol.io/

Available Tools

1 tool
fetch_fxSEK exchange rateA
Read-only

Fetch the latest exchange rate from some currency to SEK using the API from Riksbanken.

Returns Riksbanken's daily mid-rate (PMI) as the price in SEK of 1 unit of the currency. The rate is published on banking days, so the date may be earlier than today.

Args: currency: 3-letter ISO 4217 currency code (e.g. USD, EUR)

NameRequiredDescriptionDefault
currencyYes

Output Schema

NameRequiredDescription
dateYesDate the rate was published by Riksbanken
currencyYesISO 4217 code of the quoted currency
sek_per_unitYesPrice in SEK of 1 unit of the currency

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered; the description adds genuinely useful behavior beyond that — the mid-rate (PMI) basis, the SEK-per-1-unit orientation, and the staleness caveat that the returned date may lag today. It stops short of noting error behavior for unsupported currencies.

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?

Front-loaded with the purpose, then return semantics, then the argument spec — a sensible ordering with no filler. The "using the API from Riksbanken" clause is mildly redundant with the following sentence naming Riksbanken again.

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?

For a single-parameter read tool, the definition covers purpose, rate semantics, publication cadence, date staleness, and argument format; an output schema exists, so return structure needs no further explanation. Nothing an agent needs to invoke it is missing.

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

Parameters4/5

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

Schema coverage is 0%, so the description carries the burden and largely does: it specifies the 3-letter ISO 4217 format and gives concrete examples (USD, EUR), which is what an agent needs to call it correctly. Minor gaps remain, such as what happens with unsupported or lowercase codes.

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?

"Fetch the latest exchange rate from some currency to SEK" gives a specific verb (fetch), resource (exchange rate) and direction (X to SEK), plus the data source (Riksbanken). An agent knows exactly what this returns without opening the schema.

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?

Usage is implied rather than stated: the description notes the rate is published on banking days and may be dated earlier than today, which tells the agent this is a latest-only, non-historical read. There is no explicit when-to-use/when-not framing, though no sibling alternatives exist to route away from.

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. 1 tool updatev0.1.0
    • First observedfetch_fx

TDQS

A4.4/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no overlapping purpose or selection ambiguity. fetch_fx clearly covers FX-to-SEK retrieval.

Naming Consistency5/5

The lone tool uses a clear verb_abbreviation pattern, fetch_fx. There are no mixed conventions or competing styles to create inconsistency.

Tool Count5/5

The single tool matches the narrow purpose of a SEK FX-rate server without redundant operations. It is minimal, but well-scoped for the stated domain.

Completeness4/5

The stated core operation, fetching the latest currency-to-SEK mid-rate, is covered. Minor optional additions such as listing supported currencies or querying historical rates are absent but not essential.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides real-time and historical foreign exchange rates for 31+ currencies, enabling currency conversion, historical rate lookups, and time series analysis using data from the Frankfurter API.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides current exchange rates for various currencies via the Model Context Protocol, allowing AI models to fetch real-time currency data.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables fetching real-time exchange rates between currencies and listing supported currency codes using the Frankfurter API.
    -