Skip to main content
Glama
opedrosoares

MCP Compras.gov.br

by opedrosoares

MCP Compras.gov.br

MCP server that brings together in a single package the public APIs of the Compras.gov.br ecosystem, aimed at analysts and technicians in the areas of procurement planning and contract execution.

Supports the preparation of:

  • Preliminary Technical Studies (ETP)

  • Terms of Reference (TR)

  • Price research in the IN SEGES/ME 65/2021 standard

  • Checking supplier sanctions (CEIS, CNEP, CEAF)

  • Analysis of price registration minutes (ARP) for adherence (piggybacking)

  • Inter-agency benchmarking via the National Public Procurement Portal (PNCP)

Covered APIs (v1)

API

Base URL

Authentication

Dados Abertos Compras

dadosabertos.compras.gov.br

public

PNCP — National Portal

pncp.gov.br/api/consulta

public

Transparency Portal (CGU)

api.portaldatransparencia.gov.br

free key

Comprasnet Contracts

contratos.comprasnet.gov.br/api

public (routes /api/*)

⚠️ Operational notice

  • Family /modulo-uasg/* dead on Dados Abertos upstream: confirmed via direct probe in 2026-05 — 1_consultarUasg, 2_consultarOrgao and CSV variants return HTTP 404 ("Resource not found") despite being listed in the official swagger. SEGES server bug with no possible fix via MCP. The 5 affected tools (compras_uasg_listar/_consultar/_buscar + compras_orgao_listar/_consultar) detect the 404 and return an educational payload with alternatives: compras_pncp_orgao_unidades(cnpj) to resolve units by CNPJ (stable, may take 10-30s), or compras_contrato_comprasnet_por_uasg(uasg) to list UGs with active contracts.

  • UASG filter in /modulo-legado/*: auctions and bids have a confirmed Hibernate bug upstream — the swagger documents co_uasg/uasg but the attribute does not exist in the view model. The parameters were removed from the tools compras_legado_pregoes_listar and compras_legado_licitacoes_listar; to filter by UASG, do it client-side on the return.

  • Transparency Portal (CGU): the CGU server is protected by AWS WAF "Human Verification" that can block API calls even with a valid key (HTTP 405 + HTML page). When this occurs, all tools compras_sancao_* + the composite compras_checar_sancoes_fornecedor * the sanction branches in compras_perfil_fornecedor_completo will return an error. It is an upstream problem — there is no fix on the MCP side.

  • Comprasnet /api/contrato/ug/{uasg}: the endpoint does not support pagination and returns the complete list in a single response (may exceed 1 MB). The tool compras_contrato_comprasnet_por_uasg applies client-side slicing with full payload cache to avoid flooding the LLM.

  • CATMAT broken textual search: the descricao filter (and variants nome, termo, q) of /modulo-material/4_consultarItemMaterial returns the entire CATMAT universe (~340k items). Use structural filters via compras_catmat_listar_grupos_listar_classes_buscar with codigo_grupo/codigo_classe. The tool emits _aviso_filtro when it detects the entire universe.

Related MCP server: narajangteo-pro

Installation

python build_mcpb.py     # gera dist/compras.mcpb
open dist/compras.mcpb   # Claude Desktop instala

Local (development)

uv sync
uv run compras-mcp

Remote (Railway via Docker)

railway login && railway link
railway add redis                                # cache compartilhado
railway variables --set "TRANSPARENCIA_API_KEY=..."
railway up
railway domain                                   # https://mcp-compras.up.railway.app/mcp

Configuration

Free registration of the Transparency key: https://api.portaldatransparencia.gov.br/api-de-dados/cadastrar-email

See .env.example for all configurable variables (timeouts, cache TTLs, base URLs).

Tools (85 total)

Grouped by functional domain:

Domain

Tools

Coverage

Composite (agent)

5

pesquisar_precos_para_etp (IN SEGES 65/2021 with IQR), checar_sancoes_fornecedor, montar_dossie_arp, buscar_contratacoes_similares, perfil_fornecedor_completo

Catalog (CATMAT/CATSER)

7

Groups/classes/items, textual search

Price research

4

Material/service, detail by purchase

Planning (PGC + PCA)

8

PGC SISG, PCA PNCP (federal + states + municipalities)

Price Registration Minutes

8

List, balance, adherences, participating units, PNCP

Procurements (14.133 + legacy)

12

Law 14.133, Law 8.666, RDC, waivers

Contracts

12

Open Data + Comprasnet (guarantees, invoices, occurrences, tax auditors, commitments, schedule)

Suppliers

4

Registration, impediments, contracts by item

Sanctions (Transparency/CGU)

5

CEIS, CNEP, CEAF, CEPIM, leniency agreements

PNCP

9

Procurements (publication, proposal, update), contracts, modalities

Organizations

6

UASG (list/consult/search), agencies, PNCP units

Indicators

2

Consolidated, by period

Diagnostics

1

compras_versao

The complete list is in manifest.json or via tools/list in the MCP Inspector.

Typical flows

ETP for acquiring ergonomic chairs:

  1. compras_catmat_buscar with termo="cadeira ergonomica" → get codigo_item_catalogo

  2. compras_pesquisar_precos_para_etp (composite) with tipo="material" → median/mean/stddev + IQR discard

  3. compras_pgc_por_catalogo to see what other agencies planned to buy

  4. compras_arp_listar with apenas_vigentes=True → active minutes for possible adherence

Supplier analysis before homologation:

  1. compras_perfil_fornecedor_completo (composite) with the CNPJ — one call returns registration + sanctions + active contracts

Inventory of contracts to renew:

  1. compras_contratos_listar_por_fim_vigencia with data_fim_vigencia near

  2. For each relevant contract: compras_contrato_historico_aditivos, compras_contrato_ocorrencias

Internal patterns

  • Standard envelope of the listar_* tools: {resultado, _pagina_atual, _total_paginas, _total_registros, _proxima_pagina, _cache_hit, _latency_ms}.

  • SSoT of descriptions: parameter descriptions live in src/compras_mcp/schemas.py; tools read via _helpers.desc(Model, "campo"). Test in tests/test_server.py detects drift.

  • LGPD: CPFs masked as 123.***.***-45; adjust with INCLUIR_CPF_COMPLETO=true. Affected tools include _aviso_lgpd in the payload.

  • Cache: TTL+LRU in memory (default) or Redis when REDIS_URL is set. Each domain has its prefix (CATALOGO, PRECOS, ATAS, etc.) — adjustable via CACHE_<PREFIX>_TTL and CACHE_<PREFIX>_MAX_SIZE.

  • Dates: 3 formats per API (YYYY-MM-DD, yyyyMMdd, YYYY-MM-DD HH:mm:ss) transparently converted by format_date(value, flavor).

  • Framework: FastMCP 2.x. Transport detected by PORT — present → HTTP on 0.0.0.0:$PORT, absent → stdio.

Status

v0.2.0 — 85 tools registered and ready for end-to-end testing with Claude Desktop and Railway.

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    -
    maintenance
    Connects AI agents to 28 Brazilian public APIs, providing over 200 tools to access data on economy, legislation, transparency, and the judiciary. It enables complex queries and cross-referencing of government datasets like IBGE, the Central Bank, and the National Congress through natural language.
  • A
    license
    A
    quality
    D
    maintenance
    Integrates 6 Korean public procurement APIs to search, analyze, and manage procurement data using natural language.
    8
    3
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    razilian public procurement (PNCP) and Federal Revenue CNPJ data for any MCP client. 18 tools covering bids, contracts, atas de registro de preço, annual procurement plans, CNPJ enrichment, plus temporal aggregation and period comparison. MIT licensed, maintained by Licinexus under Law 14.133/2021.
    18
    94
    75
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Allows AI assistants to query public procurement opportunities, purchase orders, and government entities from Chile's Mercado Público (ChileCompra) API in real time.
    12
    18
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Consolidated lookup of a company at the Federal Audit Court (TCU) from the CNPJ, gathering sanctions

  • Looks up records of a person or company at the Federal Comptroller General (CGU) from the CPF or CNP

  • Chile Government Procurement MCP — Mercado Público / ChileCompra (keyless-ish).

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/opedrosoares/MCP_Compras'

If you have feedback or need assistance with the MCP directory API, please join our Discord server