mcp-server-acube 0.2.0 → 0.2.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 (2) hide show
  1. package/README.md +28 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -169,17 +169,21 @@ The server is configured through environment variables:
169
169
 
170
170
  This server is designed to minimize LLM token consumption. Every response goes through three optimizations:
171
171
 
172
- ### 1. Null stripping
172
+ ### 1. Payload parsing
173
173
 
174
- All `null` and `undefined` values are recursively removed from responses. A typical invoice `sender` object has ~40 fields, of which ~30 are null. After stripping, only the 5--8 populated fields remain.
174
+ The A-Cube API returns the FatturaPA invoice data as a raw JSON string in the `payload` field. The server automatically parses this string into a structured object, which enables null stripping to work on the ~60 null fields inside it. This eliminates double-encoding overhead (`\"` escapes) and typically cuts payload token usage by ~50%.
175
175
 
176
- ### 2. Compact JSON
176
+ ### 2. Null stripping
177
+
178
+ All `null` and `undefined` values are recursively removed from responses -- including inside the parsed payload. A typical invoice `sender` object has ~40 fields, of which ~30 are null. After stripping, only the 5--8 populated fields remain.
179
+
180
+ ### 3. Compact JSON
177
181
 
178
182
  Responses are serialized without indentation (`JSON.stringify(data)` instead of `JSON.stringify(data, null, 2)`). This eliminates whitespace tokens that provide no information to the LLM.
179
183
 
180
- ### 3. Default field selection on `list_invoices`
184
+ ### 4. Default field selection on `list_invoices`
181
185
 
182
- The `list_invoices` tool returns a **compact default view** instead of the full A-Cube response. The raw API response includes the entire FatturaPA payload (~2000 tokens per invoice) and full sender/recipient objects. The compact view extracts only the essential fields:
186
+ The `list_invoices` tool returns a **compact default view** (10 items per page) instead of the full A-Cube response. The raw API response includes the entire FatturaPA payload (~2000 tokens per invoice) and full sender/recipient objects. The compact view extracts only the essential fields:
183
187
 
184
188
  | Default field | Description |
185
189
  |---|---|
@@ -211,7 +215,7 @@ list_invoices(marking: "rejected")
211
215
  # Request specific fields
212
216
  list_invoices(marking: "rejected", fields: ["uuid", "notice", "recipient.business_name"])
213
217
 
214
- # Request all fields (full A-Cube response, nulls still stripped)
218
+ # Request all fields (payload parsed + nulls stripped)
215
219
  list_invoices(marking: "rejected", fields: ["*"])
216
220
 
217
221
  # Get specific fields from a single invoice
@@ -220,16 +224,28 @@ get_invoice(uuid: "...", fields: ["payload", "sender", "recipient"])
220
224
 
221
225
  The `fields` parameter supports **dot-notation** for nested objects (e.g., `sender.business_name`).
222
226
 
227
+ > **Tip:** Prefer the default compact view or specific fields over `["*"]`. Even with `["*"]`, the server parses payloads and strips nulls, but the full FatturaPA structure is still large. Use `["*"]` only when you truly need the complete invoice data.
228
+
229
+ ### Pagination
230
+
231
+ `list_invoices` defaults to **10 items per page** (`items_per_page`, max 30). Use the `page` parameter to navigate through results.
232
+
223
233
  ### Estimated token savings
224
234
 
225
235
  For a typical `list_invoices` call returning 10 invoices:
226
236
 
227
- | Metric | Without optimization | With optimization |
237
+ | Scenario | Without optimization | With optimization |
238
+ |---|---|---|
239
+ | **Default view** (compact fields) | ~25,000 tokens | **~1,500 tokens** |
240
+ | **`fields: ["*"]`** (full data) | ~25,000 tokens | **~10,000 tokens** |
241
+
242
+ Key reductions with `fields: ["*"]`:
243
+
244
+ | Metric | Before | After |
228
245
  |---|---|---|
229
- | Null fields per invoice | ~60 | 0 |
230
- | Payload per invoice | ~2000 tokens | 0 (excluded) |
231
- | JSON whitespace | ~500 tokens | 0 |
232
- | **Total** | **~25,000 tokens** | **~1,500 tokens** |
246
+ | Null fields per invoice | ~60 | 0 (stripped) |
247
+ | Payload encoding | Double-encoded string (`\"`) | Parsed object (no escaping) |
248
+ | Payload null fields | ~60 (hidden in string) | 0 (stripped) |
233
249
 
234
250
  ## Usage Examples
235
251
 
@@ -409,6 +425,7 @@ The following events can be subscribed to via `create_webhook_config`:
409
425
 
410
426
  ## Links
411
427
 
428
+ - [npm package](https://www.npmjs.com/package/mcp-server-acube)
412
429
  - [A-Cube API Documentation](https://docs.acubeapi.com/)
413
430
  - [A-Cube Website](https://www.acubeapi.com/)
414
431
  - [Model Context Protocol (MCP)](https://modelcontextprotocol.io)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-acube",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "MCP server for A-Cube API - Italian electronic invoicing (SDI/FatturaPA), smart receipts, company verification, and more",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",