Banxico MCP Server
The Banxico MCP Server provides programmatic access to Bank of Mexico economic data through MCP-compatible clients like Claude Desktop and Gemini CLI.
Capabilities:
Exchange Rates: Retrieve real-time and historical USD/MXN exchange rate data with customizable limits and date ranges (YYYY-MM-DD format)
Inflation Metrics: Access monthly, accumulated, or annual inflation data with configurable time periods
Interest Rates: Get current and historical CETES 28-day interest rates
Financial Indicators: Obtain UDIS (Investment Units) values and Banxico Reserve Assets data
Labor Market: Query current and historical unemployment rate data
Series Metadata: Access detailed information (title, description, date range) for specific data series
All queries return formatted data with dates and values, and historical data supports customizable limits on data points.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Banxico MCP Server what's the current USD to MXN exchange rate?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Banxico MCP Server
A Model Context Protocol (MCP) server for accessing the Bank of Mexico (Banxico) SIE API to retrieve USD/MXN exchange rate data and other economic indicators.
Features
Real-time Exchange Rates: Get the latest USD/MXN exchange rate from Banxico
Historical Data: Retrieve historical exchange rate data with customizable limits
Series Metadata: Access detailed information about economic data series
Date Range Queries: Get exchange rate data for specific date ranges
MCP Compatible: Works with Claude Desktop, Gemini CLI, and other MCP clients
Related MCP server: mcp-inegi
Prerequisites
Python 3.10+ installed on your system
uvx (recommended) or uv package manager
Banxico API Token - Get one from Banxico SIE API
Installation Methods
Option 1: Direct from GitHub (Auto-Updates) ⭐ Recommended
This method automatically gets the latest updates when you restart your MCP client:
Configuration for MCP clients:
"banxico": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/cfocoder/banxico_mcp",
"banxico-mcp-server"
],
"env": {
"BANXICO_API_TOKEN": "your_token_here"
}
}No manual installation needed! uvx will automatically download and run the latest version.
Option 2: Download Single File (Manual Updates)
If you prefer to download the file locally:
Install uvx (if not already installed):
pip install uvDownload the server file:
curl -O https://raw.githubusercontent.com/cfocoder/banxico_mcp/main/banxico_mcp_server.pyConfiguration for MCP clients:
"banxico": { "command": "uvx", "args": [ "--python", "3.12", "--from", "fastmcp", "--with", "httpx", "--", "python", "/absolute/path/to/banxico_mcp_server.py" ], "env": { "BANXICO_API_TOKEN": "your_token_here" } }To get updates: Re-download the file when new features are added.
Option 3: Traditional Installation
Clone the repository:
git clone https://github.com/cfocoder/banxico_mcp.git cd banxico_mcpInstall dependencies:
pip install fastmcp httpxRun the server:
BANXICO_API_TOKEN=your_token_here python banxico_mcp_server.py
Deployment with Docker/Coolify
Deploy as HTTP MCP Server (Coolify, Docker, Cloud)
This MCP server can run as a persistent HTTP service:
docker run -p 3333:3333 \
-e BANXICO_API_TOKEN=xxx \
-e MCP_PORT=3333 \
cfocoder/banxico_mcpKey points:
✅ Not just uvx - Can run as a long-lived service
✅ HTTP endpoint -
/healthavailable for monitoring✅ Configurable port - Set via
MCP_PORTenvironment variable✅ Graceful shutdown - Responds to SIGTERM signals
✅ Perfect for Coolify - Simple Docker deployment
Quick Start with Docker Compose (Local Testing)
Clone and setup:
git clone https://github.com/cfocoder/banxico_mcp.git cd banxico_mcp cp .env.example .env # Edit .env with your BANXICO_API_TOKEN and desired MCP_PORTRun with Docker Compose:
docker-compose upTest the server:
curl http://localhost:8000/health
Deployment in Coolify (Oracle Cloud)
Push to GitHub - Coolify will pull from your repository
Create new Docker service in Coolify - Select "Docker" type
Configure environment variables:
BANXICO_API_TOKEN: Your Banxico API tokenMCP_PORT: Port number (default: 8000, change to avoid conflicts)
Expose port - Configure port mapping in Coolify dashboard
Health checks - Coolify will automatically use the
/healthendpoint
The Docker image will build automatically with production-ready features including health checks, non-root user, and graceful shutdown handling.
Configuration
Get Your Banxico API Token
Fill out the form to request an API token
You'll receive your token via email
Configure MCP Clients
The server works with any MCP-compatible client. Use Option 1 from "Installation Methods" above (auto-updates from GitHub) for the easiest setup.
For local configuration, use the uvx commands shown in Installation Methods and substitute your Banxico API token in the env section.
Available Tools
Tool | Description | Parameters |
| Get the most recent USD/MXN exchange rate | None |
| Get historical exchange rate data |
|
| Get metadata for a data series |
|
| Get data for specific date range |
|
| Get inflation data |
|
| Get UDIS (Investment Units) values |
|
| Get CETES 28-day interest rates |
|
| Get Banxico Reserve Assets data |
|
| Get unemployment rate data |
|
Usage Examples
Once configured with your MCP client, you can ask:
Exchange Rates:
"What's the current USD to MXN exchange rate?"
"Show me the USD/MXN exchange rate for the last 10 days"
"Get the exchange rate data from 2024-01-01 to 2024-01-31"
"What's the metadata for the USD/MXN series?"
Inflation Data:
"What's the current monthly inflation rate in Mexico?"
"Show me the annual inflation data for the last year"
"Get the accumulated inflation for the last 6 months"
Interest Rates:
"What are the current CETES 28-day rates?"
"Show me the CETES rates for the last month"
Financial Indicators:
"What are the current UDIS values?"
"Show me Banxico's reserve assets"
"Get the latest financial indicators from Banxico"
Labor Market:
"What's the current unemployment rate in Mexico?"
"Show me unemployment trends for the last year"
"How has unemployment changed over the last 2 years?"
API Reference
The server uses the Banxico SIE API with the following endpoints:
Exchange Rates:
Latest Data:
/series/SF63528/datos/oportunoHistorical Data:
/series/SF63528/datosSeries Metadata:
/series/SF63528Date Range:
/series/SF63528/datos/{start_date}/{end_date}
Inflation Data:
Monthly Inflation:
/series/SP30577/datosAccumulated Inflation:
/series/SP30579/datosAnnual Inflation:
/series/SP30578/datos
Financial Indicators:
UDIS:
/series/SP68257/datosCETES 28-day:
/series/SF282/datosBanxico Reserves:
/series/SF308843/datos
Labor Market:
Unemployment Rate:
/series/SL1/datos
Development
Project Structure
banxico-mcp-server/
├── Dockerfile # Production Docker image
├── docker-compose.yml # Local testing with Docker
├── .dockerignore # Docker build optimization
├── .env.example # Environment template
├── banxico_mcp_server.py # Main MCP server
├── pyproject.toml # Package configuration
├── README.md # This file
├── LICENSE # MIT License
├── CONTRIBUTING.md # Development guidelines
└── docs/
└── EXTENDING.md # Guide for adding new endpointsTesting
To test the server without an MCP client:
# Set your token
export BANXICO_API_TOKEN=your_token_here
# Run the server with a timeout to test startup
timeout 5s python banxico_mcp_server.py && echo "Server starts successfully"Adding New Tools
See EXTENDING.md for detailed instructions on adding new Banxico API endpoints.
Troubleshooting
Common Issues
"BANXICO_API_TOKEN environment variable not set"
Ensure your API token is properly configured in the MCP client settings
"Failed to retrieve data"
Check your internet connection
Verify your API token is valid
Ensure the Banxico API is accessible
Server doesn't start
Verify Python 3.10+ is installed
Check that uvx or required dependencies are available
Debug Mode
Run with debug logging:
BANXICO_API_TOKEN=your_token PYTHONPATH=. python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
from banxico_mcp_server import mcp
mcp.run()
"Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Bank of Mexico (Banxico) for providing the SIE API
Model Context Protocol for the protocol specification
FastMCP for the excellent MCP server framework
Related Projects
Available Tools
9 toolsget_banxico_reserves_dataB
Get Banxico Reserve Assets data.
Args: limit: Maximum number of recent data points (default: 30)
Returns: Current and historical Banxico reserve assets data
Inputs: limit. Returns: result
get_cetes_28_dataB
Get CETES 28-day interest rate data from Banxico.
Args: limit: Maximum number of recent data points (default: 30)
Returns: Current and historical CETES 28-day rates
Inputs: limit. Returns: result
get_date_range_dataB
Get exchange rate data for a specific date range.
Args: start_date: Start date in YYYY-MM-DD format end_date: End date in YYYY-MM-DD format series_id: The series ID (default: SF63528 for USD/MXN)
Returns: Exchange rate data for the specified date range
Inputs: start_date (required), end_date (required), series_id. Returns: result
get_inflation_dataB
Get inflation data from Banxico.
Args: inflation_type: Type of inflation data ('monthly', 'accumulated', 'annual') limit: Maximum number of recent data points (default: 12)
Returns: Formatted inflation data with percentages
Inputs: inflation_type, limit. Returns: result
get_latest_usd_mxn_rateA
Get the latest USD/MXN exchange rate from Banxico.
Returns: The most recent USD/MXN exchange rate with date
Inputs: no named parameters. Returns: result
get_series_metadataB
Get metadata for a Banxico series.
Args: series_id: The series ID to get metadata for (default: SF63528 for USD/MXN)
Returns: Series metadata including title, description, and date range
Inputs: series_id. Returns: result
get_udis_dataB
Get UDIS (Investment Units) data from Banxico.
Args: limit: Maximum number of recent data points (default: 30)
Returns: Current and historical UDIS values
Inputs: limit. Returns: result
get_unemployment_dataB
Get unemployment rate data from Banxico.
Args: limit: Maximum number of recent data points (default: 24 for 2 years of monthly data)
Returns: Current and historical unemployment rate data
Inputs: limit. Returns: result
get_usd_mxn_historical_dataC
Get historical USD/MXN exchange rate data from Banxico.
Args: limit: Maximum number of recent data points to return (default: 30)
Returns: Historical USD/MXN exchange rate data
Inputs: limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose targeting specific economic indicators or data types from Banxico. There is no overlap in functionality—tools like get_latest_usd_mxn_rate and get_usd_mxn_historical_data serve different needs (latest vs. historical data), and others cover unique datasets such as reserves, inflation, or unemployment.
All tool names follow a consistent verb_noun pattern starting with 'get_' followed by a descriptive noun phrase (e.g., get_banxico_reserves_data, get_inflation_data). This uniformity makes the tool set predictable and easy to understand at a glance.
With 9 tools, the server is well-scoped for accessing Banxico's economic data. Each tool earns its place by covering key indicators like exchange rates, inflation, unemployment, and reserves, without being overly broad or too limited for the domain.
The tool set provides comprehensive coverage for retrieving various economic data points from Banxico, including exchange rates, inflation, unemployment, and reserves. A minor gap is the lack of tools for more complex operations like data filtering beyond date ranges or series IDs, but core retrieval needs are fully met.
Maintenance
Related MCP Connectors
Mexico's official economic data from Banxico: USD/MXN, inflation, UDIS, TIIE and reserves.
Banxico MCP — Banco de México (Mexico's central bank) via the SIE API.
Live & historical FX rates and currency conversion for AI agents. No API keys.
Live & historical FX rates and currency conversion for AI agents. No API keys.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables querying economic data from Banco de México (Mexico's central bank) via the SIE API.309 npmMIT
- AlicenseNot gradedqualityCmaintenanceProvides access to Mexico's INEGI (national statistics office) indicators API, enabling AI agents to query statistical data through natural language or direct tool calls.129 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables querying Mexican stock market data (BMV, BIVA) including issuers, intraday quotes, historical prices, financials, indices, rates, currencies, commodities, and news through natural language.4MIT
- AlicenseAqualityBmaintenanceEnables AI assistants and agents to query official Mexican economic data from Banxico, including USD/MXN exchange rates, inflation (INPC), UDIS, and interest rates.624 PyPI6MIT