mcp-el-salvador-dte
Provides tools for El Salvador electronic invoicing (DTE), including IVA calculation, document-type catalog, and DUI/NIT validation.
README
mcp-el-salvador-dte
A small, focused Model Context Protocol (MCP) server that exposes El Salvador electronic invoicing (DTE) and fiscal helpers as tools an LLM can call: IVA calculation, the official DTE document-type catalog, and DUI / NIT validation.
Built with the official @modelcontextprotocol/sdk for TypeScript, ESM, Node 18+, and the stdio transport.
- Author: Gerar Arévalo — github.com/Gerar12 · gcoder.dev
- License: MIT
What it is
The Documento Tributario Electrónico (DTE) is El Salvador's mandatory electronic invoicing standard, administered by the Ministerio de Hacienda. This server bundles a few pure, deterministic helpers that come up constantly when building DTE integrations, and makes them available to any MCP-capable client (Claude Desktop, Claude Code, etc.).
Tools
| Tool | Input | Output |
|---|---|---|
calculate_iva |
{ amount: number, includesIva?: boolean } |
{ subtotal, iva, total } |
list_dte_types |
(none) | { types: [{ code, name }] } |
validate_dui |
{ dui: string } |
{ valid, reason? } |
validate_nit |
{ nit: string } |
{ valid, normalized, reason? } |
calculate_iva
El Salvador IVA (VAT) is 13%.
includesIva = false(default):amountis the net subtotal; IVA is added on top.includesIva = true:amountalready includes IVA; it is broken out.
Values are rounded to 2 decimals, and subtotal + iva === total always holds.
// input
{ "amount": 100 }
// output
{ "subtotal": 100, "iva": 13, "total": 113 }
// input
{ "amount": 113, "includesIva": true }
// output
{ "subtotal": 100, "iva": 13, "total": 113 }
list_dte_types
Returns the 11 official DTE document types (code — name):
| Code | Name |
|---|---|
| 01 | Factura (Consumidor Final) |
| 03 | Comprobante de Crédito Fiscal (CCF) |
| 04 | Nota de Remisión |
| 05 | Nota de Crédito |
| 06 | Nota de Débito |
| 07 | Comprobante de Retención |
| 08 | Comprobante de Liquidación |
| 09 | Documento Contable de Liquidación |
| 11 | Factura de Exportación |
| 14 | Factura de Sujeto Excluido |
| 15 | Comprobante de Donación |
// output (abridged)
{ "types": [ { "code": "01", "name": "Factura (Consumidor Final)" }, ... ] }
validate_dui
Validates a Salvadoran DUI (Documento Único de Identidad): 8 digits, a hyphen, then 1 check digit (e.g. 01234567-8).
It checks the format and the modulo-10 check digit. The 8 base digits are weighted 9, 8, 7, 6, 5, 4, 3, 2 (left to right); the expected check digit is (10 - (weightedSum % 10)) % 10.
// input
{ "dui": "01234567-8" }
// output
{ "valid": true }
// input
{ "dui": "01234567-9" }
// output
{ "valid": false, "reason": "Invalid check digit: expected 8, got 9" }
Honesty note on the DUI check digit. The modulo-10 algorithm above is a widely-used community algorithm and was verified in this repo against known-valid DUIs (
00016297-5,01234567-8). It is not reproduced from an official, government-published specification. If your use case is high-stakes (e.g. legally rejecting a real person's ID), treat avalid: falsefrom the check-digit test as "likely a typo, please re-check" rather than an authoritative rejection. The format check (^\d{8}-\d$) is unambiguous; the check-digit step is best-effort.
validate_nit
Validates the format only of an El Salvador NIT (Número de Identificación Tributaria): 14 digits, commonly formatted NNNN-NNNNNN-NNN-N. Input is accepted with or without hyphens/whitespace, and a canonically hyphenated normalized value is returned.
// input
{ "nit": "06141234560012" }
// output
{ "valid": true, "normalized": "0614-123456-001-2" }
Honesty note on NIT. This is format/length validation only — it does not verify a check digit. NIT check-digit rules are not consistently documented in public sources, so shipping a check-digit validator here would imply a correctness guarantee that cannot be honestly backed up. A
valid: truemeans "well-formed", not "issued by Hacienda".
Install
Requires Node.js 18+.
# clone, then:
npm install
npm run build
Run the tests (unit tests for the pure functions + an stdio smoke test that boots the server and performs a full MCP handshake):
npm test
Start the server manually (it speaks JSON-RPC over stdio and waits for a client):
npm start
# or
node build/index.js
Run with npx (after publishing to npm)
npx mcp-el-salvador-dte
Add to Claude Desktop
Edit your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"el-salvador-dte": {
"command": "node",
"args": ["/absolute/path/to/mcp-el-salvador-dte/build/index.js"]
}
}
}
Once published to npm you can instead use:
{
"mcpServers": {
"el-salvador-dte": {
"command": "npx",
"args": ["-y", "mcp-el-salvador-dte"]
}
}
}
Restart Claude Desktop, and the four tools will appear.
Add to Claude Code
# local build
claude mcp add el-salvador-dte -- node /absolute/path/to/mcp-el-salvador-dte/build/index.js
# or, after publishing to npm
claude mcp add el-salvador-dte -- npx -y mcp-el-salvador-dte
Project layout
src/lib.ts Pure, side-effect-free domain logic (unit-tested directly)
src/index.ts MCP server: registers the 4 tools over stdio
test/ node:test unit tests + stdio smoke test
License
MIT © 2026 Gerar Arévalo
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。