Skip to main content
Glama

MCP SAT 69 / 69-B · WATR

Server MCP (Model Context Protocol) in Python / FastMCP zur Abfrage der öffentlichen Listen des SAT:

  • Artikel 69-B des CFF (EFOS) — simulierte Geschäfte: mutmaßlich, entkräftet, endgültig, günstiges Urteil.

  • Artikel 69 des CFF — bestandskräftige Steuersituation: rechtskräftig, fällig, nicht lokalisiert, annulliert, erlassen.

Gleiche Architektur wie das MCP für Einsätze der SSC-CDMX: FastMCP mit Transport stdio + Streamable HTTP, OAuth 2.1 (WorkOS AuthKit) mit Fallback auf statisches Bearer-Token, Persistenz in Turso (libSQL), optionaler Download-Proxy und Deployment auf Render mit externem Cron (GitHub Actions). Kein OCR: Die CSV-Dateien des SAT sind bereits strukturiert.

Tools

Tool

Was es tut

verificar_rfc

Prüft einen RFC → Risiko-Verdikt (CRITICO…LIMPIO).

verificar_lote

Validiert bis zu 500 RFCs; liefert nur Feststellungen nach Schweregrad.

buscar_nombre

Suche nach Name/Firmenname (FTS5, akzentunabhängig).

estado_datos

Vom SAT angegebene Gültigkeit, Anzahl und letzter Import.

actualizar_datos

Lädt die Listen herunter + synchronisiert sie (idempotent per Hash).

Risiko: CRITICO (EFOS endgültig) · ALTO (EFOS mutmaßlich) · MEDIO (69 rechtskräftig/fällig/nicht lokalisiert) · BAJO (entkräftet/günstiges Urteil) · INFORMATIVO (69 annulliert/erlassen) · LIMPIO.

Die Ergebnisse spiegeln den letzten Import der öffentlichen SAT-Dateien wider. Sie stellen keine steuerliche oder rechtliche Beratung dar.

Related MCP server: Receita Federal: Situação Fiscal

Architektur

CSV del SAT (Latin-1)                     ┌────────── FastMCP ──────────┐
   │  fetcher (httpx + proxy opcional)    │ verificar_rfc / _lote        │
   ▼                                      │ buscar_nombre / estado_datos │
 pipeline (parse 69 / 69b)  ──►  SQLite ──┤ actualizar_datos             │
   │   (FTS5 unicode61, triggers)  ▲  │   └──────────┬──────────────────┘
   ▼                               │  │   stdio (server.py) + HTTP (web.py)
 Turso (libSQL, durable) ◄── push  │  └► pull al arranque      │
                                   └─────────────────── /health /refresh /reload
  • server.py — FastMCP (stdio) + Tools + AuthKit.

  • web.py — Starlette/uvicorn (HTTP): /refresh und /reload (M2M-Bearer), /mcp (OAuth oder Bearer).

  • pipeline.py — Download → SHA-256 (überspringt, falls unverändert) → Latin-1-Parsing → Ersetzen in SQLite → Push zu Turso.

  • database.py — SQLite + FTS5 mit Triggern; RFC über B-Baum-Index (Hot Path).

  • turso.py — dauerhafte Synchronisierung Turso ↔ lokal.

  • risk.py — RFC-Normalisierung + Veredikt-Baum (69-B hat Vorrang vor 69).

Lokale Installation

cd sat69-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Primera ingesta (descarga ~22 MB; el 69 son ~½ millón de filas)
python -c "from sat69 import database as db, config; db.init_db(config.settings.db_path)"
python -c "from sat69.pipeline import process_import; print(process_import())"

# Probar
pytest -q

Verbindung in Claude Desktop / Cowork (stdio)

{
  "mcpServers": {
    "sat69": { "command": "sat69-mcp" }
  }
}

(oder "command": "python", "args": ["-m", "sat69"] mit aktivem venv.)

Deployment auf Render

render.yaml stellt den Webdienst mit nativem Python-Runtime bereit (ohne Docker):

  1. Lade das Repo auf GitHub hoch und erstelle einen Blueprint in Render, der auf render.yaml zeigt.

  2. Variablen (markiert mit sync:false): MCP_API_KEY (Bearer), optional AUTHKIT_DOMAIN+BASE_URL (OAuth), TURSO_DATABASE_URL+TURSO_AUTH_TOKEN.

  3. MCP-Endpoint: POST https://<servicio>.onrender.com/mcp.

