@pipeworx/portugal-tenders

Connect: https://pipeworx.io/mcp — every tool in the catalog, including @pipeworx/portugal-tenders’s. Install: one-click buttons

Connect to just the @pipeworx/portugal-tenders pack

https://gateway.pipeworx.io/portugal-tenders/mcp — only @pipeworx/portugal-tenders’s own tools, nothing else in the catalog.

No MCP client? Skip the connection: POST https://gateway.pipeworx.io/v1/tools/search_packs {"query":"..."} to find a tool below, GET /v1/tools/<name> for its schema, POST the same URL with arguments for the data — see For AI agents.

Tools: 4

Portuguese public-procurement tender announcements and awarded contracts from IMPIC (Instituto dos Mercados Públicos, do Imobiliário e da Construção), Portugal’s public-procurement regulator. Fleet #3111.

Tools

  • pt_announcement_search(query?, cpv?, buyer?, date_from?, date_to?, limit?) — search tender announcements by free-text keyword (notice title), CPV classification code/prefix, contracting-authority (buyer) name substring, and a publish-date range (defaults to the last 90 days). Returns each notice’s internal id, IMPIC notice id, buyer, title, notice type, contract type(s), base amount (EUR), CPV, publish date, and proposal deadline.
  • pt_announcement_detail(id) — the full record for one announcement by the internal id returned from pt_announcement_search, including the buyer’s NIF tax number, procedure model, lot descriptions, and a link to the official notice document.
  • pt_contract_search(query?, buyer?, supplier?, amount_min?, amount_max?, date_from?, date_to?, limit?) — search awarded contracts by free-text keyword (contract title), buyer (adjudicante) name substring, awarded supplier (adjudicatário) name substring, a contract-amount range (EUR), and a publish-date range. Returns each contract’s id, title, buyer, supplier, amount, contract type(s), CPV, publish date, and signing date.
  • pt_contract_detail(idcontrato) — the full record for one contract by its id, including buyer/supplier NIF tax numbers, full description, base procurement price, execution deadline and location(s), procedure type, and the legal regime cited.

