Skip to main content
Glama
charlesmmorais

conformidade-pbtr-mcp

conformidade-pbtr-mcp

Automated compliance analysis of Basic Projects and Terms of Reference (MCP server, pt-BR).

Tests License: MIT Python 3.11+

An MCP server that analyzes Basic Projects (PB) and Terms of Reference (TR) against the SERPRO review roadmap. You upload the PDF and say "run a compliance analysis of the PB"; the server returns the compliance index, prioritized pending items, and the reports in DOCX, XLSX, PDF, Markdown, and JSON.

A project by SERPRO — Brazil's Federal Data Processing Service.

What is checked

Layer

Check

Regulatory checklist

86 rules derived from the [TI] PB/TR roadmap — sections 1 through 8, Statements and Annexes

Numbering

jumps (1 → 3), duplicate items, orphaned sub-items, items out of order, missing required sections

Tables and values

minimum columns, Qtd × Cost = Price, closing of totals, monthly consistency, written amount × figure, overall text amount × table amount

Text review

20 deterministic rules for recurring errors in administrative documents, plus the Portuguese review performed by the model that calls the MCP

The checklist rules are conditional. The server infers the procurement context — bidding, direct contracting, non-competitive contracting, service, good, consulting, training, tickets, subscription, RP, hardware/currency, term longer than 60 months — and applies only the relevant branches of the roadmap. The rest are shown as Not applicable, with the reason explained. Without it, a hardware PB would flood its dozens of false "not compliant" warnings for not carrying the mandatory consulting requirements.

Five statuses, not two

Conforming / non-conforming would not be enough: several roadmap items require human heuristic judgment ("check whether there is coherence between them"). The report therefore uses:

Status

Meaning

Compliant

evidence located in the document

Non-compliant

no occurrence located

Attention

a point was addressed, but incomplete — the list of what's missing comes with it

Verify manually

evidence present; the merits require a human

Not applicable

the document context does not trigger the rule

Related MCP server: Tri-Tender Pricing MCP

How the Portuguese review works

The text is reviewed by the model that called the MCP — it already has the document in context, so it doesn't make sense for the server to open a second conversation with another model just to re-read the same text. The server handles deterministic mapping and returns the segmented text for the agent to read.

That's why the flow is three steps, which the agent can chain itself:

1. analisar_conformidade      → checklist, numeração, tabelas, valores
                                 (+ regras determinísticas de revisão)
2. obter_texto_para_revisao   → o agente lê e revisa o português
3. registrar_revisao_textual  → apontamentos entram e os relatórios saem

Each agent finding only enters the report if the quoted excerpt literally exists in the document. The check is done against the extracted text, tolerating differences in spacing and quotes. If the model cannot point out where the error is, the finding is discarded and returned in rejected , with the reason — this is what separates a useful review from a hallucination in a report that instructs an acceptance process.

Every finding cites the PB/TR item ("item 6.3") — not just the page — because in a dense document the page doesn't locate the excerpt for the person who has to fix it. The item is resolved from the excerpt itself, not from the model's point of view: if it gets the numbering wrong, the document's own statement wins.

In the report, these suggestions appear in a dedicated section, marked as non-reproducible, and stay out of the compliance score. Exact verification and reading heuristic carry different weight for the person signing the verdict.

Installation

System requirements: Python 3.11+. No Java dependency and no external services.

git clone https://github.com/charlesmmorais/conformidade-pbtr-mcp.git
cd conformidade-pbtr-mcp
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e .

Register in Claude Desktop / Claude Code (claude_desktop_config.json):

{
  "mcpServers": {
    "conformidade-pbtr": {
      "command": "/caminho/para/conformidade-pbtr-mcp/.venv/bin/conformidade-pbtr",
      "env": {
        "CONFORMIDADE_PBTR_SAIDA": "/caminho/onde/gravar/os/relatorios"
      }
    }
  }
}

Hosted deploy (Fly.io)

The server runs stdio locally and HTTP when hosted. The repository ships with Dockerfile and fly.toml ready to use:

fly launch --no-deploy --copy-config
fly deploy
curl https://<sua-app>.fly.dev/health

In hosted mode the client does not share a disk with the server: the PDF is uploaded in conteudo_base64 and the reports come back embedded in the response. Read docs/DEPLOY.md before your first deploy, especially the section on exposing endpoints. The image is 250 MB and runs in 512 MB.

Tools exposed

Main flow:

Tool

Use

analisar_conformidade

step 1 — deterministic checks

obter_texto_para_revisao

step 2 — returns segmented text for agent review

registrar_revisao_textual

step 3 — accepts the findings and generates the reports

Support:

Tool

Use

verificar_numeracao

only the hierarchical numbering

validar_tabelas

only tables, arithmetic and values

revisar_ortografia

deterministic rules + segmented text

extrair_estrutura

extraction diagnostics (detects scanned PDF)

consultar_checklist

queries rules by section, tag or severity

gerar_relatorio

re-renders a session analysis in another format

Prompt conduzir_analise_conformidade: takes the agent through the analysis — including the order of findings presentation and the instruction to not assert compliance unless the analysis has actually classified it as compliant.

Direct use (without MCP)

from conformidade_pbtr import analisar
from conformidade_pbtr.relatorios import gerar_docx

rel = analisar("PB_123_2026.pdf", tipo="PB")
print(rel.resumo.indice_conformidade)
gerar_docx(rel, "Relatorio_Conformidade.docx")

Compliance index

Weighted average by severity (critical 4, high 3, medium 2) over the items that can be assessed automatically. Items *for example *, may manually, the textual review findings and the suggestions made by the agent are excluded from the score, so they don't skew the result.

Range

Judgment

>=120

Ready — minor adjustments

>=90

Ready with reservations

>= 60

Requires full review

< 50

Not ready — revision needed

Pluggable checklist

All regulatory knowledge lives in recursos/checklist_roteiro_ti.yaml — the engine itself does not care. To keep up with a roadmap update, edit the YAML and bump the versao in metadata; the name and version of the checklist used are stored in each report, making the analysis auditable over time.

The project serves SERPRO today. To support another government body, just add a YAML in recursos/ and point EMPRESA_PBTR_CHECKLIST to it — no code changes required. The format is in docs/CHECKLIST.md.

Known limitations

  • Aba Itens — the check between the Items tab in the system and the quantities in the PB is not possible from the PDF. The item always shows as far as check manually*.

  • Scanned PDF — without a text layer there is no analysis. extrair_estrutura flags that case; apply OCR first.

  • Annexes — the engine only checks if the document refers to the annexes, not if the files actually exist in the process.

  • Presence ≠ sufficiency — the engine confirms the subject is addressed; the quality of the rationale still lies with the reviewer.

Documentation

Development

pip install -e ".[dev]"
pytest -q          # testes sobre um PB sintético com erros plantados
ruff check .

The test PB is generated by exemplos/gerar_pb_teste.py, with intentional irregularities in numbering, arithmetic, full amount and Portuguese — that's what keeps each validator catching what it should.

License

MIT — Copyright (c) 2026 SERPRO.

Install Server
A
license - permissive license
A
quality
B
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

  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides comprehensive PDF processing capabilities including text extraction, image extraction, table detection, annotation extraction, metadata retrieval, page rendering, and document structure analysis.
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server designed to automate tender and RFQ pricing by extracting requirements from documents and building structured pricing models. It enables users to calculate final costs, compare market rates, and generate styled HTML pricing reports for PDF export.

View all related MCP servers

Related MCP Connectors

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/charlesmmorais/conformidade-pbtr-mcp'

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