Skip to main content
Glama
junter1989k-ai

Dominican Republic Invoice MCP

README.md
# Dominican Republic Invoice MCP 🇩🇴

<!-- install-cta -->
## Use it in 60 seconds

Paste this into your MCP client config (Claude Desktop, Cursor, Windsurf, or any MCP-capable agent):

```json
{
  "mcpServers": {
    "dominican-invoice": {
      "type": "http",
      "url": "https://inv-do.wishpool.app/mcp"
    }
  }
}
```

Nothing to install. Credentials, when you need them, travel as HTTP headers on each request and are never stored — see the [threat model](https://mcp.wishpool.app/trust).

### Or run it yourself

Would you rather not send production credentials to a server you do not control? Deploy this identical code to your own account and point your agent at your own URL:

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/junter1989k-ai/dominican-republic-invoice-mcp)

```bash
git clone https://github.com/junter1989k-ai/dominican-republic-invoice-mcp && cd dominican-republic-invoice-mcp && npx vercel --prod
```

MIT-licensed. Self-hosting removes us from the picture entirely, at no cost and with no loss of function.

---

Remote **MCP server** that lets any AI agent authenticate to and submit **Dominican Republic electronic invoices** (e-CF, *comprobante fiscal electrónico* / *factura electrónica*) through the **DGII** (Dirección General de Impuestos Internos) national gateway.

- **Endpoint:** `https://inv-do.wishpool.app/mcp` (MCP Streamable HTTP, stateless JSON mode)
- **Stateless / BYO:** no database, no accounts. DGII authentication is **certificate-based** — you sign the *semilla* and every e-CF with your own **DGII-recognized digital certificate** (Digifirma or another approved CA). This server **only forwards already-signed bytes**; it never signs, never generates the e-CF XML, and never stores anything.

## Honest scope

This server is a thin, stateless **translation layer over the four DGII e-CF web services**. It does **not**:

- generate or build the e-CF XML (your billing software does that, with the e-NCF, RNC, Totales, ITBIS);
- sign anything (the XAdES signature and the DGII certificate stay **merchant-side**);
- store credentials, tokens, invoices, or customer data.

It **does** map the DGII flow to four weak-model-friendly tools and pass DGII's native responses straight through.

## The 4-step DGII e-CF flow

| Step | Tool | DGII web service | You provide | You get back |
|------|------|------------------|-------------|--------------|
| 1 | `get_seed` | `GET /Autenticacion/api/Autenticacion/Semilla` | — | `{ seed_xml, valor, fecha }` |
| 2 | `get_token` | `POST /Autenticacion/api/Autenticacion/ValidarSemilla` (multipart `xml`) | the **signed** semilla (base64) | `{ token, expira, expedido }` |
| 3 | `submit_invoice` | `POST /Recepcion/api/FacturasElectronicas` (multipart `xml`, Bearer) | the **signed** e-CF (base64) + `token` | `{ trackId, mensaje, error }` |
| 4 | `query_status` | `GET /ConsultaResultado/api/Consultas/Estado?TrackId=` (Bearer) | `trackId` + `token` | `{ estado, codigo, rnc, encf, mensajes[] }` |

`estado` enum: `En Proceso` → `Aceptado` (fiscally valid) / `Aceptado Condicional` (accepted with observations) / `Rechazado` (fix and resubmit with a new e-NCF).

## Where do the credentials come from?

There is **no static API key**. To use production you need a **DGII-recognized digital certificate** issued by an approved Certification Authority (e.g. **Digifirma**), registered as a taxpayer certificate with the DGII. You sign the semilla with it to obtain a ~1-hour session token, and sign each e-CF the same way. For **free testing**, the DGII **TesteCF** (*certificación*) environment is open, requires no registration, and has **no fiscal effect**.

## Headers

| Header | Required | Meaning |
|--------|----------|---------|
| `x-dgii-env` | optional | `test` (default, TesteCF certificación, no fiscal effect) or `prod` (eCF production, real fiscal effect) |
| `x-dgii-token` | optional | alternative to passing the `get_token` token as the `token` argument on `submit_invoice`/`query_status` |
| `x-agentpay-max-amount` | optional | hard cap on the grand total (`MontoTotal`, incl. ITBIS, in DOP) — owner-set; the agent cannot relax it |
| `x-agentpay-approval-above` | optional | above this the invoice is **not** submitted; returns an unsubmitted draft for human review |
| `x-agentpay-allowed-tools` | optional | comma-separated tool allow-list |

```json
{
  "mcpServers": {
    "dominican-republic-invoice": {
      "type": "http",
      "url": "https://inv-do.wishpool.app/mcp",
      "headers": { "x-dgii-env": "prod" }
    }
  }
}
```

## Mandate

Electronic invoicing (**facturación electrónica / e-CF**) is **mandatory** in the Dominican Republic under **Law 32-23**, phased in by taxpayer size: large national taxpayers first, medium/small/micro phased through 2026. Every taxpayer must issue e-CF and report it to the DGII via these web services.

## Develop & test

```bash
npm run dev    # local server on http://localhost:3246 (simulates /mcp routing)
npm test       # full e2e: protocol + validation + policy + LIVE DGII TesteCF probes
```

The e2e suite includes **live** probes against the open DGII TesteCF environment: `GET Semilla` asserts `200` + `<valor>`, and a fake `POST ValidarSemilla` asserts the native `400 "Archivo no válido."` — no certificate required.

## Sister servers

Invoices: Costa Rica Hacienda (`inv-cr`), Saudi ZATCA (`inv-sa`), Mexico CFDI 4.0 (`inv-mx`), Poland KSeF (`inv-pl`), Chile DTE (`inv-cl`), Brazil NF-e (`inv-br`), Peru CPE (`inv-pe`), India GST (`inv-in`). Local payments in 81 countries and logistics, one family, same stateless pattern — see [mcp.wishpool.app](https://mcp.wishpool.app) · [logi.wishpool.app](https://logi.wishpool.app).

## License

MIT

Maintenance

ActivityMaintained
ResponsivenessSyncing