Auth (zwei Modi, wie beim MCP für Einsätze)

  • Statischer Bearer (MCP_API_KEY): einfach, schützt /mcp, /refresh, /reload.

  • OAuth 2.1 (WorkOS AuthKit): Definiere AUTHKIT_DOMAIN + BASE_URL, und /mcp wechselt zu OAuth mit Dynamic Client Registration; der Bearer schützt weiterhin die M2M-Endpoints.

Automatische Aktualisierung

.github/workflows/refresh.yml führt täglich POST /refresh aus (11:30 UTC ≈ 05:30 CDMX). Repo-Secrets: RENDER_BASE_URL, MCP_API_KEY. Manuell: workflow_dispatch (mit force).

Persistenz (Turso)

Lokales SQLite (flüchtig auf Render, /tmp) bedient die Abfragen; Turso ist der dauerhafte Speicher, der Redeploys übersteht. Beim Start wird ein Pull von Turso durchgeführt; nach jedem actualizar_datos//refresh wird ein Push ausgeführt. Ohne TURSO_* läuft es im reinen lokalen Modus.

Download-Proxy (optional)

FETCH_PROXY oder DATAIMPULSE_* routen nur den Download der CSV-Dateien. In Tests blockierte der SAT keine Rechenzentrums-IPs (direkte Downloads mit 200), daher ist es normalerweise nicht erforderlich; es wird aus Parität und Resilienz beibehalten.

Datenquellen (SAT · Datos Abiertos)

  • 69-B: Listado_Completo_69-B.csv (~14.000 Datensätze, 20 Spalten, Header in Zeile 3).

  • 69: Firmes.csv, Cancelados.csv, NoLocalizados.csv, Exigibles.csv, Sentencias.csv, Condonados.csv (~½ Million Datensätze, 6 Spalten). URLs in config.py.

Available Tools

6 tools
actualizar_datosBInspect

Descarga y sincroniza los listados del SAT (idempotente por hash).

Inputs: dataset, force_refresh. Returns: object

buscar_nombreAInspect

Busca contribuyentes por nombre / razón social parcial (FTS5, sin acentos).

Inputs: texto (required), limite, dataset. Returns: object

estado_datosAInspect

Estado del dataset: vigencia declarada por el SAT, conteos y última importación.

Inputs: no named parameters. Returns: object

resumen_carteraAInspect

Resumen ejecutivo en lenguaje natural de una cartera de RFCs.

El riesgo de cada RFC lo calcula el motor de reglas (DETERMINISTA); la IA sólo redacta el brief a partir de esos veredictos ya calculados — nunca decide el riesgo. Proveedor de IA conmutable por env var (LLM_PROVIDER).

Inputs: rfcs (required). Returns: object

verificar_loteBInspect

Verifica una lista de RFCs (p. ej. proveedores). Devuelve sólo hallazgos.

Inputs: rfcs (required). Returns: object

verificar_rfcAInspect

Verifica un RFC contra las listas del SAT (Art. 69, 69-B y 69-B Bis).

Inputs: rfc (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct concern: data status/update, single/batch verification, portfolio summary, and name search. The closest pair, verificar_rfc and verificar_lote, is disambiguated by singular vs batch operation.

    Naming Consistency4/5

    Most tools follow a clear verb_noun pattern: actualizar_datos, verificar_rfc, verificar_lote, buscar_nombre. Two names are noun phrases, estado_datos and resumen_cartera, which is a minor deviation from the otherwise consistent style.

    Tool Count5/5

    Six tools are well-scoped for this SAT list verification server. Each tool adds a distinct capability, covering data ingestion, verification, search, and summary without redundancy or bloat.

    Completeness4/5

    The toolset covers the core workflow: update and inspect dataset state, verify single or batch RFCs, search by name, and generate portfolio summaries. A dedicated detailed taxpayer-profile tool could be a minor addition, but the main use cases are well supported.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables consultation of Argentine credit situations (Central de Deudores) via BCRA API, providing tools for current status, historical trends, rejected checks, and consolidated reports.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Query Brazilian Federal Revenue (Receita Federal) tax situation data from official sources via a single read-only tool, hosted and billed per use.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to validate Mexican RFC, CURP, CLABE and NSS identifiers with real check digits, parse CFDI 4.0 invoices with labelled SAT catalogue codes and verified totals, and query the SAT's public status service to see whether an invoice is still valid. It also generates coherent test people and companies, all read-only and without API keys, certificates or PAC contracts.
      9
      342 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables official-source lookups on people and companies, covering registration status, tax and labor clearance certificates, sanctions lists, trademarks/patents, and electronic invoices, with platform-hosted pay-per-query access.
      MIT