FX Currency MCP Server

FX Currency MCP Server

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.

Category
Visit Server

README

FX Currency MCP Server

A Model Context Protocol (MCP) server that provides real-time and historical foreign exchange rate data from the Frankfurter API. Built with FastMCP and includes GitHub OAuth authentication.

Features

  • šŸŒ 31+ Currencies - Support for major world currencies
  • šŸ’± Currency Conversion - Convert between any supported currencies
  • šŸ“Š Current Rates - Get today's exchange rates for any base currency
  • šŸ“… Historical Data - Access historical rates from 2020 onwards
  • šŸ“ˆ Time Series - Query rate changes over custom date ranges
  • šŸ” GitHub OAuth - Secure authentication with GitHub
  • šŸ“ Comprehensive Logging - Built-in logging for debugging and monitoring

Supported Currencies

AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, IDR, ILS, INR, ISK, JPY, KRW, MXN, MYR, NOK, NZD, PHP, PLN, RON, SEK, SGD, THB, TRY, USD, ZAR

Installation

Prerequisites

  • Python 3.13+
  • uv (recommended) or pip

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/ai-fx-mcp.git
    cd ai-fx-mcp
    
  2. Install dependencies

    uv sync
    # or with pip
    pip install -e .
    
  3. Configure environment variables

    cp .env.example .env
    

    Edit .env and add your GitHub OAuth credentials:

    GITHUB_CLIENT_ID=your_github_client_id
    GITHUB_CLIENT_SECRET=your_github_client_secret
    AUTH_BASE_URL=http://localhost:8080
    

GitHub OAuth Setup

  1. Go to GitHub Settings → Developer settings → OAuth Apps
  2. Create a new OAuth App
  3. Set Authorization callback URL to: http://localhost:8080/oauth/callback
  4. Copy the Client ID and generate a Client Secret
  5. Add them to your .env file

Usage

Run as HTTP Server (Development)

uv run python fx_mcp_server.py

Server will start on http://localhost:8080/mcp

Run with Claude Desktop (stdio mode)

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "fx-currency": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/ai-fx-mcp",
        "run",
        "python",
        "fx_mcp_server.py",
        "--stdio"
      ],
      "env": {
        "GITHUB_CLIENT_ID": "your_github_client_id",
        "GITHUB_CLIENT_SECRET": "your_github_client_secret",
        "AUTH_BASE_URL": "http://localhost:8080"
      }
    }
  }
}

Available Tools

available_currencies()

Returns a list of all supported currency codes and names.

Example Response:

{
  "USD": "United States Dollar",
  "EUR": "Euro",
  "JPY": "Japanese Yen"
}

convert_currency(from_code: str, to_code: str, amount: float = 1.0)

Convert an amount from one currency to another.

Parameters:

  • from_code: Source currency code (e.g., "USD")
  • to_code: Target currency code (e.g., "EUR")
  • amount: Amount to convert (default: 1.0)

Example:

convert_currency("USD", "EUR", 100)
# Returns: {"amount": 100, "base": "USD", "rates": {"EUR": 0.85}, "converted_amount": 85.0}

today_rates(code: str)

Get current exchange rates for a base currency.

Parameters:

  • code: Base currency code (e.g., "USD")

Example:

today_rates("USD")
# Returns all current rates relative to USD

historical_rates(date: str, base: str = "EUR", symbols: str | None = None)

Get exchange rates for a specific historical date.

Parameters:

  • date: Date in YYYY-MM-DD format
  • base: Base currency code (default: "EUR")
  • symbols: Optional comma-separated currency codes to filter

Example:

historical_rates("2024-01-15", "USD", "EUR,JPY")

time_series_rates(start_date: str, end_date: str, base: str = "EUR", symbols: str | None = None)

Get exchange rate time series data over a date range.

Parameters:

  • start_date: Start date in YYYY-MM-DD format
  • end_date: End date in YYYY-MM-DD format
  • base: Base currency code (default: "EUR")
  • symbols: Optional comma-separated currency codes to filter

Example:

time_series_rates("2024-01-01", "2024-01-31", "USD", "EUR,JPY")

Logging

Logs are written to:

  • Console (stdout) - captured by cloud platforms
  • File (/tmp/fx-mcp-server.log) - for local development

View logs in real-time:

tail -f /tmp/fx-mcp-server.log

Filter for application logs only:

tail -f /tmp/fx-mcp-server.log | grep __main__

Docker Support

Build Docker Image

Build the image for your platform:

# For local testing (uses your machine's architecture)
docker build -t pavm035/ai-fx-currency-mcp:v1.0 .

# For deployment to cloud platforms (Intel/AMD servers)
docker build --platform linux/amd64 -t pavm035/ai-fx-currency-mcp:v1.0 .

# For multi-platform support (both ARM and AMD64)
docker buildx build --platform linux/amd64,linux/arm64 -t pavm035/ai-fx-currency-mcp:v1.0 --push .

Run Docker Container Locally

# Run with environment file
docker run -p 8080:8080 --env-file .env pavm035/ai-fx-currency-mcp:v1.0

# Or with individual environment variables
docker run -p 8080:8080 \
  -e GITHUB_CLIENT_ID=your_client_id \
  -e GITHUB_CLIENT_SECRET=your_client_secret \
  -e AUTH_BASE_URL=http://localhost:8080 \
  -e ENABLE_AUTH=true \
  pavm035/ai-fx-currency-mcp:v1.0

Note: Do NOT use quotes around values in .env files when using --env-file.

Push to Docker Hub

# Login to Docker Hub
docker login

# Push the image
docker push pavm035/ai-fx-currency-mcp:v1.0

Deployment

Deploy to Render.com

  1. Using Pre-built Docker Image:

    • Create a new Web Service on Render
    • Select "Deploy an existing image from a registry"
    • Image URL: pavm035/ai-fx-currency-mcp:v1.0
    • Add environment variables in Render dashboard
    • Deploy!
  2. Using GitHub Repository:

    • Create a new Web Service on Render
    • Connect your GitHub repository
    • Render will automatically detect the Dockerfile
    • Set environment variables
    • Deploy!

Environment Variables for Render:

GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
AUTH_BASE_URL=https://your-app.onrender.com
ENABLE_AUTH=true

Other Cloud Platforms

The server is cloud-ready with stdout logging that works with:

  • AWS ECS/Fargate (CloudWatch Logs)
  • Google Cloud Run (Cloud Logging)
  • Azure Container Apps (Azure Monitor)
  • Any container platform with Docker support

Development

Project Structure

ai-fx-mcp/
ā”œā”€ā”€ fx_mcp_server.py    # Main MCP server implementation
ā”œā”€ā”€ pyproject.toml      # Project dependencies and metadata
ā”œā”€ā”€ .env.example        # Environment variable template
ā”œā”€ā”€ .gitignore          # Git ignore patterns
└── README.md           # This file

Testing

Test individual tools:

uv run python -c "from fx_mcp_server import convert_currency; print(convert_currency('USD', 'EUR', 100))"

Data Source

Exchange rate data is provided by Frankfurter API, a free and open-source API for current and historical foreign exchange rates published by the European Central Bank.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Pavan

Acknowledgments

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured