mcp-mexico 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. mcp_mexico-0.1.0/.env.example +4 -0
  2. mcp_mexico-0.1.0/.gitignore +231 -0
  3. mcp_mexico-0.1.0/LICENSE +21 -0
  4. mcp_mexico-0.1.0/PKG-INFO +136 -0
  5. mcp_mexico-0.1.0/README.es.md +110 -0
  6. mcp_mexico-0.1.0/README.md +110 -0
  7. mcp_mexico-0.1.0/pyproject.toml +68 -0
  8. mcp_mexico-0.1.0/scripts/record_fixtures.py +73 -0
  9. mcp_mexico-0.1.0/src/mcp_mexico/__init__.py +1 -0
  10. mcp_mexico-0.1.0/src/mcp_mexico/cache.py +27 -0
  11. mcp_mexico-0.1.0/src/mcp_mexico/config.py +9 -0
  12. mcp_mexico-0.1.0/src/mcp_mexico/errors.py +18 -0
  13. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/__init__.py +0 -0
  14. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/data/__init__.py +5 -0
  15. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/data/isr.json +1082 -0
  16. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/data/uma.json +16 -0
  17. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/isr.py +49 -0
  18. mcp_mexico-0.1.0/src/mcp_mexico/fiscal/uma.py +62 -0
  19. mcp_mexico-0.1.0/src/mcp_mexico/models.py +90 -0
  20. mcp_mexico-0.1.0/src/mcp_mexico/py.typed +0 -0
  21. mcp_mexico-0.1.0/src/mcp_mexico/server.py +51 -0
  22. mcp_mexico-0.1.0/src/mcp_mexico/sources/__init__.py +0 -0
  23. mcp_mexico-0.1.0/src/mcp_mexico/sources/banxico.py +148 -0
  24. mcp_mexico-0.1.0/src/mcp_mexico/sources/inegi.py +91 -0
  25. mcp_mexico-0.1.0/src/mcp_mexico/tools/__init__.py +0 -0
  26. mcp_mexico-0.1.0/src/mcp_mexico/tools/_errors.py +14 -0
  27. mcp_mexico-0.1.0/src/mcp_mexico/tools/banxico.py +117 -0
  28. mcp_mexico-0.1.0/src/mcp_mexico/tools/fiscal.py +30 -0
  29. mcp_mexico-0.1.0/src/mcp_mexico/tools/inegi.py +100 -0
  30. mcp_mexico-0.1.0/tests/__init__.py +0 -0
  31. mcp_mexico-0.1.0/tests/conftest.py +74 -0
  32. mcp_mexico-0.1.0/tests/fixtures/banxico/SF331451_datos_oportuno.json +16 -0
  33. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43718_datos_2026-09-17_2026-09-27.json +40 -0
  34. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43718_datos_2026-09-24_2026-10-02.json +40 -0
  35. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43718_datos_2026-10-03_2026-10-04.json +10 -0
  36. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43718_datos_oportuno.json +16 -0
  37. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43783_datos_oportuno.json +16 -0
  38. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43936_datos_2026-07-01_2026-09-30.json +64 -0
  39. mcp_mexico-0.1.0/tests/fixtures/banxico/SF43936_datos_oportuno.json +16 -0
  40. mcp_mexico-0.1.0/tests/fixtures/banxico/SF61745_datos_oportuno.json +16 -0
  41. mcp_mexico-0.1.0/tests/fixtures/inegi/INDICATOR_910392_es_00_false_BIE-BISE_2.0.json +6249 -0
  42. mcp_mexico-0.1.0/tests/test_banxico_client.py +103 -0
  43. mcp_mexico-0.1.0/tests/test_banxico_tools.py +113 -0
  44. mcp_mexico-0.1.0/tests/test_cache.py +25 -0
  45. mcp_mexico-0.1.0/tests/test_inegi_client.py +53 -0
  46. mcp_mexico-0.1.0/tests/test_inegi_tools.py +117 -0
  47. mcp_mexico-0.1.0/tests/test_isr.py +75 -0
  48. mcp_mexico-0.1.0/tests/test_server.py +84 -0
  49. mcp_mexico-0.1.0/tests/test_uma.py +50 -0
