DEV Community

Cover image for Exchange Rate API in Claude Code, Cursor, and DeepSeek (MCP + Tool Calling) — Exchange Rate API
Madhushan
Madhushan

Posted on • Originally published at exchange-rateapi.com

Exchange Rate API in Claude Code, Cursor, and DeepSeek (MCP + Tool Calling) — Exchange Rate API

If you ask ChatGPT, Claude, or DeepSeek "what's the USD to EUR rate today?" , you usually get a confident-sounding hallucination. Large language models don't know this week's exchange rates -- they know rough historical ranges from their training data. For anything financial, that's a problem.

Today we're shipping two integrations that fix this specifically for Exchange Rate API:

  1. An MCP server -- so Claude Code, Cursor, Claude Desktop, and any other Model Context Protocol client can call our rate endpoints directly.
  2. A DeepSeek function-calling package -- a Python module that wires up real-time rates as tools for deepseek-chat and deepseek-reasoner.

Both are open source, MIT-licensed, and share the same set of tools: current rate, currency conversion, historical data, and supported-currency list. The first two work without an API key.

Why add currency tools to an AI assistant?

Three concrete use cases we've heard from users in the last month:

  • Invoice review. "I have an invoice in USD, my books are in EUR -- what should I record this as today?" The assistant needs a real rate, not a guess.
  • Travel planning. "Plan a 5-day Tokyo trip for 300,000 JPY." Without a live rate, the model can't accurately translate that into your home currency.
  • Cross-border quotes. "Quote this SOW at $12,000 USD but show the Brazilian client a BRL figure." Same problem -- requires today's mid-market rate.

In each case, the LLM is doing the hard part (understanding intent, formatting output). What it needs is a deterministic tool for the numeric step. That's what these integrations are.

The MCP server: for Claude Code, Cursor, Claude Desktop

The @exchangerateapi/mcp-server package implements the Model Context Protocol -- a standard that lets any MCP-compatible AI client call your tools over stdio.

Install in Claude Code

claude mcp add exchangerateapi -- npx -y @exchangerateapi/mcp-server
claude mcp env exchangerateapi EXCHANGERATE_API_KEY=your_key_here
Enter fullscreen mode Exit fullscreen mode

Install in Cursor or Claude Desktop

Add this to your MCP config (~/.cursor/mcp.json or Claude Desktop's config file):

{
  "mcpServers": {
    "exchangerateapi": {
      "command": "npx",
      "args": ["-y", "@exchangerateapi/mcp-server"],
      "env": { "EXCHANGERATE_API_KEY": "your_key_here" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart the client. Your assistant now has four new tools: get_exchange_rate, get_historical_rates, get_rates_authenticated, and list_currencies. Two of them (get_exchange_rate and list_currencies) don't need a key; the other two do.

Full docs and source: exchange-rateapi.com/mcp and github.com/Exchange-RateAPI/mcp-server.

The DeepSeek package: Python function calling

DeepSeek's Chat Completions API is OpenAI-compatible, which means the same function-calling mechanism works out of the box. The exchange-rateapi-deepseek package ships tool schemas, an agent wrapper, and a CLI.

One-shot question

pip install exchange-rateapi-deepseek
export DEEPSEEK_API_KEY=sk-xxxxx
exchange-rateapi-deepseek --ask "What is 2500 USD in EUR right now?"
Enter fullscreen mode Exit fullscreen mode

Library usage

from exchange_rateapi_deepseek import DeepSeekCurrencyAgent

with DeepSeekCurrencyAgent() as agent:
    print(agent.ask("How many Japanese Yen is 500 Swiss Francs?"))
Enter fullscreen mode Exit fullscreen mode

Under the hood, the agent sends your question to deepseek-chat with the tool schemas attached. If DeepSeek decides to call convert_currency, the package executes it against the Exchange Rate API and passes the JSON result back. DeepSeek then produces a final answer citing the actual rate.

If you'd rather drive the tool loop yourself (for integration into LangChain, LangGraph, or a custom orchestrator), import TOOLS and dispatch_tool and wire them in directly. See the raw example.

Full docs: exchange-rateapi.com/deepseek.

What about ChatGPT?

ChatGPT Desktop added MCP support in late 2025, so the MCP server above works there too -- same config format as Claude Desktop. For plain chatgpt.com, you can build a Custom GPT with Actions pointed at our OpenAPI spec. That's on our roadmap as an official first-party GPT; until then, our /llms.txt tells any browsing-enabled LLM exactly which endpoints to call.

Under the hood: same four tools everywhere

Whether you're using MCP, DeepSeek function calling, or the raw REST API, the operations are the same:

Tool Endpoint API key?
get_exchange_rate GET /api/rate?source=X&target=Y no
convert_currency (rate × amount, client-side) no
get_historical_rates GET /api/historical-rates yes
get_rates_authenticated GET /api/v1/rates yes
list_currencies GET /api/v1/symbols no

All rates are mid-market, sourced from Reuters (Refinitiv) and interbank market feeds. 160+ currencies supported.

Licensing & contributions

Both packages are MIT-licensed. Issues and pull requests are welcome:

If you build something on top of these -- a custom agent, a Slack bot, a trading notebook -- we'd love to hear about it.

Start building in seconds

npm install @exchangerateapi/sdk
Enter fullscreen mode Exit fullscreen mode




Related Articles

Top comments (0)