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, spatial data (IDE), education, health, social programs, government news, 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 + 71 data tools across 15 modules, plus 43 prompts and 28 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
๐Ÿ—บ๏ธ ide IDE Uruguay (AGESIC) โ€” spatial data: WFS layers, cadastral parcels & geocoding WFS 2.0 + REST 5
๐ŸŽ“ educacion ANEP / education โ€” datasets & school directories (national CKAN, org=anep) CKAN REST 3
๐Ÿฅ salud Salud (MSP / FNR) โ€” health datasets, clinics & medication spending CKAN REST 5
๐Ÿค mides MIDES โ€” social programs & the Guรญa de Recursos service directory CKAN + HTML 4
๐Ÿ“ฐ noticias gub.uy government news โ€” latest releases & full-text search HTML scrape 2

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.

  • 43 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, ide_consultar_catastro, salud_consultar_medicamentos, noticias_ultimas.
  • 28 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, uru://ide/capas-destacadas, uru://salud/fuentes, uru://mides/guia-recursos.

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/      โ”œโ”€โ”€ ide/          โ”œโ”€โ”€ educacion/
    โ”œโ”€โ”€ salud/           โ”œโ”€โ”€ mides/        โ””โ”€โ”€ noticias/

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                  # 204 unit tests (HTTP mocked, offline) ยท 89% 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.3.0.tar.gz (251.8 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.3.0-py3-none-any.whl (172.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uruguay_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 251.8 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.3.0.tar.gz
Algorithm Hash digest
SHA256 85407fc97e671f2f8e847343f715e944b14d98fae8c05eba402a79da23d883d6
MD5 5f78f57cbf6d37d126114b46e3f33d08
BLAKE2b-256 f5161535f4067381e873d696518a5fc42a8ce99881ea5b6ac82454473482e014

See more details on using hashes here.

Provenance

The following attestation bundles were made for uruguay_mcp-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: uruguay_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 172.4 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 293dc02f387d8fc66221b6d8c85b58bee57e6a14ea54afb219f41d3bc199a0c8
MD5 40cb235400692672fed957835f94b943
BLAKE2b-256 9800f2a065b7ff6b6f60dce8b51173a54685ea4f971ae970de0560e9145ce4d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for uruguay_mcp-0.3.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