@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.
Files changed (199) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/bexio-client.d.ts +350 -0
  4. package/dist/bexio-client.js +1045 -0
  5. package/dist/index.d.ts +15 -0
  6. package/dist/index.js +80 -0
  7. package/dist/logger.d.ts +17 -0
  8. package/dist/logger.js +28 -0
  9. package/dist/server.d.ts +18 -0
  10. package/dist/server.js +81 -0
  11. package/dist/shared/errors.d.ts +21 -0
  12. package/dist/shared/errors.js +54 -0
  13. package/dist/shared/index.d.ts +5 -0
  14. package/dist/shared/index.js +5 -0
  15. package/dist/shared/response.d.ts +24 -0
  16. package/dist/shared/response.js +92 -0
  17. package/dist/tools/accounting/definitions.d.ts +9 -0
  18. package/dist/tools/accounting/definitions.js +345 -0
  19. package/dist/tools/accounting/handlers.d.ts +10 -0
  20. package/dist/tools/accounting/handlers.js +121 -0
  21. package/dist/tools/accounting/index.d.ts +16 -0
  22. package/dist/tools/accounting/index.js +16 -0
  23. package/dist/tools/banking/definitions.d.ts +11 -0
  24. package/dist/tools/banking/definitions.js +349 -0
  25. package/dist/tools/banking/handlers.d.ts +9 -0
  26. package/dist/tools/banking/handlers.js +123 -0
  27. package/dist/tools/banking/index.d.ts +6 -0
  28. package/dist/tools/banking/index.js +6 -0
  29. package/dist/tools/company/definitions.d.ts +7 -0
  30. package/dist/tools/company/definitions.js +87 -0
  31. package/dist/tools/company/handlers.d.ts +7 -0
  32. package/dist/tools/company/handlers.js +31 -0
  33. package/dist/tools/company/index.d.ts +6 -0
  34. package/dist/tools/company/index.js +6 -0
  35. package/dist/tools/contacts/definitions.d.ts +6 -0
  36. package/dist/tools/contacts/definitions.js +150 -0
  37. package/dist/tools/contacts/handlers.d.ts +7 -0
  38. package/dist/tools/contacts/handlers.js +40 -0
  39. package/dist/tools/contacts/index.d.ts +6 -0
  40. package/dist/tools/contacts/index.js +5 -0
  41. package/dist/tools/deliveries/definitions.d.ts +6 -0
  42. package/dist/tools/deliveries/definitions.js +67 -0
  43. package/dist/tools/deliveries/handlers.d.ts +7 -0
  44. package/dist/tools/deliveries/handlers.js +28 -0
  45. package/dist/tools/deliveries/index.d.ts +6 -0
  46. package/dist/tools/deliveries/index.js +5 -0
  47. package/dist/tools/files/definitions.d.ts +6 -0
  48. package/dist/tools/files/definitions.js +217 -0
  49. package/dist/tools/files/handlers.d.ts +7 -0
  50. package/dist/tools/files/handlers.js +63 -0
  51. package/dist/tools/files/index.d.ts +6 -0
  52. package/dist/tools/files/index.js +5 -0
  53. package/dist/tools/index.d.ts +19 -0
  54. package/dist/tools/index.js +93 -0
  55. package/dist/tools/invoices/definitions.d.ts +6 -0
  56. package/dist/tools/invoices/definitions.js +147 -0
  57. package/dist/tools/invoices/handlers.d.ts +7 -0
  58. package/dist/tools/invoices/handlers.js +119 -0
  59. package/dist/tools/invoices/index.d.ts +6 -0
  60. package/dist/tools/invoices/index.js +5 -0
  61. package/dist/tools/items/definitions.d.ts +6 -0
  62. package/dist/tools/items/definitions.js +100 -0
  63. package/dist/tools/items/handlers.d.ts +7 -0
  64. package/dist/tools/items/handlers.js +36 -0
  65. package/dist/tools/items/index.d.ts +6 -0
  66. package/dist/tools/items/index.js +5 -0
  67. package/dist/tools/misc/definitions.d.ts +6 -0
  68. package/dist/tools/misc/definitions.js +126 -0
  69. package/dist/tools/misc/handlers.d.ts +7 -0
  70. package/dist/tools/misc/handlers.js +52 -0
  71. package/dist/tools/misc/index.d.ts +6 -0
  72. package/dist/tools/misc/index.js +5 -0
  73. package/dist/tools/orders/definitions.d.ts +6 -0
  74. package/dist/tools/orders/definitions.js +114 -0
  75. package/dist/tools/orders/handlers.d.ts +7 -0
  76. package/dist/tools/orders/handlers.js +62 -0
  77. package/dist/tools/orders/index.d.ts +6 -0
  78. package/dist/tools/orders/index.js +5 -0
  79. package/dist/tools/payments/definitions.d.ts +6 -0
  80. package/dist/tools/payments/definitions.js +74 -0
  81. package/dist/tools/payments/handlers.d.ts +7 -0
  82. package/dist/tools/payments/handlers.js +28 -0
  83. package/dist/tools/payments/index.d.ts +6 -0
  84. package/dist/tools/payments/index.js +5 -0
  85. package/dist/tools/payroll/definitions.d.ts +15 -0
  86. package/dist/tools/payroll/definitions.js +239 -0
  87. package/dist/tools/payroll/handlers.d.ts +14 -0
  88. package/dist/tools/payroll/handlers.js +152 -0
  89. package/dist/tools/payroll/index.d.ts +16 -0
  90. package/dist/tools/payroll/index.js +16 -0
  91. package/dist/tools/projects/definitions.d.ts +7 -0
  92. package/dist/tools/projects/definitions.js +430 -0
  93. package/dist/tools/projects/handlers.d.ts +7 -0
  94. package/dist/tools/projects/handlers.js +127 -0
  95. package/dist/tools/projects/index.d.ts +6 -0
  96. package/dist/tools/projects/index.js +6 -0
  97. package/dist/tools/purchase/definitions.d.ts +6 -0
  98. package/dist/tools/purchase/definitions.js +381 -0
  99. package/dist/tools/purchase/handlers.d.ts +7 -0
  100. package/dist/tools/purchase/handlers.js +120 -0
  101. package/dist/tools/purchase/index.d.ts +7 -0
  102. package/dist/tools/purchase/index.js +6 -0
  103. package/dist/tools/quotes/definitions.d.ts +6 -0
  104. package/dist/tools/quotes/definitions.js +174 -0
  105. package/dist/tools/quotes/handlers.d.ts +7 -0
  106. package/dist/tools/quotes/handlers.js +79 -0
  107. package/dist/tools/quotes/index.d.ts +6 -0
  108. package/dist/tools/quotes/index.js +5 -0
  109. package/dist/tools/reference/definitions.d.ts +7 -0
  110. package/dist/tools/reference/definitions.js +421 -0
  111. package/dist/tools/reference/handlers.d.ts +7 -0
  112. package/dist/tools/reference/handlers.js +161 -0
  113. package/dist/tools/reference/index.d.ts +6 -0
  114. package/dist/tools/reference/index.js +6 -0
  115. package/dist/tools/reminders/definitions.d.ts +6 -0
  116. package/dist/tools/reminders/definitions.js +132 -0
  117. package/dist/tools/reminders/handlers.d.ts +7 -0
  118. package/dist/tools/reminders/handlers.js +43 -0
  119. package/dist/tools/reminders/index.d.ts +6 -0
  120. package/dist/tools/reminders/index.js +5 -0
  121. package/dist/tools/reports/definitions.d.ts +6 -0
  122. package/dist/tools/reports/definitions.js +133 -0
  123. package/dist/tools/reports/handlers.d.ts +7 -0
  124. package/dist/tools/reports/handlers.js +33 -0
  125. package/dist/tools/reports/index.d.ts +6 -0
  126. package/dist/tools/reports/index.js +5 -0
  127. package/dist/tools/timetracking/definitions.d.ts +9 -0
  128. package/dist/tools/timetracking/definitions.js +226 -0
  129. package/dist/tools/timetracking/handlers.d.ts +9 -0
  130. package/dist/tools/timetracking/handlers.js +88 -0
  131. package/dist/tools/timetracking/index.d.ts +6 -0
  132. package/dist/tools/timetracking/index.js +6 -0
  133. package/dist/tools/users/definitions.d.ts +6 -0
  134. package/dist/tools/users/definitions.js +93 -0
  135. package/dist/tools/users/handlers.d.ts +7 -0
  136. package/dist/tools/users/handlers.js +35 -0
  137. package/dist/tools/users/index.d.ts +6 -0
  138. package/dist/tools/users/index.js +5 -0
  139. package/dist/transports/http.d.ts +17 -0
  140. package/dist/transports/http.js +203 -0
  141. package/dist/transports/index.d.ts +4 -0
  142. package/dist/transports/index.js +4 -0
  143. package/dist/types/common.d.ts +32 -0
  144. package/dist/types/common.js +11 -0
  145. package/dist/types/index.d.ts +9 -0
  146. package/dist/types/index.js +11 -0
  147. package/dist/types/schemas/accounting.d.ts +225 -0
  148. package/dist/types/schemas/accounting.js +96 -0
  149. package/dist/types/schemas/banking.d.ts +207 -0
  150. package/dist/types/schemas/banking.js +86 -0
  151. package/dist/types/schemas/company.d.ts +44 -0
  152. package/dist/types/schemas/company.js +23 -0
  153. package/dist/types/schemas/contacts.d.ts +104 -0
  154. package/dist/types/schemas/contacts.js +42 -0
  155. package/dist/types/schemas/deliveries.d.ts +40 -0
  156. package/dist/types/schemas/deliveries.js +22 -0
  157. package/dist/types/schemas/files.d.ts +152 -0
  158. package/dist/types/schemas/files.js +64 -0
  159. package/dist/types/schemas/index.d.ts +24 -0
  160. package/dist/types/schemas/index.js +44 -0
  161. package/dist/types/schemas/invoices.d.ts +594 -0
  162. package/dist/types/schemas/invoices.js +109 -0
  163. package/dist/types/schemas/items.d.ts +153 -0
  164. package/dist/types/schemas/items.js +43 -0
  165. package/dist/types/schemas/misc.d.ts +64 -0
  166. package/dist/types/schemas/misc.js +36 -0
  167. package/dist/types/schemas/orders.d.ts +657 -0
  168. package/dist/types/schemas/orders.js +101 -0
  169. package/dist/types/schemas/payments.d.ts +46 -0
  170. package/dist/types/schemas/payments.js +24 -0
  171. package/dist/types/schemas/payroll.d.ts +146 -0
  172. package/dist/types/schemas/payroll.js +65 -0
  173. package/dist/types/schemas/projects.d.ts +268 -0
  174. package/dist/types/schemas/projects.js +102 -0
  175. package/dist/types/schemas/purchase.d.ts +228 -0
  176. package/dist/types/schemas/purchase.js +114 -0
  177. package/dist/types/schemas/quotes.d.ts +102 -0
  178. package/dist/types/schemas/quotes.js +49 -0
  179. package/dist/types/schemas/reference.d.ts +240 -0
  180. package/dist/types/schemas/reference.js +99 -0
  181. package/dist/types/schemas/reminders.d.ts +76 -0
  182. package/dist/types/schemas/reminders.js +38 -0
  183. package/dist/types/schemas/reports.d.ts +69 -0
  184. package/dist/types/schemas/reports.js +36 -0
  185. package/dist/types/schemas/timetracking.d.ts +150 -0
  186. package/dist/types/schemas/timetracking.js +68 -0
  187. package/dist/types/schemas/users.d.ts +51 -0
  188. package/dist/types/schemas/users.js +27 -0
  189. package/dist/ui/contact-card/mcp-app.d.ts +1 -0
  190. package/dist/ui/contact-card/mcp-app.js +108 -0
  191. package/dist/ui/dashboard/mcp-app.d.ts +1 -0
  192. package/dist/ui/dashboard/mcp-app.js +81 -0
  193. package/dist/ui/invoice-preview/mcp-app.d.ts +1 -0
  194. package/dist/ui/invoice-preview/mcp-app.js +96 -0
  195. package/dist/ui-resources.d.ts +17 -0
  196. package/dist/ui-resources.js +124 -0
  197. package/dist/vite.config.d.ts +2 -0
  198. package/dist/vite.config.js +46 -0
  199. package/package.json +78 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Contact tool definitions.
