@procurementexpress.com/mcp 1.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 (40) hide show
  1. package/README.md +376 -0
  2. package/dist/api-client.d.ts +31 -0
  3. package/dist/api-client.js +108 -0
  4. package/dist/auth.d.ts +29 -0
  5. package/dist/auth.js +59 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +119 -0
  8. package/dist/tool-helpers.d.ts +34 -0
  9. package/dist/tool-helpers.js +26 -0
  10. package/dist/tools/approval-flows.d.ts +3 -0
  11. package/dist/tools/approval-flows.js +121 -0
  12. package/dist/tools/budgets.d.ts +3 -0
  13. package/dist/tools/budgets.js +73 -0
  14. package/dist/tools/comments.d.ts +3 -0
  15. package/dist/tools/comments.js +24 -0
  16. package/dist/tools/companies.d.ts +3 -0
  17. package/dist/tools/companies.js +67 -0
  18. package/dist/tools/departments.d.ts +3 -0
  19. package/dist/tools/departments.js +69 -0
  20. package/dist/tools/invoices.d.ts +3 -0
  21. package/dist/tools/invoices.js +132 -0
  22. package/dist/tools/payments.d.ts +3 -0
  23. package/dist/tools/payments.js +65 -0
  24. package/dist/tools/products.d.ts +3 -0
  25. package/dist/tools/products.js +57 -0
  26. package/dist/tools/purchase-orders.d.ts +3 -0
  27. package/dist/tools/purchase-orders.js +152 -0
  28. package/dist/tools/supplementary.d.ts +3 -0
  29. package/dist/tools/supplementary.js +70 -0
  30. package/dist/tools/suppliers.d.ts +3 -0
  31. package/dist/tools/suppliers.js +80 -0
  32. package/dist/tools/tax-rates.d.ts +3 -0
  33. package/dist/tools/tax-rates.js +44 -0
  34. package/dist/tools/users.d.ts +3 -0
  35. package/dist/tools/users.js +37 -0
  36. package/dist/tools/webhooks.d.ts +3 -0
  37. package/dist/tools/webhooks.js +61 -0
  38. package/dist/types.d.ts +732 -0
  39. package/dist/types.js +3 -0
  40. package/package.json +50 -0
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ import { jsonResponse, withErrorHandling } from "../tool-helpers.js";
3
+ export function registerUserTools(server, apiClient) {
4
+ server.registerTool("get_current_user", {
5
+ description: "Get the currently authenticated user's profile, including company memberships and roles",
6
+ inputSchema: {},
7
+ }, withErrorHandling(async () => {
8
+ const user = await apiClient.get(apiClient.buildPath("/currentuser"));
9
+ return jsonResponse(user);
10
+ }));
11
+ server.registerTool("update_current_user", {
12
+ description: "Update the current user's profile (email, name, phone number, password)",
13
+ inputSchema: {
14
+ email: z.string().email().optional().describe("New email address"),
15
+ name: z.string().optional().describe("New name"),
16
+ phone_number: z.string().optional().describe("New phone number"),
17
+ password: z.string().optional().describe("New password"),
18
+ },
19
+ }, withErrorHandling(async (args) => {
20
+ const user = await apiClient.put(apiClient.buildPath("/currentuser"), args);
21
+ return jsonResponse(user);
22
+ }));
23
+ server.registerTool("list_currencies", {
24
+ description: "List enabled currencies for the current company",
25
+ inputSchema: {},
26
+ }, withErrorHandling(async () => {
27
+ const currencies = await apiClient.get(apiClient.buildPath("/currencies"));
28
+ return jsonResponse(currencies);
29
+ }));
30
+ server.registerTool("list_all_currencies", {
31
+ description: "List all available currencies globally",
32
+ inputSchema: {},
33
+ }, withErrorHandling(async () => {
34
+ const currencies = await apiClient.get(apiClient.buildPath("/all_currencies"));
35
+ return jsonResponse(currencies);
36
+ }));
37
+ }
@@ -0,0 +1,3 @@
1
+ import type { ApiClient } from "../api-client.js";
2
+ import type { Server } from "../tool-helpers.js";
3
+ export declare function registerWebhookTools(server: Server, apiClient: ApiClient): void;
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ import { jsonResponse, withErrorHandling } from "../tool-helpers.js";
3
+ export function registerWebhookTools(server, apiClient) {
4
+ server.registerTool("list_webhooks", {
5
+ description: "List webhooks with optional archived filter",
6
+ inputSchema: {
7
+ archived: z.boolean().optional().describe("Filter by archived status"),
8
+ },
9
+ }, withErrorHandling(async (args) => {
10
+ const params = new URLSearchParams();
11
+ if (args.archived !== undefined)
12
+ params.set("archived", String(args.archived));
13
+ const query = params.toString();
14
+ const path = `${apiClient.buildPath("/webhooks")}${query ? `?${query}` : ""}`;
15
+ const webhooks = await apiClient.get(path);
16
+ return jsonResponse(webhooks);
17
+ }));
18
+ server.registerTool("get_webhook", {
19
+ description: "Get a specific webhook by ID",
20
+ inputSchema: {
21
+ id: z.number().int().positive().describe("Webhook ID"),
22
+ },
23
+ }, withErrorHandling(async (args) => {
24
+ const webhook = await apiClient.get(apiClient.buildPath(`/webhooks/${args.id}`));
25
+ return jsonResponse(webhook);
26
+ }));
27
+ server.registerTool("create_webhook", {
28
+ description: "Create a webhook. Events: new_po, po_approved, po_delivered, po_paid, po_cancelled, po_update",
29
+ inputSchema: {
30
+ name: z.string().describe("Webhook name"),
31
+ url: z.string().url().describe("Handler URL"),
32
+ event_type: z
33
+ .array(z.enum(["new_po", "po_approved", "po_delivered", "po_paid", "po_cancelled", "po_update"]))
34
+ .describe("Events to subscribe to"),
35
+ json_wrapper: z.string().optional().describe("Root key for JSON data"),
36
+ send_as_text: z.boolean().optional().describe("Send payload as text instead of JSON"),
37
+ basic_auth_uname: z.string().optional().describe("Basic auth username"),
38
+ basic_auth_pword: z.string().optional().describe("Basic auth password"),
39
+ },
40
+ }, withErrorHandling(async (args) => {
41
+ const webhook = await apiClient.post(apiClient.buildPath("/webhooks"), { webhook: args });
42
+ return jsonResponse(webhook);
43
+ }));
44
+ server.registerTool("update_webhook", {
45
+ description: "Update an existing webhook",
46
+ inputSchema: {
47
+ id: z.number().int().positive().describe("Webhook ID"),
48
+ name: z.string().optional().describe("Webhook name"),
49
+ url: z.string().url().optional().describe("Handler URL"),
50
+ event_type: z
51
+ .array(z.enum(["new_po", "po_approved", "po_delivered", "po_paid", "po_cancelled", "po_update"]))
52
+ .optional()
53
+ .describe("Events to subscribe to"),
54
+ archived: z.boolean().optional().describe("Archive status"),
55
+ },
56
+ }, withErrorHandling(async (args) => {
57
+ const { id, ...data } = args;
58
+ const webhook = await apiClient.put(apiClient.buildPath(`/webhooks/${id}`), { webhook: data });
59
+ return jsonResponse(webhook);
60
+ }));
61
+ }