@codemill-solutions/yuki-mcp 1.0.0 → 1.0.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/dist/index.d.ts +1 -1
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/tools/accounting.d.ts +2 -2
- package/dist/tools/accounting.d.ts.map +1 -1
- package/dist/tools/accounting.js +14 -17
- package/dist/tools/accounting.js.map +1 -1
- package/dist/tools/administrations.d.ts +2 -2
- package/dist/tools/administrations.d.ts.map +1 -1
- package/dist/tools/administrations.js +9 -9
- package/dist/tools/administrations.js.map +1 -1
- package/dist/tools/documents.d.ts +2 -2
- package/dist/tools/documents.d.ts.map +1 -1
- package/dist/tools/documents.js +87 -79
- package/dist/tools/documents.js.map +1 -1
- package/dist/tools/invoices.d.ts +2 -2
- package/dist/tools/invoices.d.ts.map +1 -1
- package/dist/tools/invoices.js +231 -190
- package/dist/tools/invoices.js.map +1 -1
- package/dist/tools/relations.d.ts +2 -2
- package/dist/tools/relations.d.ts.map +1 -1
- package/dist/tools/relations.js +106 -88
- package/dist/tools/relations.js.map +1 -1
- package/dist/tools/transactions.d.ts +2 -2
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +71 -63
- package/dist/tools/transactions.js.map +1 -1
- package/dist/yuki-client.d.ts.map +1 -1
- package/dist/yuki-client.js +42 -42
- package/dist/yuki-client.js.map +1 -1
- package/package.json +9 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'dotenv/config';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { McpServer } from
|
|
3
|
-
import { StdioServerTransport } from
|
|
4
|
-
import { YukiClient } from
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { YukiClient } from './yuki-client.js';
|
|
5
5
|
// Read tools
|
|
6
|
-
import { registerAdministrationTools } from
|
|
7
|
-
import { registerRelationTools } from
|
|
8
|
-
import { registerInvoiceTools } from
|
|
9
|
-
import { registerTransactionTools } from
|
|
10
|
-
import { registerAccountingTools } from
|
|
6
|
+
import { registerAdministrationTools } from './tools/administrations.js';
|
|
7
|
+
import { registerRelationTools } from './tools/relations.js';
|
|
8
|
+
import { registerInvoiceTools } from './tools/invoices.js';
|
|
9
|
+
import { registerTransactionTools } from './tools/transactions.js';
|
|
10
|
+
import { registerAccountingTools } from './tools/accounting.js';
|
|
11
11
|
// Write tools
|
|
12
|
-
import { registerInvoiceWriteTools } from
|
|
13
|
-
import { registerJournalWriteTools } from
|
|
14
|
-
import { registerContactWriteTools } from
|
|
15
|
-
import { registerDocumentTools } from
|
|
12
|
+
import { registerInvoiceWriteTools } from './tools/invoices.js';
|
|
13
|
+
import { registerJournalWriteTools } from './tools/transactions.js';
|
|
14
|
+
import { registerContactWriteTools } from './tools/relations.js';
|
|
15
|
+
import { registerDocumentTools } from './tools/documents.js';
|
|
16
16
|
// ── Environment validation ────────────────────────────────────────────────────
|
|
17
|
-
const apiKey = process.env[
|
|
18
|
-
const domainId = process.env[
|
|
17
|
+
const apiKey = process.env['YUKI_API_KEY'];
|
|
18
|
+
const domainId = process.env['YUKI_DOMAIN_ID'] ?? '';
|
|
19
19
|
if (!apiKey) {
|
|
20
20
|
// Write to stderr so the MCP host can surface the message without corrupting
|
|
21
21
|
// the stdio JSON-RPC stream used by the MCP protocol.
|
|
22
|
-
process.stderr.write(
|
|
22
|
+
process.stderr.write('[yuki-mcp] Fatal: YUKI_API_KEY environment variable is not set.\n');
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
// ── Yuki SOAP client ──────────────────────────────────────────────────────────
|
|
26
26
|
const yukiClient = new YukiClient(apiKey, domainId);
|
|
27
27
|
// ── MCP server ────────────────────────────────────────────────────────────────
|
|
28
28
|
const server = new McpServer({
|
|
29
|
-
name:
|
|
30
|
-
version:
|
|
29
|
+
name: 'yuki-mcp',
|
|
30
|
+
version: '1.0.0',
|
|
31
31
|
});
|
|
32
32
|
// ── Read tools ────────────────────────────────────────────────────────────────
|
|
33
33
|
registerAdministrationTools(server, yukiClient);
|
|
@@ -45,5 +45,5 @@ const transport = new StdioServerTransport();
|
|
|
45
45
|
await server.connect(transport);
|
|
46
46
|
// Log startup info to stderr only (stdout is reserved for JSON-RPC)
|
|
47
47
|
process.stderr.write(`[yuki-mcp] Server started — 14 tools registered. ` +
|
|
48
|
-
`Domain ID: ${domainId ||
|
|
48
|
+
`Domain ID: ${domainId || '(none — run get_administrations to discover)'}\n`);
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,aAAa;AACb,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,cAAc;AACd,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB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|
|
1
|
-
import { McpServer } from
|
|
2
|
-
import { YukiClient } from
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { YukiClient } from '../yuki-client.js';
|
|
3
3
|
/**
|
|
4
4
|
* Register tools for working with the Yuki chart of accounts.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting.d.ts","sourceRoot":"","sources":["../../src/tools/accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"accounting.d.ts","sourceRoot":"","sources":["../../src/tools/accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAoFnF"}
|
package/dist/tools/accounting.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Register tools for working with the Yuki chart of accounts.
|
|
4
4
|
*
|
|
@@ -22,32 +22,29 @@ export function registerAccountingTools(server, client) {
|
|
|
22
22
|
*
|
|
23
23
|
* Rate cost: 1 request.
|
|
24
24
|
*/
|
|
25
|
-
server.registerTool(
|
|
26
|
-
description:
|
|
27
|
-
|
|
25
|
+
server.registerTool('get_gl_accounts', {
|
|
26
|
+
description: 'Retrieve all GL accounts (grootboekrekeningen) with their balance at a given date. ' +
|
|
27
|
+
'Use this to find account codes (e.g. bank account codes) or get a financial snapshot. ' +
|
|
28
28
|
"Defaults to today's date if no date is provided.",
|
|
29
29
|
inputSchema: {
|
|
30
|
-
date: z
|
|
31
|
-
.string()
|
|
32
|
-
.optional()
|
|
33
|
-
.describe("Date for the balance snapshot in YYYY-MM-DD format. Defaults to today."),
|
|
30
|
+
date: z.string().optional().describe('Date for the balance snapshot in YYYY-MM-DD format. Defaults to today.'),
|
|
34
31
|
administrationId: z
|
|
35
32
|
.string()
|
|
36
33
|
.optional()
|
|
37
|
-
.describe(
|
|
34
|
+
.describe('Administration ID (GUID). Defaults to YUKI_DOMAIN_ID env var.'),
|
|
38
35
|
},
|
|
39
36
|
}, async ({ date, administrationId }) => {
|
|
40
37
|
try {
|
|
41
38
|
const adminId = administrationId ?? client.defaultDomainId;
|
|
42
39
|
if (!adminId) {
|
|
43
|
-
throw new Error(
|
|
40
|
+
throw new Error('administrationId is required (or set YUKI_DOMAIN_ID env var)');
|
|
44
41
|
}
|
|
45
42
|
const sessionID = await client.getSessionID();
|
|
46
43
|
// Default to today's date in ISO format when not specified
|
|
47
|
-
const transactionDate = date ?? new Date().toISOString().split(
|
|
44
|
+
const transactionDate = date ?? new Date().toISOString().split('T')[0];
|
|
48
45
|
const result = await client.callSoap({
|
|
49
|
-
service:
|
|
50
|
-
method:
|
|
46
|
+
service: 'Accounting.asmx',
|
|
47
|
+
method: 'GLAccountBalance',
|
|
51
48
|
params: {
|
|
52
49
|
sessionID,
|
|
53
50
|
administrationID: adminId,
|
|
@@ -58,7 +55,7 @@ export function registerAccountingTools(server, client) {
|
|
|
58
55
|
return {
|
|
59
56
|
content: [
|
|
60
57
|
{
|
|
61
|
-
type:
|
|
58
|
+
type: 'text',
|
|
62
59
|
text: JSON.stringify({
|
|
63
60
|
success: true,
|
|
64
61
|
count: accounts.length,
|
|
@@ -74,7 +71,7 @@ export function registerAccountingTools(server, client) {
|
|
|
74
71
|
return {
|
|
75
72
|
content: [
|
|
76
73
|
{
|
|
77
|
-
type:
|
|
74
|
+
type: 'text',
|
|
78
75
|
text: JSON.stringify({ success: false, error: message }, null, 2),
|
|
79
76
|
},
|
|
80
77
|
],
|
|
@@ -90,8 +87,8 @@ function normalizeGLAccounts(result) {
|
|
|
90
87
|
if (Array.isArray(result))
|
|
91
88
|
return result;
|
|
92
89
|
const rec = result;
|
|
93
|
-
const wrappers = [
|
|
94
|
-
const itemTags = [
|
|
90
|
+
const wrappers = ['GLAccounts', 'Accounts', 'Rows'];
|
|
91
|
+
const itemTags = ['GLAccount', 'Account', 'Row'];
|
|
95
92
|
for (const wrapper of wrappers) {
|
|
96
93
|
const c = rec[wrapper];
|
|
97
94
|
if (!c)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting.js","sourceRoot":"","sources":["../../src/tools/accounting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,
|
|
1
|
+
{"version":3,"file":"accounting.js","sourceRoot":"","sources":["../../src/tools/accounting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,MAAkB;IAC3E;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,qFAAqF;YACrF,wFAAwF;YACxF,kDAAkD;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC;YAC9G,gBAAgB,EAAE,CAAC;iBAChB,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,+DAA+D,CAAC;SAC7E;KACF,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,gBAAgB,IAAI,MAAM,CAA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CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { McpServer } from
|
|
2
|
-
import { YukiClient } from
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { YukiClient } from '../yuki-client.js';
|
|
3
3
|
/**
|
|
4
4
|
* Register tools related to Yuki administrations.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administrations.d.ts","sourceRoot":"","sources":["../../src/tools/administrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"administrations.d.ts","sourceRoot":"","sources":["../../src/tools/administrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAqDvF"}
|
|
@@ -18,24 +18,24 @@ export function registerAdministrationTools(server, client) {
|
|
|
18
18
|
* Rate cost: 2 requests (1× Authenticate + 1× Administrations).
|
|
19
19
|
* On subsequent calls within the same session, Authenticate is skipped: 1 request.
|
|
20
20
|
*/
|
|
21
|
-
server.registerTool(
|
|
22
|
-
description:
|
|
23
|
-
|
|
21
|
+
server.registerTool('get_administrations', {
|
|
22
|
+
description: 'List all Yuki administrations (companies) accessible with the configured API key. ' +
|
|
23
|
+
'Run this first to discover the correct administrationID to pass to other tools.',
|
|
24
24
|
}, async () => {
|
|
25
25
|
try {
|
|
26
26
|
// Step 1 — Authenticate and obtain (cached) sessionID
|
|
27
27
|
const sessionID = await client.getSessionID();
|
|
28
28
|
// Step 2 — Fetch administrations for this session
|
|
29
29
|
const result = await client.callSoap({
|
|
30
|
-
service:
|
|
31
|
-
method:
|
|
30
|
+
service: 'Accounting.asmx',
|
|
31
|
+
method: 'Administrations',
|
|
32
32
|
params: { sessionID },
|
|
33
33
|
});
|
|
34
34
|
const administrations = normalizeAdministrations(result);
|
|
35
35
|
return {
|
|
36
36
|
content: [
|
|
37
37
|
{
|
|
38
|
-
type:
|
|
38
|
+
type: 'text',
|
|
39
39
|
text: JSON.stringify({ success: true, count: administrations.length, administrations }, null, 2),
|
|
40
40
|
},
|
|
41
41
|
],
|
|
@@ -46,7 +46,7 @@ export function registerAdministrationTools(server, client) {
|
|
|
46
46
|
return {
|
|
47
47
|
content: [
|
|
48
48
|
{
|
|
49
|
-
type:
|
|
49
|
+
type: 'text',
|
|
50
50
|
text: JSON.stringify({ success: false, error: message }, null, 2),
|
|
51
51
|
},
|
|
52
52
|
],
|
|
@@ -63,13 +63,13 @@ function normalizeAdministrations(result) {
|
|
|
63
63
|
return result;
|
|
64
64
|
const rec = result;
|
|
65
65
|
// The Administrations response wraps items in <Administrations><Administration>
|
|
66
|
-
const containers = [rec[
|
|
66
|
+
const containers = [rec['Administrations'], rec['administrations'], result];
|
|
67
67
|
for (const c of containers) {
|
|
68
68
|
if (!c)
|
|
69
69
|
continue;
|
|
70
70
|
if (Array.isArray(c))
|
|
71
71
|
return c;
|
|
72
|
-
const inner = c[
|
|
72
|
+
const inner = c['Administration'];
|
|
73
73
|
if (Array.isArray(inner))
|
|
74
74
|
return inner;
|
|
75
75
|
if (inner)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"administrations.js","sourceRoot":"","sources":["../../src/tools/administrations.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,
|
|
1
|
+
{"version":3,"file":"administrations.js","sourceRoot":"","sources":["../../src/tools/administrations.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG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B,CAAC,MAAe;IAC/C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAEzC,MAAM,GAAG,GAAG,MAAiC,CAAC;IAE9C,gFAAgF;IAChF,MAAM,UAAU,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5E,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAI,CAA6B,CAAC,gBAAgB,CAAC,CAAC;QAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACvC,IAAI,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { McpServer } from
|
|
2
|
-
import { YukiClient } from
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { YukiClient } from '../yuki-client.js';
|
|
3
3
|
/**
|
|
4
4
|
* Register tools for uploading documents to the Yuki archive.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAyTjF"}
|
package/dist/tools/documents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { readFileSync, existsSync } from
|
|
3
|
-
import { basename } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readFileSync, existsSync } from 'fs';
|
|
3
|
+
import { basename } from 'path';
|
|
4
4
|
/**
|
|
5
5
|
* Register tools for uploading documents to the Yuki archive.
|
|
6
6
|
*
|
|
@@ -33,51 +33,52 @@ export function registerDocumentTools(server, client) {
|
|
|
33
33
|
*
|
|
34
34
|
* Rate cost: 1 request.
|
|
35
35
|
*/
|
|
36
|
-
server.registerTool(
|
|
37
|
-
description:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
server.registerTool('upload_document', {
|
|
37
|
+
description: 'Upload a document (PDF) to the Yuki archive with financial metadata. ' +
|
|
38
|
+
'Use this to attach source documents to purchase invoices or store receipts. ' +
|
|
39
|
+
'The document must be provided as a base64-encoded string. ' +
|
|
40
|
+
'Call get_document_folders first to find the correct folder ID.',
|
|
41
41
|
inputSchema: {
|
|
42
|
-
fileName: z.string()
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
amount: z.number().optional()
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
remarks: z.string().optional()
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.
|
|
42
|
+
fileName: z.string().describe("File name including extension (e.g. 'invoice-2024-0042.pdf')"),
|
|
43
|
+
dataBase64: z.string().describe('File content encoded as a base64 string'),
|
|
44
|
+
folder: z
|
|
45
|
+
.number()
|
|
46
|
+
.int()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe('Archive folder ID. Use get_document_folders to list available folders.'),
|
|
49
|
+
currency: z.string().optional().default('EUR').describe('ISO 4217 currency code for the document amount'),
|
|
50
|
+
amount: z.number().optional().describe('Total amount on the document (e.g. invoice total including VAT)'),
|
|
51
|
+
costCategory: z.string().optional().describe("GL account code for automatic cost categorisation (e.g. '4000')"),
|
|
52
|
+
paymentMethod: z
|
|
53
|
+
.number()
|
|
54
|
+
.int()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Payment method code. 0 = unknown, 1 = transfer, 2 = direct collection'),
|
|
57
|
+
project: z.string().optional().describe('Project code to link this document to a Yuki project'),
|
|
58
|
+
remarks: z.string().optional().describe('Internal remarks shown in the archive'),
|
|
59
|
+
administrationId: z
|
|
60
|
+
.string()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Administration ID (GUID). Defaults to YUKI_DOMAIN_ID env var.'),
|
|
62
63
|
},
|
|
63
|
-
}, async ({ fileName, dataBase64, folder, currency, amount, costCategory, paymentMethod, project, remarks, administrationId }) => {
|
|
64
|
+
}, async ({ fileName, dataBase64, folder, currency, amount, costCategory, paymentMethod, project, remarks, administrationId, }) => {
|
|
64
65
|
try {
|
|
65
66
|
const adminId = administrationId ?? client.defaultDomainId;
|
|
66
67
|
if (!adminId) {
|
|
67
|
-
throw new Error(
|
|
68
|
+
throw new Error('administrationId is required (or set YUKI_DOMAIN_ID env var)');
|
|
68
69
|
}
|
|
69
70
|
const sessionID = await client.getSessionID();
|
|
70
71
|
// Archive.asmx uses sessionID / administrationID (uppercase D)
|
|
71
72
|
const result = await client.callSoap({
|
|
72
|
-
service:
|
|
73
|
-
method:
|
|
73
|
+
service: 'Archive.asmx',
|
|
74
|
+
method: 'UploadDocumentWithData',
|
|
74
75
|
params: {
|
|
75
76
|
sessionID,
|
|
76
77
|
fileName,
|
|
77
78
|
data: dataBase64,
|
|
78
79
|
...(folder !== undefined && { folder }),
|
|
79
80
|
administrationID: adminId,
|
|
80
|
-
currency: currency ??
|
|
81
|
+
currency: currency ?? 'EUR',
|
|
81
82
|
...(amount !== undefined && { amount }),
|
|
82
83
|
...(costCategory !== undefined && { costCategory }),
|
|
83
84
|
...(paymentMethod !== undefined && { paymentMethod }),
|
|
@@ -88,7 +89,7 @@ export function registerDocumentTools(server, client) {
|
|
|
88
89
|
return {
|
|
89
90
|
content: [
|
|
90
91
|
{
|
|
91
|
-
type:
|
|
92
|
+
type: 'text',
|
|
92
93
|
text: JSON.stringify({ success: true, fileName, result }, null, 2),
|
|
93
94
|
},
|
|
94
95
|
],
|
|
@@ -99,7 +100,7 @@ export function registerDocumentTools(server, client) {
|
|
|
99
100
|
return {
|
|
100
101
|
content: [
|
|
101
102
|
{
|
|
102
|
-
type:
|
|
103
|
+
type: 'text',
|
|
103
104
|
text: JSON.stringify({ success: false, error: message }, null, 2),
|
|
104
105
|
},
|
|
105
106
|
],
|
|
@@ -117,38 +118,44 @@ export function registerDocumentTools(server, client) {
|
|
|
117
118
|
*
|
|
118
119
|
* Rate cost: 1 request.
|
|
119
120
|
*/
|
|
120
|
-
server.registerTool(
|
|
121
|
-
description:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
server.registerTool('upload_document_from_path', {
|
|
122
|
+
description: 'Upload a PDF from a local file path to the Yuki archive. ' +
|
|
123
|
+
'Reads and encodes the file internally — no need to pass base64 strings. ' +
|
|
124
|
+
'Use this instead of upload_document when the file is available on disk. ' +
|
|
125
|
+
'Call get_document_folders first to find the correct folder ID.',
|
|
125
126
|
inputSchema: {
|
|
126
|
-
filePath: z
|
|
127
|
+
filePath: z
|
|
128
|
+
.string()
|
|
127
129
|
.describe("Absolute path to the file on the local filesystem (e.g. '/tmp/invoice-2024-0042.pdf')"),
|
|
128
|
-
fileName: z
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
.describe(
|
|
132
|
-
|
|
133
|
-
.
|
|
134
|
-
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
fileName: z
|
|
131
|
+
.string()
|
|
132
|
+
.optional()
|
|
133
|
+
.describe('Override the file name sent to Yuki. Defaults to the basename of filePath.'),
|
|
134
|
+
folder: z
|
|
135
|
+
.number()
|
|
136
|
+
.int()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe('Archive folder ID. Use get_document_folders to list available folders.'),
|
|
139
|
+
currency: z.string().optional().default('EUR').describe('ISO 4217 currency code for the document amount'),
|
|
140
|
+
amount: z.number().optional().describe('Total amount on the document (e.g. invoice total including VAT)'),
|
|
141
|
+
costCategory: z.string().optional().describe("GL account code for automatic cost categorisation (e.g. '4000')"),
|
|
142
|
+
paymentMethod: z
|
|
143
|
+
.number()
|
|
144
|
+
.int()
|
|
145
|
+
.optional()
|
|
146
|
+
.describe('Payment method code. 0 = unknown, 1 = transfer, 2 = direct collection'),
|
|
147
|
+
project: z.string().optional().describe('Project code to link this document to a Yuki project'),
|
|
148
|
+
remarks: z.string().optional().describe('Internal remarks shown in the archive'),
|
|
149
|
+
administrationId: z
|
|
150
|
+
.string()
|
|
151
|
+
.optional()
|
|
152
|
+
.describe('Administration ID (GUID). Defaults to YUKI_DOMAIN_ID env var.'),
|
|
146
153
|
},
|
|
147
|
-
}, async ({ filePath, fileName, folder, currency, amount, costCategory, paymentMethod, project, remarks, administrationId }) => {
|
|
154
|
+
}, async ({ filePath, fileName, folder, currency, amount, costCategory, paymentMethod, project, remarks, administrationId, }) => {
|
|
148
155
|
try {
|
|
149
156
|
const adminId = administrationId ?? client.defaultDomainId;
|
|
150
157
|
if (!adminId) {
|
|
151
|
-
throw new Error(
|
|
158
|
+
throw new Error('administrationId is required (or set YUKI_DOMAIN_ID env var)');
|
|
152
159
|
}
|
|
153
160
|
// Validate file existence before making any API calls
|
|
154
161
|
if (!existsSync(filePath)) {
|
|
@@ -171,18 +178,18 @@ export function registerDocumentTools(server, client) {
|
|
|
171
178
|
throw new Error(`File does not appear to be a PDF (missing %PDF header): ${filePath}`);
|
|
172
179
|
}
|
|
173
180
|
const resolvedFileName = fileName ?? basename(filePath);
|
|
174
|
-
const dataBase64 = fileBuffer.toString(
|
|
181
|
+
const dataBase64 = fileBuffer.toString('base64');
|
|
175
182
|
const sessionID = await client.getSessionID();
|
|
176
183
|
const result = await client.callSoap({
|
|
177
|
-
service:
|
|
178
|
-
method:
|
|
184
|
+
service: 'Archive.asmx',
|
|
185
|
+
method: 'UploadDocumentWithData',
|
|
179
186
|
params: {
|
|
180
187
|
sessionID,
|
|
181
188
|
fileName: resolvedFileName,
|
|
182
189
|
data: dataBase64,
|
|
183
190
|
...(folder !== undefined && { folder }),
|
|
184
191
|
administrationID: adminId,
|
|
185
|
-
currency: currency ??
|
|
192
|
+
currency: currency ?? 'EUR',
|
|
186
193
|
...(amount !== undefined && { amount }),
|
|
187
194
|
...(costCategory !== undefined && { costCategory }),
|
|
188
195
|
...(paymentMethod !== undefined && { paymentMethod }),
|
|
@@ -193,9 +200,8 @@ export function registerDocumentTools(server, client) {
|
|
|
193
200
|
return {
|
|
194
201
|
content: [
|
|
195
202
|
{
|
|
196
|
-
type:
|
|
197
|
-
text: JSON.stringify({ success: true, filePath, fileName: resolvedFileName,
|
|
198
|
-
fileSizeBytes: fileBuffer.length, result }, null, 2),
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: JSON.stringify({ success: true, filePath, fileName: resolvedFileName, fileSizeBytes: fileBuffer.length, result }, null, 2),
|
|
199
205
|
},
|
|
200
206
|
],
|
|
201
207
|
};
|
|
@@ -205,7 +211,7 @@ export function registerDocumentTools(server, client) {
|
|
|
205
211
|
return {
|
|
206
212
|
content: [
|
|
207
213
|
{
|
|
208
|
-
type:
|
|
214
|
+
type: 'text',
|
|
209
215
|
text: JSON.stringify({ success: false, error: message }, null, 2),
|
|
210
216
|
},
|
|
211
217
|
],
|
|
@@ -221,23 +227,25 @@ export function registerDocumentTools(server, client) {
|
|
|
221
227
|
*
|
|
222
228
|
* Rate cost: 1 request.
|
|
223
229
|
*/
|
|
224
|
-
server.registerTool(
|
|
225
|
-
description:
|
|
226
|
-
|
|
230
|
+
server.registerTool('get_document_folders', {
|
|
231
|
+
description: 'List all archive folders in the Yuki administration. ' +
|
|
232
|
+
'Use this to find the correct folder ID to pass to upload_document.',
|
|
227
233
|
inputSchema: {
|
|
228
|
-
administrationId: z
|
|
229
|
-
.
|
|
234
|
+
administrationId: z
|
|
235
|
+
.string()
|
|
236
|
+
.optional()
|
|
237
|
+
.describe('Administration ID (GUID). Defaults to YUKI_DOMAIN_ID env var.'),
|
|
230
238
|
},
|
|
231
239
|
}, async ({ administrationId }) => {
|
|
232
240
|
try {
|
|
233
241
|
const adminId = administrationId ?? client.defaultDomainId;
|
|
234
242
|
if (!adminId) {
|
|
235
|
-
throw new Error(
|
|
243
|
+
throw new Error('administrationId is required (or set YUKI_DOMAIN_ID env var)');
|
|
236
244
|
}
|
|
237
245
|
const sessionID = await client.getSessionID();
|
|
238
246
|
const result = await client.callSoap({
|
|
239
|
-
service:
|
|
240
|
-
method:
|
|
247
|
+
service: 'Archive.asmx',
|
|
248
|
+
method: 'DocumentFolders',
|
|
241
249
|
params: {
|
|
242
250
|
sessionID,
|
|
243
251
|
administrationID: adminId,
|
|
@@ -246,7 +254,7 @@ export function registerDocumentTools(server, client) {
|
|
|
246
254
|
return {
|
|
247
255
|
content: [
|
|
248
256
|
{
|
|
249
|
-
type:
|
|
257
|
+
type: 'text',
|
|
250
258
|
text: JSON.stringify({ success: true, result }, null, 2),
|
|
251
259
|
},
|
|
252
260
|
],
|
|
@@ -257,7 +265,7 @@ export function registerDocumentTools(server, client) {
|
|
|
257
265
|
return {
|
|
258
266
|
content: [
|
|
259
267
|
{
|
|
260
|
-
type:
|
|
268
|
+
type: 'text',
|
|
261
269
|
text: JSON.stringify({ success: false, error: message }, null, 2),
|
|
262
270
|
},
|
|
263
271
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,MAAkB;IACzE;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,uEAAuE;YACvE,8EAA8E;YAC9E,4DAA4D;YAC5D,gEAAgE;QAClE,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;YAC7F,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;YAC1E,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,QAAQ,EAAE;iBACV,QAAQ,CAAC,wEAAwE,CAAC;YACrF,QA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C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBAClE;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/invoices.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { McpServer } from
|
|
2
|
-
import { YukiClient } from
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { YukiClient } from '../yuki-client.js';
|
|
3
3
|
/**
|
|
4
4
|
* Register tools for retrieving outstanding invoices from Yuki.
|
|
5
5
|
*
|