@promptpartner/bexio-mcp-server 2.0.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 +21 -0
- package/README.md +161 -0
- package/dist/bexio-client.d.ts +350 -0
- package/dist/bexio-client.js +1045 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +80 -0
- package/dist/logger.d.ts +17 -0
- package/dist/logger.js +28 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.js +81 -0
- package/dist/shared/errors.d.ts +21 -0
- package/dist/shared/errors.js +54 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/response.d.ts +24 -0
- package/dist/shared/response.js +92 -0
- package/dist/tools/accounting/definitions.d.ts +9 -0
- package/dist/tools/accounting/definitions.js +345 -0
- package/dist/tools/accounting/handlers.d.ts +10 -0
- package/dist/tools/accounting/handlers.js +121 -0
- package/dist/tools/accounting/index.d.ts +16 -0
- package/dist/tools/accounting/index.js +16 -0
- package/dist/tools/banking/definitions.d.ts +11 -0
- package/dist/tools/banking/definitions.js +349 -0
- package/dist/tools/banking/handlers.d.ts +9 -0
- package/dist/tools/banking/handlers.js +123 -0
- package/dist/tools/banking/index.d.ts +6 -0
- package/dist/tools/banking/index.js +6 -0
- package/dist/tools/company/definitions.d.ts +7 -0
- package/dist/tools/company/definitions.js +87 -0
- package/dist/tools/company/handlers.d.ts +7 -0
- package/dist/tools/company/handlers.js +31 -0
- package/dist/tools/company/index.d.ts +6 -0
- package/dist/tools/company/index.js +6 -0
- package/dist/tools/contacts/definitions.d.ts +6 -0
- package/dist/tools/contacts/definitions.js +150 -0
- package/dist/tools/contacts/handlers.d.ts +7 -0
- package/dist/tools/contacts/handlers.js +40 -0
- package/dist/tools/contacts/index.d.ts +6 -0
- package/dist/tools/contacts/index.js +5 -0
- package/dist/tools/deliveries/definitions.d.ts +6 -0
- package/dist/tools/deliveries/definitions.js +67 -0
- package/dist/tools/deliveries/handlers.d.ts +7 -0
- package/dist/tools/deliveries/handlers.js +28 -0
- package/dist/tools/deliveries/index.d.ts +6 -0
- package/dist/tools/deliveries/index.js +5 -0
- package/dist/tools/files/definitions.d.ts +6 -0
- package/dist/tools/files/definitions.js +217 -0
- package/dist/tools/files/handlers.d.ts +7 -0
- package/dist/tools/files/handlers.js +63 -0
- package/dist/tools/files/index.d.ts +6 -0
- package/dist/tools/files/index.js +5 -0
- package/dist/tools/index.d.ts +19 -0
- package/dist/tools/index.js +93 -0
- package/dist/tools/invoices/definitions.d.ts +6 -0
- package/dist/tools/invoices/definitions.js +147 -0
- package/dist/tools/invoices/handlers.d.ts +7 -0
- package/dist/tools/invoices/handlers.js +119 -0
- package/dist/tools/invoices/index.d.ts +6 -0
- package/dist/tools/invoices/index.js +5 -0
- package/dist/tools/items/definitions.d.ts +6 -0
- package/dist/tools/items/definitions.js +100 -0
- package/dist/tools/items/handlers.d.ts +7 -0
- package/dist/tools/items/handlers.js +36 -0
- package/dist/tools/items/index.d.ts +6 -0
- package/dist/tools/items/index.js +5 -0
- package/dist/tools/misc/definitions.d.ts +6 -0
- package/dist/tools/misc/definitions.js +126 -0
- package/dist/tools/misc/handlers.d.ts +7 -0
- package/dist/tools/misc/handlers.js +52 -0
- package/dist/tools/misc/index.d.ts +6 -0
- package/dist/tools/misc/index.js +5 -0
- package/dist/tools/orders/definitions.d.ts +6 -0
- package/dist/tools/orders/definitions.js +114 -0
- package/dist/tools/orders/handlers.d.ts +7 -0
- package/dist/tools/orders/handlers.js +62 -0
- package/dist/tools/orders/index.d.ts +6 -0
- package/dist/tools/orders/index.js +5 -0
- package/dist/tools/payments/definitions.d.ts +6 -0
- package/dist/tools/payments/definitions.js +74 -0
- package/dist/tools/payments/handlers.d.ts +7 -0
- package/dist/tools/payments/handlers.js +28 -0
- package/dist/tools/payments/index.d.ts +6 -0
- package/dist/tools/payments/index.js +5 -0
- package/dist/tools/payroll/definitions.d.ts +15 -0
- package/dist/tools/payroll/definitions.js +239 -0
- package/dist/tools/payroll/handlers.d.ts +14 -0
- package/dist/tools/payroll/handlers.js +152 -0
- package/dist/tools/payroll/index.d.ts +16 -0
- package/dist/tools/payroll/index.js +16 -0
- package/dist/tools/projects/definitions.d.ts +7 -0
- package/dist/tools/projects/definitions.js +430 -0
- package/dist/tools/projects/handlers.d.ts +7 -0
- package/dist/tools/projects/handlers.js +127 -0
- package/dist/tools/projects/index.d.ts +6 -0
- package/dist/tools/projects/index.js +6 -0
- package/dist/tools/purchase/definitions.d.ts +6 -0
- package/dist/tools/purchase/definitions.js +381 -0
- package/dist/tools/purchase/handlers.d.ts +7 -0
- package/dist/tools/purchase/handlers.js +120 -0
- package/dist/tools/purchase/index.d.ts +7 -0
- package/dist/tools/purchase/index.js +6 -0
- package/dist/tools/quotes/definitions.d.ts +6 -0
- package/dist/tools/quotes/definitions.js +174 -0
- package/dist/tools/quotes/handlers.d.ts +7 -0
- package/dist/tools/quotes/handlers.js +79 -0
- package/dist/tools/quotes/index.d.ts +6 -0
- package/dist/tools/quotes/index.js +5 -0
- package/dist/tools/reference/definitions.d.ts +7 -0
- package/dist/tools/reference/definitions.js +421 -0
- package/dist/tools/reference/handlers.d.ts +7 -0
- package/dist/tools/reference/handlers.js +161 -0
- package/dist/tools/reference/index.d.ts +6 -0
- package/dist/tools/reference/index.js +6 -0
- package/dist/tools/reminders/definitions.d.ts +6 -0
- package/dist/tools/reminders/definitions.js +132 -0
- package/dist/tools/reminders/handlers.d.ts +7 -0
- package/dist/tools/reminders/handlers.js +43 -0
- package/dist/tools/reminders/index.d.ts +6 -0
- package/dist/tools/reminders/index.js +5 -0
- package/dist/tools/reports/definitions.d.ts +6 -0
- package/dist/tools/reports/definitions.js +133 -0
- package/dist/tools/reports/handlers.d.ts +7 -0
- package/dist/tools/reports/handlers.js +33 -0
- package/dist/tools/reports/index.d.ts +6 -0
- package/dist/tools/reports/index.js +5 -0
- package/dist/tools/timetracking/definitions.d.ts +9 -0
- package/dist/tools/timetracking/definitions.js +226 -0
- package/dist/tools/timetracking/handlers.d.ts +9 -0
- package/dist/tools/timetracking/handlers.js +88 -0
- package/dist/tools/timetracking/index.d.ts +6 -0
- package/dist/tools/timetracking/index.js +6 -0
- package/dist/tools/users/definitions.d.ts +6 -0
- package/dist/tools/users/definitions.js +93 -0
- package/dist/tools/users/handlers.d.ts +7 -0
- package/dist/tools/users/handlers.js +35 -0
- package/dist/tools/users/index.d.ts +6 -0
- package/dist/tools/users/index.js +5 -0
- package/dist/transports/http.d.ts +17 -0
- package/dist/transports/http.js +203 -0
- package/dist/transports/index.d.ts +4 -0
- package/dist/transports/index.js +4 -0
- package/dist/types/common.d.ts +32 -0
- package/dist/types/common.js +11 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +11 -0
- package/dist/types/schemas/accounting.d.ts +225 -0
- package/dist/types/schemas/accounting.js +96 -0
- package/dist/types/schemas/banking.d.ts +207 -0
- package/dist/types/schemas/banking.js +86 -0
- package/dist/types/schemas/company.d.ts +44 -0
- package/dist/types/schemas/company.js +23 -0
- package/dist/types/schemas/contacts.d.ts +104 -0
- package/dist/types/schemas/contacts.js +42 -0
- package/dist/types/schemas/deliveries.d.ts +40 -0
- package/dist/types/schemas/deliveries.js +22 -0
- package/dist/types/schemas/files.d.ts +152 -0
- package/dist/types/schemas/files.js +64 -0
- package/dist/types/schemas/index.d.ts +24 -0
- package/dist/types/schemas/index.js +44 -0
- package/dist/types/schemas/invoices.d.ts +594 -0
- package/dist/types/schemas/invoices.js +109 -0
- package/dist/types/schemas/items.d.ts +153 -0
- package/dist/types/schemas/items.js +43 -0
- package/dist/types/schemas/misc.d.ts +64 -0
- package/dist/types/schemas/misc.js +36 -0
- package/dist/types/schemas/orders.d.ts +657 -0
- package/dist/types/schemas/orders.js +101 -0
- package/dist/types/schemas/payments.d.ts +46 -0
- package/dist/types/schemas/payments.js +24 -0
- package/dist/types/schemas/payroll.d.ts +146 -0
- package/dist/types/schemas/payroll.js +65 -0
- package/dist/types/schemas/projects.d.ts +268 -0
- package/dist/types/schemas/projects.js +102 -0
- package/dist/types/schemas/purchase.d.ts +228 -0
- package/dist/types/schemas/purchase.js +114 -0
- package/dist/types/schemas/quotes.d.ts +102 -0
- package/dist/types/schemas/quotes.js +49 -0
- package/dist/types/schemas/reference.d.ts +240 -0
- package/dist/types/schemas/reference.js +99 -0
- package/dist/types/schemas/reminders.d.ts +76 -0
- package/dist/types/schemas/reminders.js +38 -0
- package/dist/types/schemas/reports.d.ts +69 -0
- package/dist/types/schemas/reports.js +36 -0
- package/dist/types/schemas/timetracking.d.ts +150 -0
- package/dist/types/schemas/timetracking.js +68 -0
- package/dist/types/schemas/users.d.ts +51 -0
- package/dist/types/schemas/users.js +27 -0
- package/dist/ui/contact-card/mcp-app.d.ts +1 -0
- package/dist/ui/contact-card/mcp-app.js +108 -0
- package/dist/ui/dashboard/mcp-app.d.ts +1 -0
- package/dist/ui/dashboard/mcp-app.js +81 -0
- package/dist/ui/invoice-preview/mcp-app.d.ts +1 -0
- package/dist/ui/invoice-preview/mcp-app.js +96 -0
- package/dist/ui-resources.d.ts +17 -0
- package/dist/ui-resources.js +124 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.js +46 -0
- package/package.json +78 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Misc tool definitions.
|
|
3
|
+
* Contains MCP tool metadata for comments and contact relations.
|
|
4
|
+
*/
|
|
5
|
+
export const toolDefinitions = [
|
|
6
|
+
// Comments
|
|
7
|
+
{
|
|
8
|
+
name: "list_comments",
|
|
9
|
+
description: "List all comments",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "get_comment",
|
|
17
|
+
description: "Get a specific comment by ID",
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
comment_id: {
|
|
22
|
+
type: "integer",
|
|
23
|
+
description: "The ID of the comment to retrieve",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ["comment_id"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "create_comment",
|
|
31
|
+
description: "Create a new comment",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
comment_data: {
|
|
36
|
+
type: "object",
|
|
37
|
+
description: "Comment data to create",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ["comment_data"],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
// Contact Relations
|
|
44
|
+
{
|
|
45
|
+
name: "list_contact_relations",
|
|
46
|
+
description: "List all contact relations",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "get_contact_relation",
|
|
54
|
+
description: "Get a specific contact relation by ID",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
relation_id: {
|
|
59
|
+
type: "integer",
|
|
60
|
+
description: "The ID of the contact relation to retrieve",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: ["relation_id"],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "create_contact_relation",
|
|
68
|
+
description: "Create a new contact relation",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
relation_data: {
|
|
73
|
+
type: "object",
|
|
74
|
+
description: "Contact relation data to create",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
required: ["relation_data"],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "update_contact_relation",
|
|
82
|
+
description: "Update a contact relation",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
relation_id: {
|
|
87
|
+
type: "integer",
|
|
88
|
+
description: "The ID of the contact relation to update",
|
|
89
|
+
},
|
|
90
|
+
relation_data: {
|
|
91
|
+
type: "object",
|
|
92
|
+
description: "Contact relation data to update",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: ["relation_id", "relation_data"],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "delete_contact_relation",
|
|
100
|
+
description: "Delete a contact relation",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
relation_id: {
|
|
105
|
+
type: "integer",
|
|
106
|
+
description: "The ID of the contact relation to delete",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
required: ["relation_id"],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "search_contact_relations",
|
|
114
|
+
description: "Search contact relations with filters",
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: "object",
|
|
117
|
+
properties: {
|
|
118
|
+
search_params: {
|
|
119
|
+
type: "object",
|
|
120
|
+
description: "Search parameters for contact relations",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
required: ["search_params"],
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Misc tool handlers.
|
|
3
|
+
* Implements the logic for comments and contact relations.
|
|
4
|
+
*/
|
|
5
|
+
import { BexioClient } from "../../bexio-client.js";
|
|
6
|
+
export type HandlerFn = (client: BexioClient, args: unknown) => Promise<unknown>;
|
|
7
|
+
export declare const handlers: Record<string, HandlerFn>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Misc tool handlers.
|
|
3
|
+
* Implements the logic for comments and contact relations.
|
|
4
|
+
*/
|
|
5
|
+
import { McpError } from "../../shared/errors.js";
|
|
6
|
+
import { GetCommentParamsSchema, CreateCommentParamsSchema, GetContactRelationParamsSchema, CreateContactRelationParamsSchema, UpdateContactRelationParamsSchema, DeleteContactRelationParamsSchema, SearchContactRelationsParamsSchema, } from "../../types/index.js";
|
|
7
|
+
export const handlers = {
|
|
8
|
+
// Comments
|
|
9
|
+
list_comments: async (client) => {
|
|
10
|
+
return client.listComments();
|
|
11
|
+
},
|
|
12
|
+
get_comment: async (client, args) => {
|
|
13
|
+
const { comment_id } = GetCommentParamsSchema.parse(args);
|
|
14
|
+
const comment = await client.getComment(comment_id);
|
|
15
|
+
if (!comment) {
|
|
16
|
+
throw McpError.notFound("Comment", comment_id);
|
|
17
|
+
}
|
|
18
|
+
return comment;
|
|
19
|
+
},
|
|
20
|
+
create_comment: async (client, args) => {
|
|
21
|
+
const { comment_data } = CreateCommentParamsSchema.parse(args);
|
|
22
|
+
return client.createComment(comment_data);
|
|
23
|
+
},
|
|
24
|
+
// Contact Relations
|
|
25
|
+
list_contact_relations: async (client) => {
|
|
26
|
+
return client.listContactRelations();
|
|
27
|
+
},
|
|
28
|
+
get_contact_relation: async (client, args) => {
|
|
29
|
+
const { relation_id } = GetContactRelationParamsSchema.parse(args);
|
|
30
|
+
const relation = await client.getContactRelation(relation_id);
|
|
31
|
+
if (!relation) {
|
|
32
|
+
throw McpError.notFound("Contact Relation", relation_id);
|
|
33
|
+
}
|
|
34
|
+
return relation;
|
|
35
|
+
},
|
|
36
|
+
create_contact_relation: async (client, args) => {
|
|
37
|
+
const { relation_data } = CreateContactRelationParamsSchema.parse(args);
|
|
38
|
+
return client.createContactRelation(relation_data);
|
|
39
|
+
},
|
|
40
|
+
update_contact_relation: async (client, args) => {
|
|
41
|
+
const { relation_id, relation_data } = UpdateContactRelationParamsSchema.parse(args);
|
|
42
|
+
return client.updateContactRelation(relation_id, relation_data);
|
|
43
|
+
},
|
|
44
|
+
delete_contact_relation: async (client, args) => {
|
|
45
|
+
const { relation_id } = DeleteContactRelationParamsSchema.parse(args);
|
|
46
|
+
return client.deleteContactRelation(relation_id);
|
|
47
|
+
},
|
|
48
|
+
search_contact_relations: async (client, args) => {
|
|
49
|
+
const { search_params } = SearchContactRelationsParamsSchema.parse(args);
|
|
50
|
+
return client.searchContactRelations(search_params);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order tool definitions.
|
|
3
|
+
* Contains MCP tool metadata for orders domain.
|
|
4
|
+
*/
|
|
5
|
+
export const toolDefinitions = [
|
|
6
|
+
{
|
|
7
|
+
name: "list_orders",
|
|
8
|
+
description: "List orders from Bexio with optional pagination",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
limit: {
|
|
13
|
+
type: "integer",
|
|
14
|
+
description: "Maximum number of orders to return (default: 50)",
|
|
15
|
+
default: 50,
|
|
16
|
+
},
|
|
17
|
+
offset: {
|
|
18
|
+
type: "integer",
|
|
19
|
+
description: "Number of orders to skip (default: 0)",
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "get_order",
|
|
27
|
+
description: "Get a specific order by ID",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
order_id: {
|
|
32
|
+
type: "integer",
|
|
33
|
+
description: "The ID of the order to retrieve",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ["order_id"],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "create_order",
|
|
41
|
+
description: "Create a new order in Bexio",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
order_data: {
|
|
46
|
+
type: "object",
|
|
47
|
+
description: "Order data to create",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ["order_data"],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "search_orders",
|
|
55
|
+
description: "Search orders with filters",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
search_params: {
|
|
60
|
+
type: "object",
|
|
61
|
+
description: "Search parameters for orders",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
required: ["search_params"],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "search_orders_by_customer",
|
|
69
|
+
description: "Search orders by customer name (2-step process: find contact by name, then find orders by contact_id)",
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
customer_name: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: 'Customer name to search for (e.g., "Anton", "Mustermann")',
|
|
76
|
+
},
|
|
77
|
+
limit: {
|
|
78
|
+
type: "integer",
|
|
79
|
+
description: "Maximum number of orders to return (default: 50)",
|
|
80
|
+
default: 50,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: ["customer_name"],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "create_delivery_from_order",
|
|
88
|
+
description: "Create a delivery from an order",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
order_id: {
|
|
93
|
+
type: "integer",
|
|
94
|
+
description: "The ID of the order to create a delivery from",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
required: ["order_id"],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "create_invoice_from_order",
|
|
102
|
+
description: "Create an invoice from an order",
|
|
103
|
+
inputSchema: {
|
|
104
|
+
type: "object",
|
|
105
|
+
properties: {
|
|
106
|
+
order_id: {
|
|
107
|
+
type: "integer",
|
|
108
|
+
description: "The ID of the order to create an invoice from",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
required: ["order_id"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order tool handlers.
|
|
3
|
+
* Implements the logic for each order tool.
|
|
4
|
+
*/
|
|
5
|
+
import { BexioClient } from "../../bexio-client.js";
|
|
6
|
+
export type HandlerFn = (client: BexioClient, args: unknown) => Promise<unknown>;
|
|
7
|
+
export declare const handlers: Record<string, HandlerFn>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order tool handlers.
|
|
3
|
+
* Implements the logic for each order tool.
|
|
4
|
+
*/
|
|
5
|
+
import { McpError } from "../../shared/errors.js";
|
|
6
|
+
import { ListOrdersParamsSchema, GetOrderParamsSchema, CreateOrderParamsSchema, SearchOrdersParamsSchema, SearchOrdersByCustomerParamsSchema, CreateDeliveryFromOrderParamsSchema, CreateInvoiceFromOrderParamsSchema, } from "../../types/index.js";
|
|
7
|
+
export const handlers = {
|
|
8
|
+
list_orders: async (client, args) => {
|
|
9
|
+
const params = ListOrdersParamsSchema.parse(args);
|
|
10
|
+
return client.listOrders(params);
|
|
11
|
+
},
|
|
12
|
+
get_order: async (client, args) => {
|
|
13
|
+
const { order_id } = GetOrderParamsSchema.parse(args);
|
|
14
|
+
const order = await client.getOrder(order_id);
|
|
15
|
+
if (!order) {
|
|
16
|
+
throw McpError.notFound("Order", order_id);
|
|
17
|
+
}
|
|
18
|
+
return order;
|
|
19
|
+
},
|
|
20
|
+
create_order: async (client, args) => {
|
|
21
|
+
const { order_data } = CreateOrderParamsSchema.parse(args);
|
|
22
|
+
return client.createOrder(order_data);
|
|
23
|
+
},
|
|
24
|
+
search_orders: async (client, args) => {
|
|
25
|
+
const { search_params } = SearchOrdersParamsSchema.parse(args);
|
|
26
|
+
return client.searchOrders(search_params);
|
|
27
|
+
},
|
|
28
|
+
search_orders_by_customer: async (client, args) => {
|
|
29
|
+
const params = SearchOrdersByCustomerParamsSchema.parse(args);
|
|
30
|
+
// Step 1: Find contacts by name
|
|
31
|
+
const contacts = await client.findContactByName(params.customer_name);
|
|
32
|
+
if (!contacts || contacts.length === 0) {
|
|
33
|
+
return {
|
|
34
|
+
orders: [],
|
|
35
|
+
message: `No contacts found with name "${params.customer_name}"`,
|
|
36
|
+
contacts_found: 0,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Step 2: Search orders for each contact (limit to first 5)
|
|
40
|
+
const allOrders = [];
|
|
41
|
+
for (const contact of contacts.slice(0, 5)) {
|
|
42
|
+
const contactId = contact.id;
|
|
43
|
+
if (contactId) {
|
|
44
|
+
const orders = await client.searchOrdersByContactId(contactId);
|
|
45
|
+
allOrders.push(...orders);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
orders: allOrders,
|
|
50
|
+
contacts_found: contacts.length,
|
|
51
|
+
customer_name: params.customer_name,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
create_delivery_from_order: async (client, args) => {
|
|
55
|
+
const { order_id } = CreateDeliveryFromOrderParamsSchema.parse(args);
|
|
56
|
+
return client.createDeliveryFromOrder(order_id);
|
|
57
|
+
},
|
|
58
|
+
create_invoice_from_order: async (client, args) => {
|
|
59
|
+
const { order_id } = CreateInvoiceFromOrderParamsSchema.parse(args);
|
|
60
|
+
return client.createInvoiceFromOrder(order_id);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment tool definitions.
|
|
3
|
+
* Contains MCP tool metadata for payments domain.
|
|
4
|
+
*/
|
|
5
|
+
export const toolDefinitions = [
|
|
6
|
+
{
|
|
7
|
+
name: "list_payments",
|
|
8
|
+
description: "List payments for a specific invoice",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
invoice_id: {
|
|
13
|
+
type: "integer",
|
|
14
|
+
description: "The ID of the invoice to get payments for",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
required: ["invoice_id"],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "get_payment",
|
|
22
|
+
description: "Get a specific payment by ID",
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
invoice_id: {
|
|
27
|
+
type: "integer",
|
|
28
|
+
description: "The ID of the invoice",
|
|
29
|
+
},
|
|
30
|
+
payment_id: {
|
|
31
|
+
type: "integer",
|
|
32
|
+
description: "The ID of the payment to retrieve",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ["invoice_id", "payment_id"],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "create_payment",
|
|
40
|
+
description: "Create a new payment for an invoice",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
invoice_id: {
|
|
45
|
+
type: "integer",
|
|
46
|
+
description: "The ID of the invoice to create a payment for",
|
|
47
|
+
},
|
|
48
|
+
payment_data: {
|
|
49
|
+
type: "object",
|
|
50
|
+
description: "Payment data to create",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
required: ["invoice_id", "payment_data"],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "delete_payment",
|
|
58
|
+
description: "Delete a payment",
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: {
|
|
62
|
+
invoice_id: {
|
|
63
|
+
type: "integer",
|
|
64
|
+
description: "The ID of the invoice",
|
|
65
|
+
},
|
|
66
|
+
payment_id: {
|
|
67
|
+
type: "integer",
|
|
68
|
+
description: "The ID of the payment to delete",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ["invoice_id", "payment_id"],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment tool handlers.
|
|
3
|
+
* Implements the logic for each payment tool.
|
|
4
|
+
*/
|
|
5
|
+
import { BexioClient } from "../../bexio-client.js";
|
|
6
|
+
export type HandlerFn = (client: BexioClient, args: unknown) => Promise<unknown>;
|
|
7
|
+
export declare const handlers: Record<string, HandlerFn>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment tool handlers.
|
|
3
|
+
* Implements the logic for each payment tool.
|
|
4
|
+
*/
|
|
5
|
+
import { McpError } from "../../shared/errors.js";
|
|
6
|
+
import { ListPaymentsParamsSchema, GetPaymentParamsSchema, CreatePaymentParamsSchema, DeletePaymentParamsSchema, } from "../../types/index.js";
|
|
7
|
+
export const handlers = {
|
|
8
|
+
list_payments: async (client, args) => {
|
|
9
|
+
const { invoice_id } = ListPaymentsParamsSchema.parse(args);
|
|
10
|
+
return client.listPayments(invoice_id);
|
|
11
|
+
},
|
|
12
|
+
get_payment: async (client, args) => {
|
|
13
|
+
const { invoice_id, payment_id } = GetPaymentParamsSchema.parse(args);
|
|
14
|
+
const payment = await client.getPayment(invoice_id, payment_id);
|
|
15
|
+
if (!payment) {
|
|
16
|
+
throw McpError.notFound("Payment", payment_id);
|
|
17
|
+
}
|
|
18
|
+
return payment;
|
|
19
|
+
},
|
|
20
|
+
create_payment: async (client, args) => {
|
|
21
|
+
const { invoice_id, payment_data } = CreatePaymentParamsSchema.parse(args);
|
|
22
|
+
return client.createPayment(invoice_id, payment_data);
|
|
23
|
+
},
|
|
24
|
+
delete_payment: async (client, args) => {
|
|
25
|
+
const { invoice_id, payment_id } = DeletePaymentParamsSchema.parse(args);
|
|
26
|
+
return client.deletePayment(invoice_id, payment_id);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payroll tool definitions.
|
|
3
|
+
* Contains MCP tool metadata for payroll domain.
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: Payroll module requires a Bexio subscription with payroll features.
|
|
6
|
+
* All tools check module availability on first call and cache the result.
|
|
7
|
+
* When unavailable, tools return a friendly error explaining how to enable payroll.
|
|
8
|
+
*
|
|
9
|
+
* 10 tools total:
|
|
10
|
+
* - Employees: 4 tools (list, get, create, update)
|
|
11
|
+
* - Absences: 5 tools (list, get, create, update, delete)
|
|
12
|
+
* - Payroll Documents: 1 tool (list)
|
|
13
|
+
*/
|
|
14
|
+
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
15
|
+
export declare const toolDefinitions: Tool[];
|