Skip to main content

MCP server for Uruguay's open government data (national catalog, BCU, INE, Montevideo, gub.uy)

Project description

Bandera de Uruguay

๐Ÿ‡บ๐Ÿ‡พ uruguay-mcp

Structured AI-agent access to Uruguay's open government data
Acceso estructurado de agentes de IA a los datos abiertos del Estado uruguayo

PyPI Python MCP Tests Coverage License

๐ŸŒŽ Espaรฑol ยท English


An MCP server that gives AI agents structured access to Uruguay's open government data โ€” the national data catalog, the Central Bank, the statistics institute, Montevideo's city data & realtime transport, and the gub.uy service catalog โ€” behind a single meta-discovery layer.

โœจ Why a meta-discovery layer?

Instead of flooding the model with hundreds of tool definitions, the server exposes five meta-tools. The model searches for what it needs, then invokes the matching data tool by name. The prompt-visible surface stays constant no matter how many data sources are added.

Meta-tool Purpose
discover_tools(query, module?, limit?) Rank data tools relevant to a natural-language need (returns their argument schemas)
call_tool(name, arguments) Invoke a data tool by name (validates arguments)
list_modules() List data-source modules and their tool counts
plan_query(goal) Surface candidate tools for a multi-step goal
execute_batch(calls) Run several calls concurrently with per-call error isolation

Every tool returns a unified envelope: { "_meta": { source, cached, lang, timestamp }, "data": ... }.

At a glance: 5 meta-tools + 49 data tools across 10 modules, plus 29 prompts and 19 resources.

๐Ÿ“š Data sources (modules)

Module Source Protocol Tools
๐Ÿ›๏ธ catalogodatos catalogodatos.gub.uy โ€” national CKAN catalog (~2680 datasets, 72 orgs) + DataStore SQL CKAN REST 9
๐Ÿ’ต bcu Banco Central del Uruguay โ€” exchange rates SOAP (zeep) 4
๐Ÿ“Š ine Instituto Nacional de Estadรญstica โ€” ANDA / microdata REST 3
๐ŸŒ gubuy gub.uy public API / service catalog CKAN REST 4
๐ŸšŒ montevideo Intendencia de Montevideo โ€” city CKAN + realtime transport CKAN + REST 11
๐Ÿ—„๏ธ datastore Cross-source SQLite workspace โ€” load CSV/CKAN data, run read-only SQL JOINs local SQLite 4
๐Ÿ›’ acce Agencia de Compras y Contrataciones del Estado โ€” public procurement (OCDS) OCDS REST/RSS + CKAN 4
โš–๏ธ impo IMPO โ€” legislation, normativa & Diario Oficial REST (JSON) 3
๐ŸŒฆ๏ธ inumet Instituto Uruguayo de Meteorologรญa โ€” stations, forecast & alerts REST + HTML 3
๐Ÿ›๏ธ parlamento Parlamento del Uruguay โ€” datasets, attendance & activity (CKAN-backed) CKAN REST 4

The transport surface of montevideo needs OAuth2 credentials (URUGUAY_MCP_MVD_CLIENT_ID / URUGUAY_MCP_MVD_CLIENT_SECRET); without them the transport tools return a typed validation_error while the CKAN tools work unauthenticated.

๐Ÿงฉ Prompts & Resources

