dehu
Sends optional phone push notifications via ntfy topics for new pending notifications, new communications, certificate expiry warnings, and sync failures.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dehu Do I have any pending notifications in DEHú?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dehu-mcp
An MCP server and background sync for DEHú, the Spanish government's single inbox for official notifications (notificaciones) and communications (comunicaciones) from AEAT, Seguridad Social, DGT, Extranjería, ministries, councils and others.
It logs in by itself with your digital certificate (.p12 / .pfx). There's no Cl@ve Móvil, no browser and no human step. It keeps a local copy of everything, downloads the PDFs, alerts you when something new arrives, and lets an AI assistant (Claude, etc.) answer questions like "Do I have anything pending in DEHú?" or "What did Extranjería send me last month?"
⚠️ Pending notifications are never opened automatically. Under Spanish law, opening a notification counts as being notified, and legal deadlines start running. If you never open it, it's deemed notified 10 calendar days after it was made available. This tool only lists pending notifications and alerts you. You decide when to open them, in DEHú.
Unofficial; not affiliated with the Spanish administration. Everything runs locally: your certificate, password and documents never leave your machine, except to log in to DEHú and Cl@ve themselves.
🤖 Install with an AI assistant
Paste this repo's URL into your AI coding assistant (Claude Code, Cursor, etc.) and ask it to install it. Instructions for the AI:
Requirements: check that
uvis installed (uv --version). If not, install it withcurl -LsSf https://astral.sh/uv/install.sh | sh(macOS/Linux) orpowershell -c "irm https://astral.sh/uv/install.ps1 | iex"(Windows).Ask the user for the path to their certificate file (
.p12or.pfx, e.g. an FNMT certificado de persona física). Don't search their disk for it without asking.Register the certificate. It asks for the certificate password, which the user must type themselves. Never ask the user to paste the password into the chat. In Claude Code, tell the user to run it with the
!prefix so the prompt appears in their terminal:uvx --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp setup --p12 "/path/to/certificate.p12"This stores the password in the OS keyring (macOS Keychain / Windows Credential Manager / Linux Secret Service) and copies the certificate into the app's private data folder. Optional flags:
--docs-dir(where PDFs go; default~/Documents/DEHU) and--profile <name>(to configure several people).First import (downloads history, about 1–2 minutes; doesn't fire alerts for old items):
uvx --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp sync --no-notifyRegister the MCP server:
Claude Code:
claude mcp add --scope user dehu -- uvx --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp serveOther MCP clients (Claude Desktop, Cursor, …), in their JSON config:
{ "mcpServers": { "dehu": { "command": "uvx", "args": ["--from", "git+https://github.com/isdelrey/dehu-mcp", "dehu-mcp", "serve"] } } }
Optional: background sync + alerts. Ask the user first, because it installs a recurring job:
uvx --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp install --hours 4On macOS this installs a launchd agent; on Linux/Windows it prints a cron line to add. For phone pushes, set
DEHU_MCP_NTFY_URL=https://ntfy.sh/<long-random-topic>before runninginstall.Verify:
uvx --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp status. The MCP tools appear after restarting the client or opening a new session.
Related MCP server: EAD Enterprise Suite MCP Server
What you get
MCP tools
Tool | What it does |
| Which certificate is configured, its expiry date, recent sync runs |
| Logs in and refreshes now ( |
| Notifications waiting to be opened (listed only, never opened) |
| Notifications already accepted or expired, filterable by date and issuing body |
| Informative communications ( |
| Text of a downloaded PDF (plus its signed delivery receipt) |
| Marks an unread communication as read and downloads it. Requires |
| What's new since N hours ago |
Background sync and alerts (macOS Notification Center or Linux notify-send, plus optional ntfy phone push):
a new pending notification, with its expiry date;
a new notification or communication;
the certificate expiring within 60 days;
sync failing for more than 24 hours.
Files: ~/Documents/DEHU/Notificaciones/ and .../Comunicaciones/, one PDF per item, plus the signed delivery receipt (*_resguardo.pdf), annexes, and a .json with metadata.
How it works
Login: the DEHú API → SAML request to Cl@ve (
pasarela.clave.gob.es) → identity provider AFIRMA (certificate), with TLS client authentication using your certificate → SAML response → DEHú issues a JWT (valid about 10 minutes). It logs in again automatically whenever needed. Takes a few seconds.Data: DEHú's own JSON API (the one its web app uses). History is fetched in windows of about a month (an API limit).
Certificate: the
.p12is decrypted in memory. A temporary PEM copy exists only during a sync, in a0700folder, and is deleted afterwards. Legacy FNMT.p12files (RC2/3DES) are supported.State: SQLite in the app data folder (
~/Library/Application Support/dehu-mcp,%APPDATA%\dehu-mcpor~/.local/share/dehu-mcp). The MCP server reads from it, so it's fast and works even when DEHú is down. Onlysync_nowandread_communicationtouch the network.
CLI
dehu-mcp setup --p12 FILE [--profile NAME] [--docs-dir DIR] [--password-stdin]
dehu-mcp sync [--since YYYY-MM-DD] [--no-download] [--no-notify] [--profile NAME]
dehu-mcp status | mark-seen | install [--hours N] | uninstall | serveEnvironment variables: DEHU_MCP_PROFILE, DEHU_MCP_HOME, DEHU_MCP_NTFY_URL, DEHU_MCP_P12_PASSWORD (headless servers without a keyring).
Several people (e.g. you and a family member with an apoderamiento or their own certificate): run setup --profile <name> once per certificate, then pass profile to the tools.
Troubleshooting
Unexpected page during Cl@ve login: Cl@ve changed something, or the certificate is revoked or expired. Checkdehu-mcp statusand open an issue.No certificate configured: rundehu-mcp setup(step 3).Updating:
uvx --refresh --from git+https://github.com/isdelrey/dehu-mcp dehu-mcp status.
Related
aeat-mcp: the same idea for the Agencia Tributaria sede (debts, payment plans, filed returns and whether they're paid).
MIT licensed.
Available Tools
8 toolscertificate_statusC
Configured certificate/profile, its expiry, and recent sync runs.
Inputs: profile.
document_textC
Text of a downloaded notification/communication PDF (by sentReference) plus its file paths.
Inputs: sent_reference (required), profile, include_receipt.
list_communicationsC
Communications (informative, no legal effect), newest first. state PENDIENTE = unread.
Inputs: limit, since, emitter, profile.
list_notificationsA
Realized (accepted or expired) notifications, newest first. since=YYYY-MM-DD; emitter = substring of the issuing body (e.g. 'Tributaria', 'Extranjer', 'Seguridad Social').
Inputs: limit, since, emitter, profile.
pending_notificationsA
Notifications waiting to be opened (as of the last sync). Only lists them — opening is a legal act.
Inputs: profile.
read_communicationA
Mark an UNREAD communication as read in DEHú and download it. Communications have no legal effect, but this changes state in the user's account — only call with confirm=True after the user agrees. Never used for notifications.
Inputs: sent_reference (required), confirm, profile.
recent_changesC
What changed (new pending notifications, new notifications/communications, sync problems) in the last N hours.
Inputs: profile, since_hours.
sync_nowB
Log in to DEHú with the certificate (headless Cl@ve) and refresh notifications and communications. Downloads PDFs of realized notifications and read communications. since=YYYY-MM-DD to (re)import history.
Inputs: since, profile, download_documents.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools are cleanly separated: pending vs. realized notifications are split by state, and communications vs. notifications are explicitly disambiguated in descriptions. Minor overlap remains between sync_now (which downloads PDFs), read_communication (which also downloads), and document_text (which reads downloaded PDFs), so an agent could hesitate about which download path to use.
Two clear verb_noun tools (sync_now, read_communication) coexist with bare noun phrases (certificate_status, document_text, recent_changes) and adjective_noun forms (pending_notifications), while only the list_* pair is internally consistent. The names are still readable and largely self-explanatory, but there is no single predictable pattern.
Eight tools is well within the sweet spot and each maps to a distinct step in the DEHú workflow: inspect credentials, sync, list three streams, extract text, acknowledge, and summarize changes. Nothing feels padded or missing at the count level.
The read-side surface is solid (pending, realized, communications, document text, change digest), but the central legal action — opening/accepting a pending notification — has no tool at all, and there is no way to act on or dismiss individual notifications. An agent can observe the inbox but hits a dead end at the most consequential step, which may be intentional but leaves a notable gap.
Maintenance
Related MCP Connectors
Prepare, send and track e-signatures from your AI assistant. European, eIDAS-qualified.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Send encrypted files and secrets, collect files and get documents signed, from your AI.
Deterministic European sovereign engine with 90 tools across 20 vertical suites for AI agents: EU Tax/KYB, FatturaPA/Peppol, AI Act, GDPR, DORA, NIS2, Italian Tenders (D.Lgs 36/2023), CBAM, EUDR, and Labour Law. Zero-Data-Retention with verifiable SHA-256 PDF/A audit certificates.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceLets AI agents authenticate and submit Dominican Republic electronic invoices (e-CF) to the DGII national gateway using certificate-based authentication.MIT
- AlicenseBqualityCmaintenanceEnables AI agents to interact with EAD Enterprise Suite for managing signatures, evidence, notifications, and dossiers.52528 npmMIT
- AlicenseAqualityBmaintenanceEnables AI assistants to securely read a user's own sundhed.dk health record data, including medications, lab results, vaccinations, and referrals, after MitID login via a local browser session.129 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables assistants to file, search, and manage invoices, contracts, policies, and official letters, and to create, explain, update, and remind on their derived deadlines. It also supports mail scanning, warranty checks, notification testing, settings changes, and upkeep through a running local paperwork app.MIT