3
+ * Contains MCP tool metadata for contacts domain.
4
+ */
5
+ export const toolDefinitions = [
6
+ {
7
+ name: "list_contacts",
8
+ description: "List contacts from Bexio with optional pagination and filtering",
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {
12
+ limit: {
13
+ type: "integer",
14
+ description: "Maximum number of contacts to return (default: 50)",
15
+ default: 50,
16
+ },
17
+ offset: {
18
+ type: "integer",
19
+ description: "Number of contacts to skip (default: 0)",
20
+ default: 0,
21
+ },
22
+ search_term: {
23
+ type: "string",
24
+ description: "Search term to filter contacts by name, email, etc.",
25
+ },
26
+ contact_type_id: {
27
+ type: "integer",
28
+ description: "Filter by contact type ID (1=Person, 2=Company)",
29
+ },
30
+ },
31
+ },
32
+ },
33
+ {
34
+ name: "get_contact",
35
+ description: "Get a specific contact by ID",
36
+ inputSchema: {
37
+ type: "object",
38
+ properties: {
39
+ contact_id: {
40
+ type: "integer",
41
+ description: "The ID of the contact to retrieve",
42
+ },
43
+ },
44
+ required: ["contact_id"],
45
+ },
46
+ },
47
+ {
48
+ name: "search_contacts",
49
+ description: "Search contacts by name, email, or other fields",
50
+ inputSchema: {
51
+ type: "object",
52
+ properties: {
53
+ query: {
54
+ type: "string",
55
+ description: "Search query to find contacts",
56
+ },
57
+ limit: {
58
+ type: "integer",
59
+ description: "Maximum number of contacts to return (default: 50)",
60
+ default: 50,
61
+ },
62
+ },
63
+ required: ["query"],
64
+ },
65
+ },
66
+ {
67
+ name: "advanced_search_contacts",
68
+ description: "Perform advanced search on contacts using multiple criteria",
69
+ inputSchema: {
70
+ type: "object",
71
+ properties: {
72
+ search_criteria: {
73
+ type: "array",
74
+ description: "List of search criteria with field, value, and criteria",
75
+ items: {
76
+ type: "object",
77
+ properties: {
78
+ field: {
79
+ type: "string",
80
+ description: "Field to search (e.g., 'name_1', 'mail', 'city', 'nr')",
81
+ },
82
+ value: {
83
+ type: "string",
84
+ description: "Value to search for",
85
+ },
86
+ criteria: {
87
+ type: "string",
88
+ description: "Search operator ('like', '=', '>', '<', etc.)",
89
+ default: "like",
90
+ },
91
+ },
92
+ required: ["field", "value"],
93
+ },
94
+ },
95
+ limit: {
96
+ type: "integer",
97
+ description: "Maximum number of contacts to return (default: 50)",
98
+ default: 50,
99
+ },
100
+ },
101
+ required: ["search_criteria"],
102
+ },
103
+ },
104
+ {
105
+ name: "find_contact_by_number",
106
+ description: "Find a specific contact by its contact number (e.g., '001008')",
107
+ inputSchema: {
108
+ type: "object",
109
+ properties: {
110
+ contact_number: {
111
+ type: "string",
112
+ description: "The contact number to search for (e.g., '001008')",
113
+ },
114
+ },
115
+ required: ["contact_number"],
116
+ },
117
+ },
118
+ {
119
+ name: "find_contact_by_name",
120
+ description: "Find contacts by name (searches through all pages)",
121
+ inputSchema: {
122
+ type: "object",
123
+ properties: {
124
+ name: {
125
+ type: "string",
126
+ description: "The name to search for",
127
+ },
128
+ },
129
+ required: ["name"],
130
+ },
131
+ },
132
+ {
133
+ name: "update_contact",
134
+ description: "Update an existing contact's information",
135
+ inputSchema: {
136
+ type: "object",
137
+ properties: {
138
+ contact_id: {
139
+ type: "integer",
140
+ description: "The ID of the contact to update",
141
+ },
142
+ contact_data: {
143
+ type: "object",
144
+ description: "Contact fields to update",
145
+ },
146
+ },
147
+ required: ["contact_id", "contact_data"],
148
+ },
149
+ },
150
+ ];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Contact tool handlers.
3
+ * Implements the logic for each contact 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,40 @@
1
+ /**
2
+ * Contact tool handlers.
3
+ * Implements the logic for each contact tool.
4
+ */
5
+ import { McpError } from "../../shared/errors.js";
6
+ import { ListContactsParamsSchema, GetContactParamsSchema, SearchContactsParamsSchema, AdvancedSearchContactsParamsSchema, FindContactByNumberParamsSchema, FindContactByNameParamsSchema, UpdateContactParamsSchema, } from "../../types/index.js";
7
+ export const handlers = {
8
+ list_contacts: async (client, args) => {
9
+ const params = ListContactsParamsSchema.parse(args);
10
+ return client.listContacts(params);
11
+ },
12
+ get_contact: async (client, args) => {
13
+ const { contact_id } = GetContactParamsSchema.parse(args);
14
+ const contact = await client.getContact(contact_id);
15
+ if (!contact) {
16
+ throw McpError.notFound("Contact", contact_id);
17
+ }
18
+ return contact;
19
+ },
20
+ search_contacts: async (client, args) => {
21
+ const { query, limit } = SearchContactsParamsSchema.parse(args);
22
+ return client.searchContacts(query, limit);
23
+ },
24
+ advanced_search_contacts: async (client, args) => {
25
+ const { search_criteria, limit } = AdvancedSearchContactsParamsSchema.parse(args);
26
+ return client.advancedSearchContacts(search_criteria, limit);
27
+ },
28
+ find_contact_by_number: async (client, args) => {
29
+ const { contact_number } = FindContactByNumberParamsSchema.parse(args);
30
+ return client.findContactByNumber(contact_number);
31
+ },
32
+ find_contact_by_name: async (client, args) => {
33
+ const { name } = FindContactByNameParamsSchema.parse(args);
34
+ return client.findContactByName(name);
35
+ },
36
+ update_contact: async (client, args) => {
37
+ const { contact_id, contact_data } = UpdateContactParamsSchema.parse(args);
38
+ return client.updateContact(contact_id, contact_data);
39
+ },
40
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Contacts domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
6
+ export type { HandlerFn } from "./handlers.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Contacts domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Delivery tool definitions.
3
+ * Contains MCP tool metadata for deliveries domain.
4
+ */
5
+ import type { Tool } from "@modelcontextprotocol/sdk/types.js";
6
+ export declare const toolDefinitions: Tool[];
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Delivery tool definitions.
3
+ * Contains MCP tool metadata for deliveries domain.
4
+ */
5
+ export const toolDefinitions = [
6
+ {
7
+ name: "list_deliveries",
8
+ description: "List deliveries from Bexio with optional pagination",
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {
12
+ limit: {
13
+ type: "integer",
14
+ description: "Maximum number of deliveries to return (default: 50)",
15
+ default: 50,
16
+ },
17
+ offset: {
18
+ type: "integer",
19
+ description: "Number of deliveries to skip (default: 0)",
20
+ default: 0,
21
+ },
22
+ },
23
+ },
24
+ },
25
+ {
26
+ name: "get_delivery",
27
+ description: "Get a specific delivery by ID",
28
+ inputSchema: {
29
+ type: "object",
30
+ properties: {
31
+ delivery_id: {
32
+ type: "integer",
33
+ description: "The ID of the delivery to retrieve",
34
+ },
35
+ },
36
+ required: ["delivery_id"],
37
+ },
38
+ },
39
+ {
40
+ name: "issue_delivery",
41
+ description: "Issue a delivery",
42
+ inputSchema: {
43
+ type: "object",
44
+ properties: {
45
+ delivery_id: {
46
+ type: "integer",
47
+ description: "The ID of the delivery to issue",
48
+ },
49
+ },
50
+ required: ["delivery_id"],
51
+ },
52
+ },
53
+ {
54
+ name: "search_deliveries",
55
+ description: "Search deliveries with filters",
56
+ inputSchema: {
57
+ type: "object",
58
+ properties: {
59
+ search_params: {
60
+ type: "object",
61
+ description: "Search parameters for deliveries",
62
+ },
63
+ },
64
+ required: ["search_params"],
65
+ },
66
+ },
67
+ ];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Delivery tool handlers.
3
+ * Implements the logic for each delivery 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
+ * Delivery tool handlers.
3
+ * Implements the logic for each delivery tool.
4
+ */
5
+ import { McpError } from "../../shared/errors.js";
6
+ import { ListDeliveriesParamsSchema, GetDeliveryParamsSchema, IssueDeliveryParamsSchema, SearchDeliveriesParamsSchema, } from "../../types/index.js";
7
+ export const handlers = {
8
+ list_deliveries: async (client, args) => {
9
+ const params = ListDeliveriesParamsSchema.parse(args);
10
+ return client.listDeliveries(params);
11
+ },
12
+ get_delivery: async (client, args) => {
13
+ const { delivery_id } = GetDeliveryParamsSchema.parse(args);
14
+ const delivery = await client.getDelivery(delivery_id);
15
+ if (!delivery) {
16
+ throw McpError.notFound("Delivery", delivery_id);
17
+ }
18
+ return delivery;
19
+ },
20
+ issue_delivery: async (client, args) => {
21
+ const { delivery_id } = IssueDeliveryParamsSchema.parse(args);
22
+ return client.issueDelivery(delivery_id);
23
+ },
24
+ search_deliveries: async (client, args) => {
25
+ const { search_params } = SearchDeliveriesParamsSchema.parse(args);
26
+ return client.searchDeliveries(search_params);
27
+ },
28
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Deliveries domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
6
+ export type { HandlerFn } from "./handlers.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Deliveries domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Files and Additional Addresses tool definitions.
3
+ * Contains MCP tool metadata for files domain.
4
+ */
5
+ import type { Tool } from "@modelcontextprotocol/sdk/types.js";
6
+ export declare const toolDefinitions: Tool[];
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Files and Additional Addresses tool definitions.
3
+ * Contains MCP tool metadata for files domain.
4
+ */
5
+ export const toolDefinitions = [
6
+ // ===== FILES =====
7
+ {
8
+ name: "list_files",
9
+ description: "List files from Bexio with optional pagination",
10
+ inputSchema: {
11
+ type: "object",
12
+ properties: {
13
+ limit: {
14
+ type: "integer",
15
+ description: "Maximum number of files to return (default: 50)",
16
+ default: 50,
17
+ },
18
+ offset: {
19
+ type: "integer",
20
+ description: "Number of files to skip (default: 0)",
21
+ default: 0,
22
+ },
23
+ },
24
+ },
25
+ },
26
+ {
27
+ name: "get_file",
28
+ description: "Get a specific file's metadata by ID",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {
32
+ file_id: {
33
+ type: "integer",
34
+ description: "The ID of the file to retrieve",
35
+ },
36
+ },
37
+ required: ["file_id"],
38
+ },
39
+ },
40
+ {
41
+ name: "upload_file",
42
+ description: "Upload a file to Bexio. File content must be provided as base64 encoded string for MCP JSON transport.",
43
+ inputSchema: {
44
+ type: "object",
45
+ properties: {
46
+ name: {
47
+ type: "string",
48
+ description: "The filename including extension (e.g., 'document.pdf')",
49
+ },
50
+ content_base64: {
51
+ type: "string",
52
+ description: "The file content encoded as base64 string",
53
+ },
54
+ content_type: {
55
+ type: "string",
56
+ description: "The MIME type of the file (e.g., 'application/pdf', 'image/png')",
57
+ },
58
+ },
59
+ required: ["name", "content_base64", "content_type"],
60
+ },
61
+ },
62
+ {
63
+ name: "download_file",
64
+ description: "Download a file's content from Bexio. Returns the file content as base64 encoded string for MCP JSON transport.",
65
+ inputSchema: {
66
+ type: "object",
67
+ properties: {
68
+ file_id: {
69
+ type: "integer",
70
+ description: "The ID of the file to download",
71
+ },
72
+ },
73
+ required: ["file_id"],
74
+ },
75
+ },
76
+ {
77
+ name: "update_file",
78
+ description: "Update a file's metadata in Bexio",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ file_id: {
83
+ type: "integer",
84
+ description: "The ID of the file to update",
85
+ },
86
+ file_data: {
87
+ type: "object",
88
+ description: "File metadata to update (e.g., name, description)",
89
+ },
90
+ },
91
+ required: ["file_id", "file_data"],
92
+ },
93
+ },
94
+ {
95
+ name: "delete_file",
96
+ description: "Delete a file from Bexio",
97
+ inputSchema: {
98
+ type: "object",
99
+ properties: {
100
+ file_id: {
101
+ type: "integer",
102
+ description: "The ID of the file to delete",
103
+ },
104
+ },
105
+ required: ["file_id"],
106
+ },
107
+ },
108
+ // ===== ADDITIONAL ADDRESSES =====
109
+ {
110
+ name: "list_additional_addresses",
111
+ description: "List additional addresses for a contact",
112
+ inputSchema: {
113
+ type: "object",
114
+ properties: {
115
+ contact_id: {
116
+ type: "integer",
117
+ description: "The ID of the contact",
118
+ },
119
+ limit: {
120
+ type: "integer",
121
+ description: "Maximum number of addresses to return (default: 50)",
122
+ default: 50,
123
+ },
124
+ offset: {
125
+ type: "integer",
126
+ description: "Number of addresses to skip (default: 0)",
127
+ default: 0,
128
+ },
129
+ },
130
+ required: ["contact_id"],
131
+ },
132
+ },
133
+ {
134
+ name: "get_additional_address",
135
+ description: "Get a specific additional address for a contact",
136
+ inputSchema: {
137
+ type: "object",
138
+ properties: {
139
+ contact_id: {
140
+ type: "integer",
141
+ description: "The ID of the contact",
142
+ },
143
+ address_id: {
144
+ type: "integer",
145
+ description: "The ID of the additional address",
146
+ },
147
+ },
148
+ required: ["contact_id", "address_id"],
149
+ },
150
+ },
151
+ {
152
+ name: "create_additional_address",
153
+ description: "Create an additional address for a contact",
154
+ inputSchema: {
155
+ type: "object",
156
+ properties: {
157
+ contact_id: {
158
+ type: "integer",
159
+ description: "The ID of the contact",
160
+ },
161
+ address_data: {
162
+ type: "object",
163
+ description: "The address data",
164
+ properties: {
165
+ name: {
166
+ type: "string",
167
+ description: "Name/label for the address",
168
+ },
169
+ address: {
170
+ type: "string",
171
+ description: "Street address",
172
+ },
173
+ postcode: {
174
+ type: "string",
175
+ description: "Postal code",
176
+ },
177
+ city: {
178
+ type: "string",
179
+ description: "City",
180
+ },
181
+ country_id: {
182
+ type: "integer",
183
+ description: "Country ID",
184
+ },
185
+ subject: {
186
+ type: "string",
187
+ description: "Subject/purpose of the address",
188
+ },
189
+ description: {
190
+ type: "string",
191
+ description: "Additional description",
192
+ },
193
+ },
194
+ },
195
+ },
196
+ required: ["contact_id", "address_data"],
197
+ },
198
+ },
199
+ {
200
+ name: "delete_additional_address",
201
+ description: "Delete an additional address from a contact",
202
+ inputSchema: {
203
+ type: "object",
204
+ properties: {
205
+ contact_id: {
206
+ type: "integer",
207
+ description: "The ID of the contact",
208
+ },
209
+ address_id: {
210
+ type: "integer",
211
+ description: "The ID of the additional address to delete",
212
+ },
213
+ },
214
+ required: ["contact_id", "address_id"],
215
+ },
216
+ },
217
+ ];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Files and Additional Addresses tool handlers.
3
+ * Implements the logic for each files domain 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,63 @@
1
+ /**
2
+ * Files and Additional Addresses tool handlers.
3
+ * Implements the logic for each files domain tool.
4
+ */
5
+ import { McpError } from "../../shared/errors.js";
6
+ import { ListFilesParamsSchema, GetFileParamsSchema, UploadFileParamsSchema, DownloadFileParamsSchema, UpdateFileParamsSchema, DeleteFileParamsSchema, ListAdditionalAddressesParamsSchema, GetAdditionalAddressParamsSchema, CreateAdditionalAddressParamsSchema, DeleteAdditionalAddressParamsSchema, } from "../../types/index.js";
7
+ export const handlers = {
8
+ // ===== FILES =====
9
+ list_files: async (client, args) => {
10
+ const params = ListFilesParamsSchema.parse(args);
11
+ return client.listFiles(params);
12
+ },
13
+ get_file: async (client, args) => {
14
+ const { file_id } = GetFileParamsSchema.parse(args);
15
+ const file = await client.getFile(file_id);
16
+ if (!file) {
17
+ throw McpError.notFound("File", file_id);
18
+ }
19
+ return file;
20
+ },
21
+ upload_file: async (client, args) => {
22
+ const params = UploadFileParamsSchema.parse(args);
23
+ return client.uploadFile(params);
24
+ },
25
+ download_file: async (client, args) => {
26
+ const { file_id } = DownloadFileParamsSchema.parse(args);
27
+ const content_base64 = await client.downloadFile(file_id);
28
+ return {
29
+ file_id,
30
+ content_base64,
31
+ message: "File content returned as base64 encoded string",
32
+ };
33
+ },
34
+ update_file: async (client, args) => {
35
+ const { file_id, file_data } = UpdateFileParamsSchema.parse(args);
36
+ return client.updateFile(file_id, file_data);
37
+ },
38
+ delete_file: async (client, args) => {
39
+ const { file_id } = DeleteFileParamsSchema.parse(args);
40
+ return client.deleteFile(file_id);
41
+ },
42
+ // ===== ADDITIONAL ADDRESSES =====
43
+ list_additional_addresses: async (client, args) => {
44
+ const { contact_id, limit, offset } = ListAdditionalAddressesParamsSchema.parse(args);
45
+ return client.listAdditionalAddresses(contact_id, { limit, offset });
46
+ },
47
+ get_additional_address: async (client, args) => {
48
+ const { contact_id, address_id } = GetAdditionalAddressParamsSchema.parse(args);
49
+ const address = await client.getAdditionalAddress(contact_id, address_id);
50
+ if (!address) {
51
+ throw McpError.notFound("Additional Address", address_id);
52
+ }
53
+ return address;
54
+ },
55
+ create_additional_address: async (client, args) => {
56
+ const { contact_id, address_data } = CreateAdditionalAddressParamsSchema.parse(args);
57
+ return client.createAdditionalAddress(contact_id, address_data);
58
+ },
59
+ delete_additional_address: async (client, args) => {
60
+ const { contact_id, address_id } = DeleteAdditionalAddressParamsSchema.parse(args);
61
+ return client.deleteAdditionalAddress(contact_id, address_id);
62
+ },
63
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Files domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
6
+ export type { HandlerFn } from "./handlers.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Files domain module barrel export.
3
+ */
4
+ export { toolDefinitions } from "./definitions.js";
5
+ export { handlers } from "./handlers.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Tool aggregation module.
3
+ * Single import point for all domain tools.
4
+ *
5
+ * Pattern for adding new domains:
6
+ * 1. Create tools/{domain}/definitions.ts
7
+ * 2. Create tools/{domain}/handlers.ts
8
+ * 3. Create tools/{domain}/index.ts
9
+ * 4. Import and add to arrays below
10
+ */
11
+ import type { Tool } from "@modelcontextprotocol/sdk/types.js";
12
+ import { BexioClient } from "../bexio-client.js";
13
+ export type HandlerFn = (client: BexioClient, args: unknown) => Promise<unknown>;
14
+ /** Get all tool definitions for registration */
15
+ export declare function getAllToolDefinitions(): Tool[];
16
+ /** Get handler for a specific tool */
17
+ export declare function getHandler(toolName: string): HandlerFn | undefined;
18
+ /** Create handler registry bound to a client */
19
+ export declare function createHandlerRegistry(client: BexioClient): Map<string, (args: unknown) => Promise<unknown>>;