Each module also registers reusable prompts (parameterized Spanish instruction templates) and resources (static reference docs under the uru://<module>/<path> URI scheme), exposed natively through FastMCP.

  • 29 prompts โ€” e.g. bcu_cotizacion_dolar_hoy, catalogo_buscar_por_tema, ine_buscar_estudios, montevideo_proximo_bus, datastore_unir_dos_fuentes, acce_analizar_compra, impo_consultar_norma, inumet_clima_actual.
  • 19 resources โ€” e.g. uru://bcu/codigos-moneda, uru://catalogodatos/guia-de-uso, uru://montevideo/credenciales-transporte, uru://acce/glosario-ocds, uru://impo/esquema, uru://inumet/variables.

See EXAMPLES.md for end-to-end usage scenarios, including cross-source ones via plan_query / execute_batch and SQL JOINs through the datastore module.

๐Ÿš€ Quick start

# Run directly from PyPI (once published)
uvx uruguay-mcp

# โ€ฆor install it
pip install uruguay-mcp        # or: uv pip install uruguay-mcp
uruguay-mcp

One-command install into Claude

uruguay-mcp install

Merges the server into Claude Desktop's config (preserving existing mcpServers and unrelated keys) and prints a ready-to-paste snippet for Claude Code / Cursor. Restart the client afterwards.

Claude Desktop config (manual)

{
  "mcpServers": {
    "uruguay-mcp": { "command": "uruguay-mcp" }
  }
}

Run options

uruguay-mcp                          # stdio (default)
uruguay-mcp --transport sse --port 8000
uruguay-mcp --modules catalogodatos,bcu   # load only some modules
uruguay-mcp --verbose                # INFO logs   (--debug for DEBUG)

โš™๏ธ Configuration

All via URUGUAY_MCP_* environment variables:

Variable Default Meaning
URUGUAY_MCP_LANG es Language for human-facing strings (es/en)
URUGUAY_MCP_HTTP_TIMEOUT 30 HTTP timeout (seconds)
URUGUAY_MCP_CACHE_TTL 900 Response cache TTL (seconds)
URUGUAY_MCP_RATE_LIMIT_RPS 5 Max requests/sec per host
URUGUAY_MCP_MODULES (all) Comma-separated module allowlist
URUGUAY_MCP_MVD_CLIENT_ID (unset) OAuth2 client id for the Montevideo transport API
URUGUAY_MCP_MVD_CLIENT_SECRET (unset) OAuth2 client secret for the Montevideo transport API

๐Ÿ—๏ธ Architecture

src/uruguay_mcp/
โ”œโ”€โ”€ server.py            # FastMCP wiring; meta-tools + registered prompts + resources
โ”œโ”€โ”€ cli.py               # `uruguay-mcp` / `uruguay-mcp install`; -v/--debug logging
โ”œโ”€โ”€ meta/                # discovery layer
โ”‚   โ”œโ”€โ”€ tools.py         # the 5 meta-tools
โ”‚   โ””โ”€โ”€ search.py        # BM25-lite ranking over the registry
โ”œโ”€โ”€ shared/              # reused by every module
โ”‚   โ”œโ”€โ”€ config.py        # env-driven settings (URUGUAY_MCP_*)
โ”‚   โ”œโ”€โ”€ http.py          # async client: retries (tenacity) + per-host rate limit
โ”‚   โ”œโ”€โ”€ cache.py         # async TTL cache
โ”‚   โ”œโ”€โ”€ envelope.py      # unified {_meta, data} response (+ UTC timestamp)
โ”‚   โ”œโ”€โ”€ i18n.py          # es/en messages
โ”‚   โ”œโ”€โ”€ errors.py        # typed, localized errors
โ”‚   โ””โ”€โ”€ registry.py      # tool/prompt/resource registry; @tool/@prompt/@resource
โ””โ”€โ”€ modules/             # one self-contained package per data source
    โ”œโ”€โ”€ catalogodatos/   โ”œโ”€โ”€ bcu/          โ”œโ”€โ”€ ine/
    โ”œโ”€โ”€ gubuy/           โ”œโ”€โ”€ montevideo/   โ”œโ”€โ”€ datastore/
    โ”œโ”€โ”€ acce/            โ”œโ”€โ”€ impo/         โ”œโ”€โ”€ inumet/
    โ””โ”€โ”€ parlamento/

Each module package is independent (constants ยท schemas ยท client ยท tools ยท optional prompts/resources). Importing the package self-registers everything it offers.

๐Ÿ› ๏ธ Development

uv venv && uv pip install -e ".[dev]"

uv run pytest                  # 129 unit tests (HTTP mocked, offline) ยท 88% coverage
uv run pytest -m integration   # hits live government APIs
uv run ruff check src tests
uv run pyright

๐Ÿ™Œ Acknowledgements

Built on data published by AGESIC, BCU, INE and the Intendencia de Montevideo under Uruguay's open-data law (Nยบ 18.381). This project is an independent client and is not affiliated with those institutions.

๐Ÿ“„ License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uruguay_mcp-0.2.0.tar.gz (209.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uruguay_mcp-0.2.0-py3-none-any.whl (116.7 kB view details)

Uploaded Python 3

File details

Details for the file uruguay_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: uruguay_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 209.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for uruguay_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 30588f6801eb96c062ff68cf9c0f4994b72fe2e4547af61e9912fc69b78a2b1a
MD5 98a56fa507c02e8ad5f91de4177f6e88
BLAKE2b-256 7b79ad78418bc7d657b98f3b4ad7ddf254f0f71d51734c3b7d5a348bf0b159ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for uruguay_mcp-0.2.0.tar.gz:

Publisher: publish.yml on Ellweb3/uruguay-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uruguay_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uruguay_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 116.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for uruguay_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f70de582742432c987d052422210ae19deec45fb21fd33df0288bdb56cfd689b
MD5 41070c7b4a97f4370fefb50824b67811
BLAKE2b-256 3756a1a902a604bbe20d377c66ad06c4bfbf8b19d3c9a4259ee34f6d9e8886c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for uruguay_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Ellweb3/uruguay-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page