@sellhapi/mcp 0.1.5 → 0.1.6
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/server.js +2 -0
- package/dist/tools/invoices.d.ts +7 -0
- package/dist/tools/invoices.js +80 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -13,6 +13,7 @@ const commerce_js_1 = require("./tools/commerce.js");
|
|
|
13
13
|
const content_js_1 = require("./tools/content.js");
|
|
14
14
|
const intelligence_js_1 = require("./tools/intelligence.js");
|
|
15
15
|
const analytics_js_1 = require("./tools/analytics.js");
|
|
16
|
+
const invoices_js_1 = require("./tools/invoices.js");
|
|
16
17
|
const index_js_1 = require("./resources/index.js");
|
|
17
18
|
function createMcpServer() {
|
|
18
19
|
const server = new mcp_js_1.McpServer({
|
|
@@ -24,6 +25,7 @@ function createMcpServer() {
|
|
|
24
25
|
(0, content_js_1.registerContentTools)(server);
|
|
25
26
|
(0, intelligence_js_1.registerIntelligenceTools)(server);
|
|
26
27
|
(0, analytics_js_1.registerAnalyticsTools)(server);
|
|
28
|
+
(0, invoices_js_1.registerInvoiceTools)(server);
|
|
27
29
|
(0, index_js_1.registerResources)(server);
|
|
28
30
|
return server;
|
|
29
31
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invoice tools — create and list custom, service, and appointment invoices.
|
|
3
|
+
* All three invoice types are vendor-initiated: the vendor creates the invoice
|
|
4
|
+
* and sends the payment link to the customer.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
export declare function registerInvoiceTools(server: McpServer): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Invoice tools — create and list custom, service, and appointment invoices.
|
|
4
|
+
* All three invoice types are vendor-initiated: the vendor creates the invoice
|
|
5
|
+
* and sends the payment link to the customer.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.registerInvoiceTools = registerInvoiceTools;
|
|
9
|
+
const v4_1 = require("zod/v4");
|
|
10
|
+
const client_js_1 = require("../client.js");
|
|
11
|
+
const util_js_1 = require("../util.js");
|
|
12
|
+
function registerInvoiceTools(server) {
|
|
13
|
+
// ── List all invoices ─────────────────────────────────────────────────────
|
|
14
|
+
server.registerTool("list_invoices", {
|
|
15
|
+
title: "List Invoices",
|
|
16
|
+
description: "List all invoices across all types (custom, service, appointment). Returns the most recent 50 of each type with id, type, status, isPaid, recipient, link, and createdAt. Use this to check existing invoices before creating new ones.",
|
|
17
|
+
annotations: { readOnlyHint: true },
|
|
18
|
+
}, async () => (0, util_js_1.safeCall)(async () => {
|
|
19
|
+
const data = await (0, client_js_1.get)("/api/mcp/invoices");
|
|
20
|
+
return JSON.stringify(data, null, 2);
|
|
21
|
+
}));
|
|
22
|
+
// ── Create custom invoice ─────────────────────────────────────────────────
|
|
23
|
+
server.registerTool("create_custom_invoice", {
|
|
24
|
+
title: "Create Custom Invoice",
|
|
25
|
+
description: "Create a free-form invoice with custom line items for any recipient. Returns a payment link (/ci/:id) that you can share with the customer. Line item prices are in kobo (₦1 = 100 kobo). Recipient must have at least an email or phone.",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
title: v4_1.z.string().describe("Invoice title e.g. 'Website Design Project'"),
|
|
28
|
+
lineItems: v4_1.z.array(v4_1.z.object({
|
|
29
|
+
description: v4_1.z.string().describe("Line item description e.g. 'Logo Design'"),
|
|
30
|
+
qty: v4_1.z.number().int().min(1).describe("Quantity"),
|
|
31
|
+
unitPriceKobo: v4_1.z.number().int().min(0).describe("Unit price in kobo"),
|
|
32
|
+
})).min(1).describe("Invoice line items — at least one required"),
|
|
33
|
+
recipient: v4_1.z.object({
|
|
34
|
+
name: v4_1.z.string().describe("Recipient full name"),
|
|
35
|
+
email: v4_1.z.string().optional().describe("Recipient email"),
|
|
36
|
+
phone: v4_1.z.string().optional().describe("Recipient phone (Nigerian format, e.g. 08012345678)"),
|
|
37
|
+
}).describe("Invoice recipient — must have at least email or phone"),
|
|
38
|
+
notes: v4_1.z.string().optional().describe("Internal notes or payment terms shown on the invoice"),
|
|
39
|
+
},
|
|
40
|
+
}, async (input) => (0, util_js_1.safeCall)(async () => {
|
|
41
|
+
const data = await (0, client_js_1.post)("/api/mcp/invoices/custom", input);
|
|
42
|
+
return JSON.stringify(data, null, 2);
|
|
43
|
+
}));
|
|
44
|
+
// ── Create service invoice ────────────────────────────────────────────────
|
|
45
|
+
server.registerTool("create_service_invoice", {
|
|
46
|
+
title: "Create Service Invoice",
|
|
47
|
+
description: "Create an invoice for a specific service listing. Call list_service_listings first to get a valid serviceListingId. Returns a payment link (/service-invoices/:id) the customer can pay online. The price you set overrides the listing's default price — use this for custom quotes.",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
serviceListingId: v4_1.z.string().uuid().describe("Service listing ID from list_service_listings"),
|
|
50
|
+
priceKobo: v4_1.z.number().int().min(0).describe("Invoice price in kobo (can differ from listing's base price)"),
|
|
51
|
+
recipient: v4_1.z.object({
|
|
52
|
+
name: v4_1.z.string().describe("Recipient full name"),
|
|
53
|
+
email: v4_1.z.string().optional().describe("Recipient email"),
|
|
54
|
+
phone: v4_1.z.string().optional().describe("Recipient phone (Nigerian format)"),
|
|
55
|
+
}).describe("Invoice recipient — must have at least email or phone"),
|
|
56
|
+
notes: v4_1.z.string().optional().describe("Notes or scope of work for this engagement"),
|
|
57
|
+
},
|
|
58
|
+
}, async (input) => (0, util_js_1.safeCall)(async () => {
|
|
59
|
+
const data = await (0, client_js_1.post)("/api/mcp/invoices/service", input);
|
|
60
|
+
return JSON.stringify(data, null, 2);
|
|
61
|
+
}));
|
|
62
|
+
// ── Create appointment invoice ────────────────────────────────────────────
|
|
63
|
+
server.registerTool("create_appointment_invoice", {
|
|
64
|
+
title: "Create Appointment Invoice",
|
|
65
|
+
description: "Create an invoice for an appointment service (schedule-later mode). The customer pays first via the payment link (/appointment-invoices/:id), then you assign a specific time slot from the Appointments dashboard. Call list_appointment_services first to get a valid serviceId.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
serviceId: v4_1.z.string().uuid().describe("Appointment service ID from list_appointment_services"),
|
|
68
|
+
priceKobo: v4_1.z.number().int().min(0).describe("Invoice price in kobo"),
|
|
69
|
+
recipient: v4_1.z.object({
|
|
70
|
+
name: v4_1.z.string().describe("Recipient full name"),
|
|
71
|
+
email: v4_1.z.string().optional().describe("Recipient email"),
|
|
72
|
+
phone: v4_1.z.string().optional().describe("Recipient phone (Nigerian format)"),
|
|
73
|
+
}).describe("Invoice recipient — must have at least email or phone"),
|
|
74
|
+
notes: v4_1.z.string().optional().describe("Additional notes for the appointment"),
|
|
75
|
+
},
|
|
76
|
+
}, async (input) => (0, util_js_1.safeCall)(async () => {
|
|
77
|
+
const data = await (0, client_js_1.post)("/api/mcp/invoices/appointment", input);
|
|
78
|
+
return JSON.stringify(data, null, 2);
|
|
79
|
+
}));
|
|
80
|
+
}
|