Skip to main content
Glama

mcp-dof is a Model Context Protocol server that lets Claude and other AI agents read Mexico's Diario Oficial de la Federación (DOF): what was published on any day, the full text of every decree, rule or notice as clean Markdown, title search over date ranges, and the exchange rate, UDIS and TIIE the DOF publishes daily.

The DOF is where Mexican federal law becomes law. Lawyers, compliance teams and analysts check it every morning. This server lets an agent do the reading, always citing the official link.

Demo

Real output, recorded through a real MCP client over stdio against the live API on 2026-11-17. Excerpts below are copied verbatim (… marks omitted lines); the full, unedited transcript is in docs/demo.md.

<!-- list_edition(date="2026-11-13") · 0.4 s -->
# DOF 2026-11-13 · Friday

66 notes in 2 edition(s): matutina, vespertina.
44 avisos judiciales y generales hidden (pass include_avisos=true to list them).

## Edición matutina · 61 notes (44 avisos hidden) · [edition PDF](https://sidof.segob.gob.mx/dof/sidof/documentos/pdf/330805)

**PODER EJECUTIVO › PRESIDENCIA DE LA REPUBLICA**
- `5803757` Decreto por el que se expide la Ley de Ingresos de la Federación para el Ejercicio Fiscal de 2027. · p. 4 · [DOF](https://dof.gob.mx/nota_detalle.php?codigo=5803757&fecha=13/11/2026)
…
<!-- get_indicators(date="2026-11-17") · 0.2 s -->
| Indicator | Value | Unit | Published | Key |
| --- | --- | --- | --- | --- |
| Tipo de cambio FIX (dólar) | 18.5525 | MXN per USD | 2026-11-17 | `usd` |
| UDIS | 8.913896 | MXN per UDI | 2026-11-17 | `udis` |
| TIIE 28 días | 6.5147% | % annual | 2026-11-17 | `tiie28` |
| TIIE 91 días | 6.5492% | % annual | 2026-11-17 | `tiie91` |
| TIIE 182 días | 6.5995% | % annual | 2026-11-17 | `tiie182` |
| TIIE de fondeo | 6.26% | % annual | 2026-11-17 | `tiie_fondeo` |
…

search_notes(practice_area="hidrocarburos", date_from="2026-10-01", date_to="2026-11-13") scanned 44 days (535 notes) in 10.7 s with a cold cache and returned 32 matches, from the CNE rules on marketing of natural gas and petroleum products to the ASEA emergency NOMs on LP gas.

Things you can ask once it is connected (example prompts, not recorded answers):

  • "¿Qué publicó el DOF hoy? Resume solo lo que toca energía e hidrocarburos."

  • "Read the Ley de Ingresos 2027 and list every transitory article with a deadline."

  • "Prepara un digest regulatorio de minería de las últimas dos semanas." (uses the regulatory_digest prompt)

  • "How did the FIX exchange rate move in October 2026?"

Related MCP server: KriteriusMX

Quickstart

You need uv. Nothing else: uvx downloads and runs the server.

Claude Code

claude mcp add dof -- uvx --from git+https://github.com/BEG-lag/mcp-dof mcp-dof

Claude Desktop: add this to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\) and restart:

{
  "mcpServers": {
    "dof": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/BEG-lag/mcp-dof", "mcp-dof"]
    }
  }
}

Any other MCP client: run mcp-dof over stdio, or mcp-dof --transport http --port 8000 for streamable HTTP at http://127.0.0.1:8000/mcp.

Tools

Tool

What it does

list_edition(date, edition, include_avisos)

Table of contents of a day (matutina, vespertina, extraordinaria), grouped by issuing agency, with note codes, pages, official links and the edition PDF. On weekends and holidays it points to the latest edition.

get_note(code, start, max_chars)

Full text of a note as Markdown (bold, tables and links preserved) with a metadata table. Long instruments are paginated.

search_notes(query, date_from, date_to, practice_area, edition, include_avisos, limit)

Title search over up to 92 days, newest first, with progress notifications. Accent and case insensitive, prefix matching (eléctric), "phrases", a | b alternatives and acronyms (CFE, ISR).

get_indicators(date)

FIX exchange rate, UDIS, TIIE 28/91/182 and TIIE de fondeo for a date; weekends are completed with the latest publication of each indicator.

get_indicator_history(indicator, date_from, date_to)

One indicator over up to 400 days, with first, last, change, low and high.

Practice-area presets for search_notes: energia, hidrocarburos, mineria, fiscal, ambiental, competencia, financiero, comercio_exterior, laboral, datos_personales, normas, telecom.

Also exposed: the prompt regulatory_digest(practice_area, date_from, date_to, language) and the resources dof://edition/{date} (JSON), dof://note/{code} (Markdown) and dof://practice-areas. Dates accept YYYY-MM-DD, DD-MM-YYYY, today or yesterday, in Mexico City time. All tools are annotated read-only.

How it works

flowchart LR
    A["Claude or any<br/>MCP client"] -- "stdio / HTTP" --> B["mcp-dof<br/>FastMCP tools,<br/>prompt, resources"]
    B --> C{"TTL cache<br/>past days 12 h<br/>today 5 min"}
    C -- miss --> D["SIDOF client<br/>250 ms spacing<br/>retries + backoff"]
    D -- "GET /notas/{fecha}<br/>/notas/nota/{id}<br/>/indicadores/..." --> E[("SIDOF API<br/>sidof.segob.gob.mx")]
    B --> F["HTML to Markdown<br/>styles to bold,<br/>tables kept"]
    B --> G["Title search<br/>accents, prefixes,<br/>presets"]