@@ -0,0 +1,4 @@
1
+ # Banxico SIE API token (free): https://www.banxico.org.mx/SieAPIRest/service/v1/token
2
+ BANXICO_TOKEN=
3
+ # INEGI Indicators API token (free): https://www.inegi.org.mx/app/desarrolladores/generatoken/Usuarios/token_Verify
4
+ INEGI_TOKEN=
@@ -0,0 +1,231 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # --- Workspace additions ---
223
+ # macOS
224
+ .DS_Store
225
+ # Editors
226
+ .vscode/
227
+ .idea/
228
+ # Secrets (commit .env.example only)
229
+ .env
230
+ .env.*
231
+ !.env.example
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Diego Tepichin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.5
2
+ Name: mcp-mexico
3
+ Version: 0.1.0
4
+ Summary: MCP server that gives AI agents access to official Mexican public data: Banxico, INEGI, UMA and ISR tables.
5
+ Project-URL: Homepage, https://github.com/DiegoTepichin/mcp-mexico
6
+ Project-URL: Repository, https://github.com/DiegoTepichin/mcp-mexico
7
+ Project-URL: Issues, https://github.com/DiegoTepichin/mcp-mexico/issues
8
+ Author: Diego Tepichin
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: banxico,inegi,isr,mcp,mexico,model-context-protocol,sat,uma
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: httpx>=0.28
23
+ Requires-Dist: mcp<2.3,>=2.2
24
+ Requires-Dist: pydantic>=2
25
+ Description-Content-Type: text/markdown
26
+
27
+ # mcp-mexico
28
+
29
+ MCP server that gives AI agents official Mexican public data: Banxico exchange and interest rates, INEGI inflation, UMA values and ISR tax tables.
30
+
31
+ [![CI](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml/badge.svg)](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml)
32
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
33
+
34
+ [Leer en español](README.es.md)
35
+
36
+ ![Claude Code answering questions about the FIX exchange rate, inflation and ISR with mcp-mexico](https://raw.githubusercontent.com/DiegoTepichin/mcp-mexico/main/docs/demo.gif)
37
+
38
+ *Claude Code using `mcp-mexico`. Response wait times are cut from the recording.*
39
+
40
+ ## Why
41
+
42
+ AI assistants either make up Mexican economic figures or use stale ones, so you end up looking them up by hand at Banxico, INEGI or the SAT and pasting them in. `mcp-mexico` lets any [MCP](https://modelcontextprotocol.io) client (Claude Desktop, Claude Code, Cursor) fetch them directly. Every result names its official source and the date it applies to.
43
+
44
+ ## Tools
45
+
46
+ | Tool | What it returns | Source | Token |
47
+ |---|---|---|---|
48
+ | `get_fix_rate` | FIX USD/MXN exchange rate, latest or for a date. On weekends and holidays it returns the previous business day. | Banxico SIE | `BANXICO_TOKEN` |
49
+ | `get_fix_rate_range` | Daily FIX between two dates (max 366 days). | Banxico SIE | `BANXICO_TOKEN` |
50
+ | `get_interest_rate` | Banxico target rate, 28-day TIIE, overnight TIIE de Fondeo or 28-day CETES; latest or for a date. | Banxico SIE | `BANXICO_TOKEN` |
51
+ | `get_interest_rate_range` | One of those rates between two dates (max 366 days). | Banxico SIE | `BANXICO_TOKEN` |
52
+ | `get_inflation` | INPC index and monthly, annual and year-to-date inflation for a month (latest by default). | INEGI | `INEGI_TOKEN` |
53
+ | `get_inflation_range` | The same for each month in a range (max 240 months). | INEGI | `INEGI_TOKEN` |
54
+ | `get_uma` | UMA daily, monthly and annual values, 2020–2026, with validity dates. | INEGI | none |
55
+ | `get_isr_table` | ISR tables for individuals, 2020–2026: monthly (LISR Art. 96) and annual (LISR Art. 152). | Anexo 8 of the RMF (SAT / DOF) | none |
56
+
57
+ `get_uma` and `get_isr_table` work offline with no configuration. Their data ships inside the package; each table cites the document it was taken from and the date it was verified.
58
+
59
+ ## Get your tokens
60
+
61
+ Both are free and take a couple of minutes.
62
+
63
+ 1. **Banxico**: open the [SIE API token page](https://www.banxico.org.mx/SieAPIRest/service/v1/token), solve the captcha and click "Generar token". The 64-character token appears on the page.
64
+ 2. **INEGI**: enter your email in the [INEGI token form](https://www.inegi.org.mx/app/desarrolladores/generatoken/Usuarios/token_Verify). The token arrives by email.
65
+
66
+ You can start with only one token, or none: tools whose token is missing return a message explaining how to get it.
67
+
68
+ ## Install
69
+
70
+ You need [uv](https://docs.astral.sh/uv/getting-started/installation/). The server runs with `uvx mcp-mexico`; you don't start it yourself, your MCP client does.
71
+
72
+ ### Claude Code
73
+
74
+ ```bash
75
+ claude mcp add mcp-mexico -e BANXICO_TOKEN=your-token -e INEGI_TOKEN=your-token -- uvx mcp-mexico
76
+ ```
77
+
78
+ ### Claude Desktop
79
+
80
+ Add this to `claude_desktop_config.json` (Settings → Developer → Edit Config) and restart Claude Desktop:
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "mcp-mexico": {
86
+ "command": "uvx",
87
+ "args": ["mcp-mexico"],
88
+ "env": {
89
+ "BANXICO_TOKEN": "your-token",
90
+ "INEGI_TOKEN": "your-token"
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ### Cursor
98
+
99
+ Add the same `mcpServers` block to `~/.cursor/mcp.json`.
100
+
101
+ ## Try it
102
+
103
+ Ask your assistant:
104
+
105
+ - "What is today's FIX exchange rate?"
106
+ - "What was annual inflation in Mexico in December 2024?"
107
+ - "How much is 30 UMAs in pesos this year?"
108
+ - "Using the 2026 monthly ISR table, how much tax is withheld on a 25,000 peso salary?"
109
+
110
+ ## Configuration
111
+
112
+ | Variable | Required | Description |
113
+ |---|---|---|
114
+ | `BANXICO_TOKEN` | For Banxico tools | Banxico SIE API token. |
115
+ | `INEGI_TOKEN` | For INEGI tools | INEGI Indicators API token. |
116
+
117
+ Responses are cached in memory only: up to 1 hour for latest values, 24 hours for past Banxico ranges and 6 hours for the INPC series. Nothing is written to disk.
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ uv sync
123
+ uv run pytest
124
+ uv run ruff check . && uv run ruff format --check . && uv run mypy .
125
+ uv run mcp-mexico # starts the server over stdio
126
+ ```
127
+
128
+ Tests never touch the network: they replay responses recorded from the real APIs. See [CONTRIBUTING.md](CONTRIBUTING.md).
129
+
130
+ ## Disclaimer
131
+
132
+ This project is not affiliated with Banco de México, INEGI or the SAT. Figures come from their public sources, but check the cited source before relying on them for tax or legal decisions.
133
+
134
+ ## License
135
+
136
+ [MIT](LICENSE) © Diego Tepichin
@@ -0,0 +1,110 @@
1
+ # mcp-mexico
2
+
3
+ Servidor MCP que da a los agentes de IA datos públicos oficiales de México: tipo de cambio y tasas de Banxico, inflación de INEGI, valores de la UMA y tablas de ISR.
4
+
5
+ [![CI](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml/badge.svg)](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml)
6
+ [![Licencia: MIT](https://img.shields.io/badge/Licencia-MIT-blue.svg)](LICENSE)
7
+
8
+ [Read in English](README.md)
9
+
10
+ ![Claude Code respondiendo preguntas sobre el tipo de cambio FIX, la inflación y el ISR con mcp-mexico](https://raw.githubusercontent.com/DiegoTepichin/mcp-mexico/main/docs/demo.gif)
11
+
12
+ *Claude Code usando `mcp-mexico`. La grabación recorta los tiempos de espera de las respuestas.*
13
+
14
+ ## Por qué
15
+
16
+ Los asistentes de IA inventan las cifras económicas de México o usan datos viejos, así que terminas buscándolas a mano en Banxico, INEGI o el SAT para pegarlas en el chat. Con `mcp-mexico`, cualquier cliente [MCP](https://modelcontextprotocol.io) (Claude Desktop, Claude Code, Cursor) las consulta directamente. Cada resultado dice su fuente oficial y la fecha a la que corresponde.
17
+
18
+ ## Herramientas
19
+
20
+ | Herramienta | Qué regresa | Fuente | Token |
21
+ |---|---|---|---|
22
+ | `get_fix_rate` | Tipo de cambio FIX USD/MXN, el más reciente o el de una fecha. En fines de semana y días festivos regresa el del día hábil anterior. | Banxico SIE | `BANXICO_TOKEN` |
23
+ | `get_fix_rate_range` | FIX diario entre dos fechas (máximo 366 días). | Banxico SIE | `BANXICO_TOKEN` |
24
+ | `get_interest_rate` | Tasa objetivo de Banxico, TIIE a 28 días, TIIE de Fondeo o CETES a 28 días; la más reciente o la de una fecha. | Banxico SIE | `BANXICO_TOKEN` |
25
+ | `get_interest_rate_range` | Una de esas tasas entre dos fechas (máximo 366 días). | Banxico SIE | `BANXICO_TOKEN` |
26
+ | `get_inflation` | INPC e inflación mensual, anual y acumulada en el año para un mes (por defecto, el último publicado). | INEGI | `INEGI_TOKEN` |
27
+ | `get_inflation_range` | Lo mismo para cada mes de un rango (máximo 240 meses). | INEGI | `INEGI_TOKEN` |
28
+ | `get_uma` | Valores diario, mensual y anual de la UMA, 2020–2026, con su vigencia. | INEGI | ninguno |
29
+ | `get_isr_table` | Tablas de ISR para personas físicas, 2020–2026: mensual (art. 96 LISR) y anual (art. 152 LISR). | Anexo 8 de la RMF (SAT / DOF) | ninguno |
30
+
31
+ `get_uma` y `get_isr_table` funcionan sin conexión y sin configurar nada. Sus datos vienen dentro del paquete; cada tabla cita el documento del que salió y la fecha en que se verificó.
32
+
33
+ ## Consigue tus tokens
34
+
35
+ Los dos son gratuitos y se obtienen en un par de minutos.
36
+
37
+ 1. **Banxico**: abre la [página de token de la API del SIE](https://www.banxico.org.mx/SieAPIRest/service/v1/token), resuelve el captcha y da clic en "Generar token". El token de 64 caracteres aparece en la misma página.
38
+ 2. **INEGI**: escribe tu correo en el [formulario de token de INEGI](https://www.inegi.org.mx/app/desarrolladores/generatoken/Usuarios/token_Verify). El token llega por correo.
39
+
40
+ Puedes empezar con un solo token, o con ninguno: las herramientas a las que les falta su token regresan un mensaje que explica cómo conseguirlo.
41
+
42
+ ## Instalación
43
+
44
+ Necesitas [uv](https://docs.astral.sh/uv/getting-started/installation/). El servidor corre con `uvx mcp-mexico`; no lo arrancas tú, lo arranca tu cliente MCP.
45
+
46
+ ### Claude Code
47
+
48
+ ```bash
49
+ claude mcp add mcp-mexico -e BANXICO_TOKEN=tu-token -e INEGI_TOKEN=tu-token -- uvx mcp-mexico
50
+ ```
51
+
52
+ ### Claude Desktop
53
+
54
+ Agrega esto a `claude_desktop_config.json` (Settings → Developer → Edit Config) y reinicia Claude Desktop:
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "mcp-mexico": {
60
+ "command": "uvx",
61
+ "args": ["mcp-mexico"],
62
+ "env": {
63
+ "BANXICO_TOKEN": "tu-token",
64
+ "INEGI_TOKEN": "tu-token"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### Cursor
72
+
73
+ Agrega el mismo bloque `mcpServers` a `~/.cursor/mcp.json`.
74
+
75
+ ## Pruébalo
76
+
77
+ Pregúntale a tu asistente:
78
+
79
+ - "¿Cuál es el tipo de cambio FIX de hoy?"
80
+ - "¿Cuál fue la inflación anual de México en diciembre de 2024?"
81
+ - "¿Cuánto son 30 UMAs en pesos este año?"
82
+ - "Con la tabla mensual de ISR 2026, ¿cuánto se retiene a un sueldo de 25,000 pesos?"
83
+
84
+ ## Configuración
85
+
86
+ | Variable | Obligatoria | Descripción |
87
+ |---|---|---|
88
+ | `BANXICO_TOKEN` | Para las herramientas de Banxico | Token de la API del SIE de Banxico. |
89
+ | `INEGI_TOKEN` | Para las herramientas de INEGI | Token de la API de Indicadores de INEGI. |
90
+
91
+ Las respuestas se guardan solo en memoria: hasta 1 hora los valores más recientes, 24 horas los rangos pasados de Banxico y 6 horas la serie del INPC. No se escribe nada en disco.
92
+
93
+ ## Desarrollo
94
+
95
+ ```bash
96
+ uv sync
97
+ uv run pytest
98
+ uv run ruff check . && uv run ruff format --check . && uv run mypy .
99
+ uv run mcp-mexico # arranca el servidor por stdio
100
+ ```
101
+
102
+ Los tests nunca tocan la red: reproducen respuestas grabadas de las APIs reales. Consulta [CONTRIBUTING.md](CONTRIBUTING.md).
103
+
104
+ ## Aviso
105
+
106
+ Este proyecto no está afiliado al Banco de México, al INEGI ni al SAT. Las cifras vienen de sus fuentes públicas, pero revisa la fuente citada antes de usarlas para decisiones fiscales o legales.
107
+
108
+ ## Licencia
109
+
110
+ [MIT](LICENSE) © Diego Tepichin
@@ -0,0 +1,110 @@
1
+ # mcp-mexico
2
+
3
+ MCP server that gives AI agents official Mexican public data: Banxico exchange and interest rates, INEGI inflation, UMA values and ISR tax tables.
4
+
5
+ [![CI](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml/badge.svg)](https://github.com/DiegoTepichin/mcp-mexico/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+
8
+ [Leer en español](README.es.md)
9
+
10
+ ![Claude Code answering questions about the FIX exchange rate, inflation and ISR with mcp-mexico](https://raw.githubusercontent.com/DiegoTepichin/mcp-mexico/main/docs/demo.gif)
11
+
12
+ *Claude Code using `mcp-mexico`. Response wait times are cut from the recording.*
13
+
14
+ ## Why
15
+
16
+ AI assistants either make up Mexican economic figures or use stale ones, so you end up looking them up by hand at Banxico, INEGI or the SAT and pasting them in. `mcp-mexico` lets any [MCP](https://modelcontextprotocol.io) client (Claude Desktop, Claude Code, Cursor) fetch them directly. Every result names its official source and the date it applies to.
17
+
18
+ ## Tools
19
+
20
+ | Tool | What it returns | Source | Token |
21
+ |---|---|---|---|
22
+ | `get_fix_rate` | FIX USD/MXN exchange rate, latest or for a date. On weekends and holidays it returns the previous business day. | Banxico SIE | `BANXICO_TOKEN` |
23
+ | `get_fix_rate_range` | Daily FIX between two dates (max 366 days). | Banxico SIE | `BANXICO_TOKEN` |
24
+ | `get_interest_rate` | Banxico target rate, 28-day TIIE, overnight TIIE de Fondeo or 28-day CETES; latest or for a date. | Banxico SIE | `BANXICO_TOKEN` |
25
+ | `get_interest_rate_range` | One of those rates between two dates (max 366 days). | Banxico SIE | `BANXICO_TOKEN` |
26
+ | `get_inflation` | INPC index and monthly, annual and year-to-date inflation for a month (latest by default). | INEGI | `INEGI_TOKEN` |
27
+ | `get_inflation_range` | The same for each month in a range (max 240 months). | INEGI | `INEGI_TOKEN` |
28
+ | `get_uma` | UMA daily, monthly and annual values, 2020–2026, with validity dates. | INEGI | none |
29
+ | `get_isr_table` | ISR tables for individuals, 2020–2026: monthly (LISR Art. 96) and annual (LISR Art. 152). | Anexo 8 of the RMF (SAT / DOF) | none |
30
+
31
+ `get_uma` and `get_isr_table` work offline with no configuration. Their data ships inside the package; each table cites the document it was taken from and the date it was verified.
32
+
33
+ ## Get your tokens
34
+
35
+ Both are free and take a couple of minutes.
36
+
37
+ 1. **Banxico**: open the [SIE API token page](https://www.banxico.org.mx/SieAPIRest/service/v1/token), solve the captcha and click "Generar token". The 64-character token appears on the page.
38
+ 2. **INEGI**: enter your email in the [INEGI token form](https://www.inegi.org.mx/app/desarrolladores/generatoken/Usuarios/token_Verify). The token arrives by email.
39
+
40
+ You can start with only one token, or none: tools whose token is missing return a message explaining how to get it.
41
+
42
+ ## Install
43
+
44
+ You need [uv](https://docs.astral.sh/uv/getting-started/installation/). The server runs with `uvx mcp-mexico`; you don't start it yourself, your MCP client does.
45
+
46
+ ### Claude Code
47
+
48
+ ```bash
49
+ claude mcp add mcp-mexico -e BANXICO_TOKEN=your-token -e INEGI_TOKEN=your-token -- uvx mcp-mexico
50
+ ```
51
+
52
+ ### Claude Desktop
53
+
54
+ Add this to `claude_desktop_config.json` (Settings → Developer → Edit Config) and restart Claude Desktop:
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "mcp-mexico": {
60
+ "command": "uvx",
61
+ "args": ["mcp-mexico"],
62
+ "env": {
63
+ "BANXICO_TOKEN": "your-token",
64
+ "INEGI_TOKEN": "your-token"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### Cursor
72
+
73
+ Add the same `mcpServers` block to `~/.cursor/mcp.json`.
74
+
75
+ ## Try it
76
+
77
+ Ask your assistant:
78
+
79
+ - "What is today's FIX exchange rate?"
80
+ - "What was annual inflation in Mexico in December 2024?"
81
+ - "How much is 30 UMAs in pesos this year?"
82
+ - "Using the 2026 monthly ISR table, how much tax is withheld on a 25,000 peso salary?"
83
+
84
+ ## Configuration
85
+
86
+ | Variable | Required | Description |
87
+ |---|---|---|
88
+ | `BANXICO_TOKEN` | For Banxico tools | Banxico SIE API token. |
89
+ | `INEGI_TOKEN` | For INEGI tools | INEGI Indicators API token. |
90
+
91
+ Responses are cached in memory only: up to 1 hour for latest values, 24 hours for past Banxico ranges and 6 hours for the INPC series. Nothing is written to disk.
92
+
93
+ ## Development
94
+
95
+ ```bash
96
+ uv sync
97
+ uv run pytest
98
+ uv run ruff check . && uv run ruff format --check . && uv run mypy .
99
+ uv run mcp-mexico # starts the server over stdio
100
+ ```
101
+
102
+ Tests never touch the network: they replay responses recorded from the real APIs. See [CONTRIBUTING.md](CONTRIBUTING.md).
103
+
104
+ ## Disclaimer
105
+
106
+ This project is not affiliated with Banco de México, INEGI or the SAT. Figures come from their public sources, but check the cited source before relying on them for tax or legal decisions.
107
+
108
+ ## License
109
+
110
+ [MIT](LICENSE) © Diego Tepichin
@@ -0,0 +1,68 @@
1
+ [project]
2
+ name = "mcp-mexico"
3
+ version = "0.1.0"
4
+ description = "MCP server that gives AI agents access to official Mexican public data: Banxico, INEGI, UMA and ISR tables."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Diego Tepichin" }]
9
+ requires-python = ">=3.11"
10
+ keywords = ["mcp", "model-context-protocol", "mexico", "banxico", "inegi", "sat", "isr", "uma"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "Intended Audience :: Financial and Insurance Industry",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Programming Language :: Python :: 3.14",
20
+ "Typing :: Typed",
21
+ ]
22
+ dependencies = [
23
+ "httpx>=0.28",
24
+ "mcp>=2.2,<2.3",
25
+ "pydantic>=2",
26
+ ]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/DiegoTepichin/mcp-mexico"
30
+ Repository = "https://github.com/DiegoTepichin/mcp-mexico"
31
+ Issues = "https://github.com/DiegoTepichin/mcp-mexico/issues"
32
+
33
+ [project.scripts]
34
+ mcp-mexico = "mcp_mexico.server:main"
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.sdist]
41
+ include = ["src", "tests", "scripts", "README.md", "README.es.md", "LICENSE", ".env.example"]
42
+
43
+ [tool.ruff]
44
+ line-length = 100
45
+ target-version = "py311"
46
+
47
+ [tool.ruff.lint]
48
+ select = ["E", "W", "F", "I", "B", "UP", "SIM", "RUF", "N", "PT", "ANN", "TC"]
49
+
50
+ [tool.ruff.lint.per-file-ignores]
51
+ "tests/**" = ["ANN"]
52
+
53
+ [tool.mypy]
54
+ strict = true
55
+ python_version = "3.11"
56
+ files = ["src", "tests", "scripts"]
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = ["tests"]
60
+ addopts = "-ra --strict-markers"
61
+
62
+ [dependency-groups]
63
+ dev = [
64
+ "anyio>=4.15.1",
65
+ "mypy>=2.4.0",
66
+ "pytest>=9.1.1",
67
+ "ruff>=0.16.10",
68
+ ]