@centry-digital/bukku-mcp 1.1.0 → 1.1.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.
package/build/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centry-digital/bukku-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Bukku accounting API tools for Claude via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -1 +0,0 @@
1
- export {};
@@ -1,101 +0,0 @@
1
- import { describe, test } from 'node:test';
2
- import assert from 'node:assert';
3
- import { transformHttpError, transformNetworkError } from './transform.ts';
4
- describe('transformHttpError', () => {
5
- test('401 error produces auth failure message mentioning BUKKU_API_TOKEN', () => {
6
- const result = transformHttpError(401, { message: 'Unauthorized' }, 'create invoice');
7
- assert.strictEqual(result.isError, true);
8
- assert.ok(Array.isArray(result.content));
9
- assert.strictEqual(result.content.length, 1);
10
- assert.strictEqual(result.content[0].type, 'text');
11
- const text = result.content[0].text;
12
- assert.ok(text.includes('Bukku') || text.includes('token'), 'Should mention Bukku or token');
13
- assert.ok(text.includes('BUKKU_API_TOKEN'), 'Should mention BUKKU_API_TOKEN');
14
- assert.ok(text.length > 20, 'Should suggest next step');
15
- });
16
- test('403 error produces permission error with suggestion', () => {
17
- const result = transformHttpError(403, { message: 'Forbidden' }, 'list contacts');
18
- assert.strictEqual(result.isError, true);
19
- assert.strictEqual(result.content[0].type, 'text');
20
- const text = result.content[0].text;
21
- assert.ok(text.toLowerCase().includes('permission') || text.toLowerCase().includes('access'), 'Should mention permission or access');
22
- assert.ok(text.length > 20, 'Should suggest next step');
23
- });
24
- test('404 error suggests listing available items', () => {
25
- const result = transformHttpError(404, { message: 'Not found' }, 'get sales invoice');
26
- assert.strictEqual(result.isError, true);
27
- assert.strictEqual(result.content[0].type, 'text');
28
- const text = result.content[0].text;
29
- assert.ok(text.toLowerCase().includes("couldn't find") || text.toLowerCase().includes('not found'), 'Should indicate not found');
30
- assert.ok(text.toLowerCase().includes('list') || text.toLowerCase().includes('available'), 'Should suggest listing items');
31
- });
32
- test('400 error shows all validation errors at once', () => {
33
- const result = transformHttpError(400, {
34
- message: 'Validation failed',
35
- errors: {
36
- contact_id: ['required'],
37
- date: ['invalid format'],
38
- },
39
- }, 'create invoice');
40
- assert.strictEqual(result.isError, true);
41
- assert.strictEqual(result.content[0].type, 'text');
42
- const text = result.content[0].text;
43
- assert.ok(text.includes('contact_id'), 'Should include contact_id error');
44
- assert.ok(text.includes('date'), 'Should include date error');
45
- assert.ok(text.length > 20, 'Should suggest next step');
46
- });
47
- test('400 error without errors field shows message', () => {
48
- const result = transformHttpError(400, { message: 'Something wrong' }, 'update order');
49
- assert.strictEqual(result.isError, true);
50
- assert.strictEqual(result.content[0].type, 'text');
51
- const text = result.content[0].text;
52
- assert.ok(text.includes('Something wrong'), 'Should include error message');
53
- assert.ok(text.length > 20, 'Should suggest next step');
54
- });
55
- test('422 validation error handled like 400', () => {
56
- const result = transformHttpError(422, {
57
- message: 'Unprocessable',
58
- errors: {
59
- items: ['at least one item required'],
60
- },
61
- }, 'create invoice');
62
- assert.strictEqual(result.isError, true);
63
- assert.strictEqual(result.content[0].type, 'text');
64
- const text = result.content[0].text;
65
- assert.ok(text.includes('items'), 'Should include items error');
66
- assert.ok(text.length > 20, 'Should suggest next step');
67
- });
68
- test('500 error produces helpful fallback with retry suggestion', () => {
69
- const result = transformHttpError(500, { message: 'Internal error' }, 'list invoices');
70
- assert.strictEqual(result.isError, true);
71
- assert.strictEqual(result.content[0].type, 'text');
72
- const text = result.content[0].text;
73
- assert.ok(text.toLowerCase().includes('unexpected') || text.toLowerCase().includes('error'), 'Should indicate unexpected error');
74
- assert.ok(text.toLowerCase().includes('try') || text.toLowerCase().includes('again'), 'Should suggest trying again');
75
- });
76
- test('503 error suggests trying later', () => {
77
- const result = transformHttpError(503, { message: 'Service unavailable' }, 'create payment');
78
- assert.strictEqual(result.isError, true);
79
- assert.strictEqual(result.content[0].type, 'text');
80
- const text = result.content[0].text;
81
- assert.ok(text.toLowerCase().includes('unavailable') || text.toLowerCase().includes('temporarily'), 'Should indicate service unavailable');
82
- assert.ok(text.toLowerCase().includes('later') || text.toLowerCase().includes('try'), 'Should suggest trying later');
83
- });
84
- });
85
- describe('transformNetworkError', () => {
86
- test('network error suggests checking connection', () => {
87
- const networkError = new TypeError('Failed to fetch');
88
- const result = transformNetworkError(networkError, 'list contacts');
89
- assert.strictEqual(result.isError, true);
90
- assert.strictEqual(result.content[0].type, 'text');
91
- const text = result.content[0].text;
92
- assert.ok(text.toLowerCase().includes('connect') || text.toLowerCase().includes('network'), 'Should mention connection or network');
93
- assert.ok(text.length > 20, 'Should suggest next step');
94
- });
95
- test('handles unknown error gracefully', () => {
96
- const result = transformNetworkError('unknown error', 'create invoice');
97
- assert.strictEqual(result.isError, true);
98
- assert.strictEqual(result.content[0].type, 'text');
99
- assert.ok(result.content[0].text.length > 10, 'Should provide some error message');
100
- });
101
- });