Every response carries source, source_url, licence, data_as_of, and (on search / no-match responses) the relevant *_window_from/*_window_to pair — the span this pack currently holds for that dataset — so a caller can tell “nothing on this topic” apart from “that date range isn’t loaded”.

Auth

Keyless. The tools answer only through the Pipeworx gateway, which holds the data; a standalone install has no data to read, and every tool returns a clear “store is not bound in this runtime” error there instead of an empty list.

Data sources

  • IMPIC (Instituto dos Mercados Públicos, do Imobiliário e da Construção) — Portugal’s public-procurement regulator, which runs the national tender register, Portal BASE. Fleet #3088 looked at reaching BASE directly and found two live paths, neither usable without more work: BASE’s own legacy REST API resets every connection mid-response, and IMPIC’s newer API needs account registration plus a token (Bruce ruled “register Portugal” on 2026-10-15 for that — separate, ongoing, and this pack does not wait on it). IMPIC’s own documentation says that newer API returns the SAME FIELDS as the files it already publishes as open data, organization IMPIC, on Portugal’s national open-data portal (https://dados.gov.pt/organizations/impic-i-p-instituto-dos-mercados-publicos-do) — one dataset of tender announcements and one of awarded contracts, each split into a file per calendar year, refreshed weekly. Because neither dataset offers server-side search, this pack builds a store from them (scripts/portugal-tenders/load-data.mjs) rather than proxying per request, per Bruce’s standing rule (2026-09-23): when live doesn’t serve, build the store yourself, with a refresh path and data_as_of on every response.

    Licence (quoted verbatim from dados.gov.pt’s own dataset API, checked live 2026-10-15): both datasets report "license": "other-pd", "license_title": "Outra (Domínio Público)" — public domain, which explicitly permits reuse and redistribution. This is not a case the “mirror needs a reuse grant” rule (mirror-needs-grant-proxy-does-not, Bruce, 2026-09-08) holds for; the grant is already in the licence. Attribution is carried in every response’s source/source_url fields.

Known gaps — read before extending this pack

This pack holds a ROLLING TWO-YEAR WINDOW (current + previous calendar year), not IMPIC’s full 2012-2026 history. A full year of awarded contracts alone runs ~190,000 rows / ~340MB of uncompressed JSON (measured live for the partial 2026 year, 2026-10-15); fifteen years of that would run into the GBs, dwarfing what one pack’s D1 database should carry. pt_announcement_search / pt_contract_search report their loaded window (ann_window_from/ann_window_to, contract_window_from/ contract_window_to) on every no-match response, so a caller can tell a genuinely empty result apart from a date outside what is loaded.

No accent/diacritic folding on buyer / supplier / query filters. A search for buyer: "camara" will NOT match “Câmara Municipal de Lisboa” — the match is a plain case-insensitive substring, and “a” is not treated as equivalent to “â”/“ã”. Searching with the accented spelling (as IMPIC records it) works. Fixable later with a normalized/folded column if this turns out to cost real matches.

IMPIC’s own announcement id (IdIncm) is not reliably unique — a “-1” sentinel marks notices published only through a regional gazette (e.g. the Azores’ JORAA) rather than through Diário da República, and several hundred share that sentinel within a single year. pt_announcement_detail therefore keys on a synthetic internal id this pack assigns, returned as id from pt_announcement_search, not on IdIncm itself (which is still returned, for reference, and is null in the response whenever the underlying value is the “-1” sentinel).

Only announcements and awarded contracts are built. IMPIC also publishes a contract-amendments dataset and a buyer-directory dataset on the same open-data portal; not built here, to keep this pack’s scope to what fleet #3111 asked for (announcement search, contract search, detail). A later change can add either without touching the schema above.

Refreshing the data

node scripts/portugal-tenders/load-data.mjs --years 2025,2026 [--retain-from-year 2025] [--init-schema on the very first run] — resolves each requested year’s announcement and contract resource LIVE through dados.gov.pt’s own dataset API (never a hard-coded dated path — the underlying storage URL carries a timestamp segment that changes on every weekly IMPIC refresh), downloads and streams them, and loads D1: announcements wipe-and-reload a whole year at a time (no reliable natural key — see “Known gaps”); contracts upsert (INSERT OR REPLACE) keyed by idcontrato, so re-loading a year already present just refreshes rows IMPIC updated. Needs wrangler logged in to the Pipeworx Cloudflare account and the unzip CLI.

The GitHub workflow .github/workflows/portugal-tenders-refresh.yml runs this weekly, re-pulling the current and previous calendar year and rolling --retain-from-year so the table does not grow without bound.

Pre-deploy smoke testing (no production D1 needed)

node --experimental-strip-types scripts/portugal-tenders/build-local-sqlite.mjs \
  --year 2026 --ann <a downloaded anuncios2026.json> --contract <its extracted Contratos2026.json> \
  --out /tmp/portugal-tenders.sqlite
node --experimental-strip-types scripts/portugal-tenders/smoke-local.mjs /tmp/portugal-tenders.sqlite

Exercises the pack’s real callTool() against a local SQLite file built from real IMPIC year files via a D1Like adapter — same shape as scripts/italy-tenders/{build-local-sqlite,smoke-local}.mjs.

Tools

  • pt_announcement_search — Search PORTUGUESE public-procurement tender ANNOUNCEMENTS (contract notices) published through Portal BASE (base.gov.pt), run by IMPIC (Instituto dos Mercados Públicos, do Imobiliário e da Construção)
  • pt_announcement_detail — Fetch one PORTUGUESE tender announcement by the internal “id” returned from pt_announcement_search. Returns the full record: IMPIC notice id, buyer (with NIF tax number), notice type, contract type(s)
  • pt_contract_search — Search PORTUGUESE public-procurement AWARDED CONTRACTS published through Portal BASE (base.gov.pt), run by IMPIC. Filter by free-text keyword (matched against the Portuguese contract title), buyer (ad
  • pt_contract_detail — Fetch one PORTUGUESE awarded contract by its “idcontrato” (returned from pt_contract_search). Returns the full record: buyer and supplier (with NIF tax numbers), full title and description, amount, ba

Tools

  • pt_announcement_detail — Fetch one PORTUGUESE tender announcement by the internal id returned from pt_announcement_search. Returns the full record: IMPIC notice id, buyer (with NIF tax number), notice type, contract type(s),
  • pt_announcement_search — Search PORTUGUESE public-procurement tender ANNOUNCEMENTS (contract notices) published through Portal BASE (base.gov.pt), run by IMPIC (Instituto dos Mercados Públicos, do Imobiliário e da Construção)
  • pt_contract_detail — Fetch one PORTUGUESE awarded contract by its idcontrato (returned from pt_contract_search). Returns the full record: buyer and supplier (with NIF tax numbers), full title and description, amount, base
  • pt_contract_search — Search PORTUGUESE public-procurement AWARDED CONTRACTS published through Portal BASE (base.gov.pt), run by IMPIC. Filter by free-text keyword (matched against the Portuguese contract title), buyer (ad

Regenerated from source · build October 15, 2026