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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。