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.
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
-
Clone the repository
git clone https://github.com/yourusername/ai-fx-mcp.git cd ai-fx-mcp -
Install dependencies
uv sync # or with pip pip install -e . -
Configure environment variables
cp .env.example .envEdit
.envand 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
- Go to GitHub Settings ā Developer settings ā OAuth Apps
- Create a new OAuth App
- Set Authorization callback URL to:
http://localhost:8080/oauth/callback - Copy the Client ID and generate a Client Secret
- Add them to your
.envfile
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 formatbase: 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 formatend_date: End date in YYYY-MM-DD formatbase: 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
-
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!
-
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
- FastMCP - MCP server framework
- Frankfurter API - Currency data provider
- Model Context Protocol - Protocol specification
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.