MCP Compras.gov.br
MCP Compras.gov.br
MCP 服务器,将 Compras.gov.br 生态系统的公共 API 整合到一个包中,面向 采购规划 和 合同执行 领域的分析师和技术人员。
支持编制:
初步技术研究 (ETP)
参考条款 (TR)
按 IN SEGES/ME 65/2021 标准进行价格调研
供应商制裁检查 (CEIS, CNEP, CEAF)
价格登记协议 (ARP) 分析,用于加入 (carona)
通过国家公共采购门户 (PNCP) 进行跨机构基准比较
覆盖的 API (v1)
API | 基础 URL | 认证 |
Dados Abertos Compras |
| 公开 |
PNCP — Portal Nacional |
| 公开 |
Portal da Transparência (CGU) |
| 免费密钥 |
Comprasnet Contratos |
| 公开 (路由 |
⚠️ 操作警告
上游 Dados Abertos 中
/modulo-uasg/*系列已失效:通过 2026-05 的直接探测确认 —1_consultarUasg、2_consultarOrgao及 CSV 变体返回 HTTP 404("Resource not found"),尽管在官方 swagger 中仍有列出。这是 SEGES 服务器的错误,MCP 无法修复。受影响的 5 个工具(compras_uasg_listar/_consultar/_buscar+compras_orgao_listar/_consultar)检测到 404 并返回包含替代方案的教育性负载:compras_pncp_orgao_unidades(cnpj)用于通过 CNPJ 解析单位(稳定,可能需要 10-30 秒),或compras_contrato_comprasnet_por_uasg(uasg)用于列出有有效合同的 UG。/modulo-legado/*中的 UASG 过滤器:招标和采购存在上游确认的 Hibernate 错误 — swagger 记录了co_uasg/uasg,但该属性在视图模型中不存在。这些参数已从工具compras_legado_pregoes_listar和compras_legado_licitacoes_listar中移除;如需按 UASG 过滤,请在返回结果中进行客户端过滤。Portal da Transparência (CGU):CGU 服务器受 AWS WAF "Human Verification" 保护,即使使用有效密钥也可能阻止 API 调用(HTTP 405 + HTML 页面)。发生这种情况时,所有
compras_sancao_*工具 + 复合工具compras_checar_sancoes_fornecedor* 以及compras_perfil_fornecedor_completo中的制裁分支将返回错误。这是上游问题 — MCP 端无法修复。Comprasnet
/api/contrato/ug/{uasg}:该端点不支持分页,并在单个响应中返回完整列表(可能超过 1 MB)。工具compras_contrato_comprasnet_por_uasg应用客户端切片,并缓存完整负载以避免淹没 LLM。CATMAT 文本搜索损坏:
/modulo-material/4_consultarItemMaterial的descricao过滤器(以及变体nome、termo、q)返回整个 CATMAT 宇宙(约 34 万项)。请通过compras_catmat_listar_grupos→_listar_classes→_buscar使用结构过滤器,并指定codigo_grupo/codigo_classe。当检测到整个宇宙时,工具会发出_aviso_filtro。
Related MCP server: narajangteo-pro
安装
桌面扩展 (.mcpb) — 推荐用于 Claude Desktop
python build_mcpb.py # gera dist/compras.mcpb
open dist/compras.mcpb # Claude Desktop instala本地 (开发)
uv sync
uv run compras-mcp远程 (通过 Docker 在 Railway 上)
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配置
免费注册透明度密钥:https://api.portaldatransparencia.gov.br/api-de-dados/cadastrar-email
查看 .env.example 了解所有可配置变量(超时、缓存 TTL、基础 URL)。
工具 (共 85 个)
按功能领域分组:
领域 | 工具数 | 覆盖范围 |
复合 (代理) | 5 |
|
目录 (CATMAT/CATSER) | 7 | 组/类/项、文本搜索 |
价格调研 | 4 | 材料/服务、按采购查看详情 |
规划 (PGC + PCA) | 8 | PGC SISG、PCA PNCP (联邦 + 州 + 市) |
价格登记协议 | 8 | 列出、余额、加入、参与单位、PNCP |
采购 (14.133 + 旧版) | 12 | 第 14.133 号法律、第 8.666 号法律、RDC、豁免 |
合同 | 12 | Dados Abertos + Comprasnet (担保、发票、事件、监管、拨款、时间表) |
供应商 | 4 | 注册、限制、按项目合同 |
制裁 (Transparência/CGU) | 5 | CEIS、CNEP、CEAF、CEPIM、宽大协议 |
PNCP | 9 | 采购 (发布、提案、更新)、合同、模式 |
组织 | 6 | UASG (列出/查询/搜索)、机构、PNCP 单位 |
指标 | 2 | 汇总、按期间 |
诊断 | 1 |
|
完整列表见 manifest.json 或通过 MCP Inspector 的 tools/list。
典型流程
采购人体工学椅的 ETP:
compras_catmat_buscar使用termo="cadeira ergonomica"→ 获取codigo_item_catalogocompras_pesquisar_precos_para_etp(复合) 使用tipo="material"→ 中位数/平均值/标准差 + IQR 剔除compras_pgc_por_catalogo查看其他机构计划采购的内容compras_arp_listar使用apenas_vigentes=True→ 有效协议,用于可能的加入
在批准前分析供应商:
compras_perfil_fornecedor_completo(复合) 使用 CNPJ — 一次调用返回注册 + 制裁 + 有效合同
待续签合同清单:
compras_contratos_listar_por_fim_vigencia使用接近的data_fim_vigencia对于每个相关合同:
compras_contrato_historico_aditivos、compras_contrato_ocorrencias
内部模式
标准信封 用于
listar_*工具:{resultado, _pagina_atual, _total_paginas, _total_registros, _proxima_pagina, _cache_hit, _latency_ms}。描述的唯一真实来源 (SSoT):参数描述位于
src/compras_mcp/schemas.py;工具通过_helpers.desc(Model, "campo")读取。测试tests/test_server.py检测漂移。LGPD:CPF 被屏蔽为
123.***.***-45;通过INCLUIR_CPF_COMPLETO=true调整。受影响的工具在负载中包含_aviso_lgpd。缓存:内存中的 TTL+LRU(默认)或设置
REDIS_URL时使用 Redis。每个领域有自己的前缀(CATALOGO、PRECOS、ATAS 等)— 可通过CACHE_<PREFIX>_TTL和CACHE_<PREFIX>_MAX_SIZE调整。日期:每个 API 有 3 种格式(
YYYY-MM-DD、yyyyMMdd、YYYY-MM-DD HH:mm:ss),通过format_date(value, flavor)透明转换。框架:FastMCP 2.x。通过
PORT检测传输方式 — 存在时 → HTTP 在0.0.0.0:$PORT,不存在时 → stdio。
状态
v0.2.0 — 已注册 85 个工具,准备好在 Claude Desktop 和 Railway 上进行端到端测试。
Maintenance
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
- Alicense-quality-maintenanceConnects 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.
- AlicenseAqualityDmaintenanceIntegrates 6 Korean public procurement APIs to search, analyze, and manage procurement data using natural language.83MIT

licinexus-mcpofficial
AlicenseAqualityAmaintenancerazilian 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.189475MIT- AlicenseAqualityDmaintenanceAllows AI assistants to query public procurement opportunities, purchase orders, and government entities from Chile's Mercado Público (ChileCompra) API in real time.12181MIT
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).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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