@dojocoding/hacienda-mcp 0.2.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dojo Coding Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @dojocoding/hacienda-mcp
2
+
3
+ MCP (Model Context Protocol) Server for Costa Rica electronic invoicing (Hacienda API v4.4).
4
+
5
+ Exposes the `@dojocoding/hacienda-sdk` as AI-accessible tools and resources via the Model Context Protocol, allowing AI assistants like Claude Desktop to create invoices, check document status, and look up taxpayer information.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g @dojocoding/hacienda-mcp
11
+ ```
12
+
13
+ Requires **Node.js 22+**.
14
+
15
+ ## Setup
16
+
17
+ ### Claude Desktop
18
+
19
+ Add this to your Claude Desktop configuration file:
20
+
21
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
22
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "hacienda-cr": {
28
+ "command": "npx",
29
+ "args": ["-y", "@dojocoding/hacienda-mcp"]
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ Or if installed globally:
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "hacienda-cr": {
41
+ "command": "hacienda-mcp"
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### Other MCP Clients
48
+
49
+ The server uses stdio transport. Start it with:
50
+
51
+ ```bash
52
+ npx @dojocoding/hacienda-mcp
53
+ # or
54
+ hacienda-mcp
55
+ ```
56
+
57
+ ### Programmatic Usage
58
+
59
+ ```ts
60
+ import { createServer } from "@dojocoding/hacienda-mcp";
61
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
62
+
63
+ const server = createServer();
64
+ const transport = new StdioServerTransport();
65
+ await server.connect(transport);
66
+ ```
67
+
68
+ ## Tools
69
+
70
+ ### `create_invoice`
71
+
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.
73
+
74
+ **Parameters:**
75
+
76
+ - `emisor` -- Issuer information (name, ID, email)
77
+ - `receptor` -- Receiver information (name, optional ID, optional email)
78
+ - `codigoActividad` -- CABYS activity code (6 digits)
79
+ - `condicionVenta` -- Sale condition code (default: `"01"` = cash)
80
+ - `medioPago` -- Payment methods array (default: `["01"]` = cash)
81
+ - `lineItems` -- Array of line items with CABYS code, quantity, unit, description, price, and optional tax/discount
82
+ - `plazoCredito` -- Credit term in days (optional)
83
+
84
+ ### `check_status`
85
+
86
+ Check the processing status of a document by its 50-digit clave numerica.
87
+
88
+ **Parameters:**
89
+
90
+ - `clave` -- The 50-digit clave numerica
91
+
92
+ ### `list_documents`
93
+
94
+ List recent electronic documents with optional filters.
95
+
96
+ **Parameters:**
97
+
98
+ - `limit` -- Max results (1-100, default: 10)
99
+ - `offset` -- Pagination offset (default: 0)
100
+ - `emisorIdentificacion` -- Filter by issuer ID (optional)
101
+ - `receptorIdentificacion` -- Filter by receiver ID (optional)
102
+ - `fechaDesde` -- Start date filter, ISO 8601 (optional)
103
+ - `fechaHasta` -- End date filter, ISO 8601 (optional)
104
+
105
+ ### `get_document`
106
+
107
+ Get full details of an electronic document by its 50-digit clave numerica.
108
+
109
+ **Parameters:**
110
+
111
+ - `clave` -- The 50-digit clave numerica
112
+
113
+ ### `lookup_taxpayer`
114
+
115
+ Look up a Costa Rica taxpayer by identification number (cedula). Returns name, ID type, and registered economic activities.
116
+
117
+ **Parameters:**
118
+
119
+ - `identificacion` -- Taxpayer ID number (9-12 digits)
120
+
121
+ ### `draft_invoice`
122
+
123
+ Generate a draft invoice template with sensible defaults. Returns JSON that can be passed to `create_invoice`.
124
+
125
+ **Parameters:**
126
+
127
+ - `emisorNombre` -- Issuer name
128
+ - `emisorIdTipo` -- Issuer ID type (default: `"02"`)
129
+ - `emisorIdNumero` -- Issuer ID number
130
+ - `emisorEmail` -- Issuer email
131
+ - `receptorNombre` -- Receiver name
132
+ - `receptorIdTipo` -- Receiver ID type (optional)
133
+ - `receptorIdNumero` -- Receiver ID number (optional)
134
+ - `receptorEmail` -- Receiver email (optional)
135
+ - `codigoActividad` -- Activity code (default: `"620100"`)
136
+ - `description` -- Default line item description (default: `"Servicio profesional"`)
137
+ - `amount` -- Default line item amount (default: `0`)
138
+ - `includeIva` -- Include 13% IVA (default: `true`)
139
+
140
+ ## Resources
141
+
142
+ | URI | Description |
143
+ | ------------------------------------- | ------------------------------------------ |
144
+ | `hacienda://schemas/factura` | JSON schema for invoice creation input |
145
+ | `hacienda://reference/document-types` | Document types, codes, and descriptions |
146
+ | `hacienda://reference/tax-codes` | Tax codes, IVA rates, and units of measure |
147
+ | `hacienda://reference/id-types` | Identification types and validation rules |
148
+
149
+ ## Full Documentation
150
+
151
+ See the [root README](../../README.md) for comprehensive documentation with examples.