@dojocoding/hacienda-mcp 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +58 -8
  3. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @dojocoding/hacienda-mcp
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - Updated dependencies [7c800ab]
9
+ - Updated dependencies [682bce8]
10
+ - @dojocoding/hacienda-shared@0.4.1
11
+ - @dojocoding/hacienda-sdk@0.4.1
12
+
3
13
  ## 0.4.0
4
14
 
5
15
  - Declare Node.js 22+ and public package metadata; verify installed TypeScript consumers and ship corrected upgrade documentation.
package/README.md CHANGED
@@ -65,23 +65,65 @@ const transport = new StdioServerTransport();
65
65
  await server.connect(transport);
66
66
  ```
67
67
 
68
+ ## Authentication and document lifecycle
69
+
70
+ `lookup_taxpayer`, `draft_invoice`, and `create_invoice` do not need IDP
71
+ authentication. `draft_invoice` produces a template with provider and issuer
72
+ location placeholders. Complete these and review the activity, CABYS, taxes,
73
+ and customer before passing it to `create_invoice`.
74
+
75
+ `create_invoice` returns **unsigned XML**, its clave, and calculated totals. It
76
+ does not sign or submit to Hacienda. It increments the default local sequence
77
+ store for document type `01`, branch `001`, POS `00001`; the counter does not
78
+ separate issuers or environments. Save the returned XML and clave before
79
+ handing them to your backend for validation, signing, submission, and status
80
+ tracking. Repeating `create_invoice` allocates a new number and clave.
81
+
82
+ `check_status`, `list_documents`, and `get_document` need a saved profile and
83
+ `HACIENDA_PASSWORD` in the **MCP server process**. First create the profile with
84
+ the CLI (using the corresponding password in its environment):
85
+
86
+ ```bash
87
+ hacienda auth login --cedula-type 02 --cedula 3101234567 \
88
+ --environment sandbox --profile sandbox
89
+ ```
90
+
91
+ Replace the identification with your issuer's. Select `profile: "sandbox"`
92
+ when calling these tools; all three default to `"default"`. A desktop client's
93
+ server may not inherit your terminal's environment. Use your client's secret
94
+ or environment configuration to supply `HACIENDA_PASSWORD` to the server. The
95
+ password is not stored by `auth login`; saving a profile alone is insufficient.
96
+ Restart the server after updating profiles or credentials because authenticated
97
+ clients are cached by profile name.
98
+
99
+ For a complete SDK handoff, see the [sandbox walkthrough](https://github.com/DojoCodingLabs/hacienda-cr/blob/main/docs/sandbox-guide.md#usar-la-cli-o-mcp-en-el-mismo-flujo).
100
+ For multiple companies or application instances, see the
101
+ [production integration guide](https://github.com/DojoCodingLabs/hacienda-cr/blob/main/docs/production-integration.md).
102
+
68
103
  ## Tools
69
104
 
70
105
  ### `create_invoice`
71
106
 
72
- Create a Factura Electronica (electronic invoice). Accepts emisor, receptor, and line items. Automatically computes taxes, totals, generates the clave numerica, and builds the XML.
107
+ Create a Factura Electronica (electronic invoice). Automatically computes taxes,
108
+ totals, generates the clave numerica, validates input and XSD, and returns
109
+ unsigned XML. Local validation does not imply Hacienda acceptance.
73
110
 
74
111
  **Parameters:**
75
112
 
76
- - `emisor` -- Issuer information (name, ID, email)
113
+ - `proveedorSistemas` -- Required identification of the invoicing system provider (9–12 digits)
114
+ - `emisor` -- Issuer information: name, ID, email, and required `ubicacion` with `provincia`, `canton`, `distrito`, `otrasSenas`; optional `nombreComercial`
77
115
  - `receptor` -- Receiver information (name, optional ID, optional email)
78
- - `codigoActividadEmisor` -- Issuer economic activity code (6 digits)
79
- - `proveedorSistemas` -- Actual invoicing-system provider ID (required; no issuer fallback)
116
+ - `codigoActividadEmisor` -- Issuer economic activity code (6 digits), distinct from each item's 13-digit CABYS code
80
117
  - `condicionVenta` -- Sale condition code (default: `"01"` = cash)
81
- - `medioPago` -- Payment method code (default: `"01"` = cash; emitted inside ResumenFactura per v4.4)
82
- - `lineItems` -- Array of line items with CABYS code, quantity, unit, description, price, and optional tax/discount
118
+ - `medioPago` -- Single payment-method string (default: `"01"` = cash); emitted with its amount inside `ResumenFactura`
119
+ - `lineItems` -- Array of 1–1000 items with `codigoCabys`, `cantidad`, `unidadMedida`, `detalle`, `precioUnitario`, optional `impuesto` (up to 10), `descuento` (up to 5), and `esServicio` (defaults to `false`; set `true` for services)
83
120
  - `plazoCredito` -- Credit term in days (optional)
84
121
 
122
+ `plazoCredito` is a string and is required for credit sales (`condicionVenta: "02"`).
123
+ Tax inputs contain `codigo`, `tarifa`, and optional `codigoTarifaIVA`; discount
124
+ inputs contain `montoDescuento`, `naturalezaDescuento`, and `codigoDescuento` (defaults to `"01"`). The tool calculates
125
+ the resulting amounts.
126
+
85
127
  ### `check_status`
86
128
 
87
129
  Check the processing status of a document by its 50-digit clave numerica.
@@ -89,6 +131,7 @@ Check the processing status of a document by its 50-digit clave numerica.
89
131
  **Parameters:**
90
132
 
91
133
  - `clave` -- The 50-digit clave numerica
134
+ - `profile` -- Saved profile name (default: `"default"`); requires server password environment
92
135
 
93
136
  ### `list_documents`
94
137
 
@@ -102,6 +145,7 @@ List recent electronic documents with optional filters.
102
145
  - `receptorIdentificacion` -- Filter by receiver ID (optional)
103
146
  - `fechaDesde` -- Start date filter, ISO 8601 (optional)
104
147
  - `fechaHasta` -- End date filter, ISO 8601 (optional)
148
+ - `profile` -- Saved profile name (default: `"default"`); requires server password environment
105
149
 
106
150
  ### `get_document`
107
151
 
@@ -110,6 +154,7 @@ Get full details of an electronic document by its 50-digit clave numerica.
110
154
  **Parameters:**
111
155
 
112
156
  - `clave` -- The 50-digit clave numerica
157
+ - `profile` -- Saved profile name (default: `"default"`); requires server password environment
113
158
 
114
159
  ### `lookup_taxpayer`
115
160
 
@@ -121,7 +166,10 @@ Look up a Costa Rica taxpayer by identification number (cedula). Returns name, I
121
166
 
122
167
  ### `draft_invoice`
123
168
 
124
- Generate a draft invoice template with sensible defaults. Returns JSON that can be passed to `create_invoice`.
169
+ Generate a draft invoice template. Fill in `proveedorSistemas` and issuer
170
+ location placeholders, review the default CABYS/activity and tax inputs, then
171
+ pass the completed JSON to `create_invoice`. It is not the full invoice JSON
172
+ accepted by CLI `submit`.
125
173
 
126
174
  **Parameters:**
127
175
 
@@ -149,7 +197,9 @@ Generate a draft invoice template with sensible defaults. Returns JSON that can
149
197
 
150
198
  ## Full Documentation
151
199
 
152
- See the [root README](https://github.com/DojoCodingLabs/hacienda-cr#readme) for comprehensive documentation with examples.
200
+ See the [MCP reference](https://github.com/DojoCodingLabs/hacienda-cr/blob/main/docs/reference.md#mcp-server--integración-con-ia),
201
+ [sandbox walkthrough](https://github.com/DojoCodingLabs/hacienda-cr/blob/main/docs/sandbox-guide.md), and
202
+ [production integration guide](https://github.com/DojoCodingLabs/hacienda-cr/blob/main/docs/production-integration.md).
153
203
 
154
204
  ## Migrating to 0.4.0
155
205
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dojocoding/hacienda-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "MCP Server for Costa Rica electronic invoicing (AI-accessible tools)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,11 +28,11 @@
28
28
  "model-context-protocol"
29
29
  ],
30
30
  "dependencies": {
31
+ "@dojocoding/hacienda-sdk": "0.4.1",
32
+ "@dojocoding/hacienda-shared": "0.4.1",
31
33
  "@modelcontextprotocol/sdk": "^1.32.0",
32
34
  "xmllint-wasm": "^5.3.0",
33
- "zod": "^4.6.5",
34
- "@dojocoding/hacienda-sdk": "0.4.0",
35
- "@dojocoding/hacienda-shared": "0.4.0"
35
+ "zod": "^4.6.5"
36
36
  },
37
37
  "license": "MIT",
38
38
  "author": "Dojo Coding Labs <dev@dojocoding.io> (https://dojocoding.io)",
@@ -57,4 +57,4 @@
57
57
  "test:watch": "vitest",
58
58
  "test:coverage": "vitest run --coverage"
59
59
  }
60
- }
60
+ }