The DOF has no official API documentation beyond a few PDFs, so the endpoints, quirks and limits were probed by hand and written up in docs/api.md. A few highlights: a bare Accept: application/json header gets HTTP 406, invalid dates return HTTP 500, every table of contents mixes untitled separator rows with real notes, and the public search backend returns HTTP 204 for every query, which is why search_notes scans daily indexes instead.

Being polite to a government server is part of the design: a descriptive User-Agent, at least 250 ms between requests, exponential backoff that honours Retry-After, timeouts, and caching.

Project structure

src/mcp_dof/
  server.py      FastMCP app: tools, resources, prompt, CLI entry point
  client.py      async SIDOF client: throttling, retries, TTL cache
  models.py      typed parsing of SIDOF payloads (editions, notes, indicators)
  markdown.py    note HTML to Markdown, pagination at paragraph boundaries
  search.py      query parser, accent-insensitive matching, practice-area presets
  formatting.py  Markdown rendering of tool results
  dates.py       date parsing and validation in Mexico City time
tests/           78 offline tests on recorded fixtures + 3 opt-in live tests
scripts/         record_fixtures.py, demo.py (writes docs/demo.md)
docs/api.md      the SIDOF API, as observed

Development

uv sync
uv run pytest                 # offline: recorded SIDOF responses, no network
uv run pytest --live -m live  # opt in: hits the real API
uv run ruff check . && uv run ruff format --check .
uv run python scripts/demo.py # real MCP round trip over stdio

CI runs ruff and the offline suite on Python 3.12, 3.13 and 3.14. A separate weekly workflow runs the live tests, so a change in the government API shows up as a failed check instead of a confused agent.

Limitations

  • Search covers titles, not full text, and at most 92 days per call: SIDOF's own search endpoint did not return results when probed. Scanning a cold range takes roughly 0.25 s per day.

  • Avisos judiciales y generales are listed by SIDOF with reference codes as titles (Aviso REF:581596), so they are hidden by default and not searchable by content.

  • Full text is available only when SIDOF has HTML for the note (its existeHtml flag). Otherwise get_note returns the metadata plus the Word and edition PDF links.

  • The SIDOF API is undocumented and can change without notice; the weekly live check is the early warning.

  • Indicators are listed by DOF publication date; Banco de México determines the FIX and the TIIE on the previous business day.

Disclaimer

Unofficial: only the printed/official DOF is authoritative; not legal advice. This project is not affiliated with the Secretaría de Gobernación or the DOF. Verify any legal conclusion against the official publication and with the competent authority.

Author

Built by Benjamín Esponda García, a Mexican corporate lawyer (energy, hydrocarbons and mining) who builds with AI. More at pivotek.mx and in the portfolio. Companion project: dof-diario, a living open dataset of the DOF table of contents.

Code released under the MIT License.

Available Tools

5 tools
get_indicator_historyGet Indicator HistoryA
Read-onlyIdempotent

Get the published values of one indicator over a date range (up to 400 days).

Inputs: indicator (required), date_to, date_from. Returns: result

get_indicatorsGet IndicatorsB
Read-onlyIdempotent

Get the financial indicators published in the DOF: FIX exchange rate, UDIS and TIIE.

Inputs: date. Returns: result

get_noteGet NoteA
Read-onlyIdempotent

Get the full text of a DOF note as clean Markdown, with metadata and official links.

Long instruments (laws, budgets, NOMs) are paginated: the footer tells you the start value for the next call.

Inputs: code (required), start, max_chars. Returns: result

list_editionList EditionA
Read-onlyIdempotent

List the DOF table of contents for a day, grouped by edition and issuing agency.

Each note shows its code (use it with get_note), title, page and official link.

Inputs: date, edition, include_avisos. Returns: result

search_notesSearch NotesA
Read-onlyIdempotent

Search DOF note titles over a date range (up to 92 days per call), newest first.

SIDOF has no working full-text search, so this scans each day's table of contents. Results are cached, so refining a query over the same range is fast.

Inputs: limit, query, date_to, edition, +3 more. Returns: result

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 5 tools

    Disambiguation4/5

    The tools have mostly distinct purposes: browsing a day's table of contents, fetching a note, searching note titles, and retrieving current versus historical indicators. The main potential confusion is between get_indicators and get_indicator_history, and between list_edition and search_notes, but the descriptions make the boundaries reasonably clear.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: get_indicators, list_edition, get_note, search_notes, get_indicator_history. The convention is predictable throughout.

    Tool Count5/5

    Five tools is well-scoped for a focused DOF server covering publications and financial indicators. Each tool has a clear role and the set does not feel bloated or thin.

    Completeness4/5

    The surface covers the core read-only workflows: listing daily editions, fetching notes, searching titles, and retrieving current and historical indicators. Minor gaps remain, such as structured filtering by agency/section or a direct indicator-list helper, but agents can work around them.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides AI assistants with live, authenticated access to official Mexican data sources including CURP, RFC, postal codes, phone numbers, SPEI payments, CFDI status, DOF semantic search, and geocoding via INEGI/INE.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude to search and retrieve legal sources from Mexican and inter-American courts (SCJN, TFJA, DOF, Corte IDH) with complete citations and official links.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to search Mexican federal and state statutes, Supreme Court theses, and precedents, returning verifiable citations with dated validity, public URLs, and explicit indication of whether case law is binding jurisprudence or merely persuasive.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants and agents to query official Mexican economic data from Banxico, including USD/MXN exchange rates, inflation (INPC), UDIS, and interest rates.
      6
      30 PyPI
      6
      MIT