listbee-mcp 0.1.0 → 0.4.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 (69) hide show
  1. package/README.md +24 -0
  2. package/dist/generated/meta.d.ts +8 -0
  3. package/dist/generated/meta.d.ts.map +1 -0
  4. package/dist/generated/meta.js +207 -0
  5. package/dist/generated/meta.js.map +1 -0
  6. package/dist/generated/schemas.d.ts +577 -0
  7. package/dist/generated/schemas.d.ts.map +1 -0
  8. package/dist/generated/schemas.js +44 -0
  9. package/dist/generated/schemas.js.map +1 -0
  10. package/dist/handlers/stripe-connect.d.ts +9 -0
  11. package/dist/handlers/stripe-connect.d.ts.map +1 -0
  12. package/dist/{tools/stripe.js → handlers/stripe-connect.js} +8 -4
  13. package/dist/handlers/stripe-connect.js.map +1 -0
  14. package/dist/handlers/upload-file.d.ts +7 -0
  15. package/dist/handlers/upload-file.d.ts.map +1 -0
  16. package/dist/handlers/upload-file.js +38 -0
  17. package/dist/handlers/upload-file.js.map +1 -0
  18. package/dist/handlers.d.ts +4 -0
  19. package/dist/handlers.d.ts.map +1 -0
  20. package/dist/handlers.js +41 -0
  21. package/dist/handlers.js.map +1 -0
  22. package/dist/index.js +62 -65
  23. package/dist/index.js.map +1 -1
  24. package/dist/server.d.ts.map +1 -1
  25. package/dist/server.js +63 -62
  26. package/dist/server.js.map +1 -1
  27. package/dist/transports/http.d.ts +7 -0
  28. package/dist/transports/http.d.ts.map +1 -0
  29. package/dist/transports/http.js +120 -0
  30. package/dist/transports/http.js.map +1 -0
  31. package/dist/transports/stdio.d.ts +7 -0
  32. package/dist/transports/stdio.d.ts.map +1 -0
  33. package/dist/transports/stdio.js +18 -0
  34. package/dist/transports/stdio.js.map +1 -0
  35. package/dist/types.d.ts +1 -8
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js +18 -18
  38. package/dist/types.js.map +1 -1
  39. package/dist/{tools/shared.d.ts → utils.d.ts} +2 -2
  40. package/dist/utils.d.ts.map +1 -0
  41. package/dist/{tools/shared.js → utils.js} +1 -1
  42. package/dist/utils.js.map +1 -0
  43. package/mcp-tools.yaml +273 -1
  44. package/package.json +10 -4
  45. package/dist/client.d.ts +0 -18
  46. package/dist/client.d.ts.map +0 -1
  47. package/dist/client.js +0 -61
  48. package/dist/client.js.map +0 -1
  49. package/dist/schemas.d.ts +0 -87
  50. package/dist/schemas.d.ts.map +0 -1
  51. package/dist/schemas.js +0 -137
  52. package/dist/schemas.js.map +0 -1
  53. package/dist/tools/files.d.ts +0 -7
  54. package/dist/tools/files.d.ts.map +0 -1
  55. package/dist/tools/files.js +0 -34
  56. package/dist/tools/files.js.map +0 -1
  57. package/dist/tools/listings.d.ts +0 -44
  58. package/dist/tools/listings.d.ts.map +0 -1
  59. package/dist/tools/listings.js +0 -83
  60. package/dist/tools/listings.js.map +0 -1
  61. package/dist/tools/orders.d.ts +0 -15
  62. package/dist/tools/orders.d.ts.map +0 -1
  63. package/dist/tools/orders.js +0 -28
  64. package/dist/tools/orders.js.map +0 -1
  65. package/dist/tools/shared.d.ts.map +0 -1
  66. package/dist/tools/shared.js.map +0 -1
  67. package/dist/tools/stripe.d.ts +0 -4
  68. package/dist/tools/stripe.d.ts.map +0 -1
  69. package/dist/tools/stripe.js.map +0 -1
@@ -0,0 +1,120 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
3
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
4
+ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
5
+ import { createServer } from "../server.js";
6
+ const transports = new Map();
7
+ const sessions = new Map();
8
+ const SESSION_TTL_MS = 30 * 60 * 1000;
9
+ const SWEEP_INTERVAL_MS = 5 * 60 * 1000;
10
+ function startTtlSweep() {
11
+ setInterval(() => {
12
+ const cutoff = Date.now() - SESSION_TTL_MS;
13
+ for (const [id, meta] of sessions) {
14
+ if (meta.lastSeenAt < cutoff) {
15
+ const transport = transports.get(id);
16
+ if (transport) {
17
+ transport.close();
18
+ transports.delete(id);
19
+ }
20
+ sessions.delete(id);
21
+ console.error(`[http] Evicted idle session ${id}`);
22
+ }
23
+ }
24
+ }, SWEEP_INTERVAL_MS);
25
+ }
26
+ export async function runHttp(config) {
27
+ // Bind to 0.0.0.0 for container/remote deployments — DNS rebinding protection
28
+ // is not applied for non-localhost hosts, which is correct for remote MCP.
29
+ const app = createMcpExpressApp({ host: "0.0.0.0" });
30
+ // Auth middleware — reject unauthenticated requests before MCP sees them
31
+ app.use("/mcp", (req, res, next) => {
32
+ const auth = req.headers.authorization;
33
+ if (!auth?.startsWith("Bearer ")) {
34
+ res.status(401).json({ error: "Missing Authorization: Bearer header" });
35
+ return;
36
+ }
37
+ next();
38
+ });
39
+ // MCP endpoint — handles all HTTP methods (GET for SSE, POST for requests, DELETE for close)
40
+ app.all("/mcp", async (req, res) => {
41
+ const sessionId = req.headers["mcp-session-id"];
42
+ // Route to existing session
43
+ if (sessionId && transports.has(sessionId)) {
44
+ const transport = transports.get(sessionId);
45
+ const meta = sessions.get(sessionId);
46
+ if (meta)
47
+ meta.lastSeenAt = Date.now();
48
+ await transport.handleRequest(req, res, req.body);
49
+ return;
50
+ }
51
+ // New session — must be an initialize request
52
+ if (req.method === "POST" && isInitializeRequest(req.body)) {
53
+ const apiKey = req.headers.authorization.replace("Bearer ", "");
54
+ const transport = new StreamableHTTPServerTransport({
55
+ sessionIdGenerator: () => randomUUID(),
56
+ onsessioninitialized: (sid) => {
57
+ transports.set(sid, transport);
58
+ sessions.set(sid, {
59
+ createdAt: Date.now(),
60
+ lastSeenAt: Date.now(),
61
+ });
62
+ transport.onclose = () => {
63
+ transports.delete(sid);
64
+ sessions.delete(sid);
65
+ console.error(`[http] Session closed: ${sid}`);
66
+ };
67
+ console.error(`[http] New session: ${sid}`);
68
+ },
69
+ });
70
+ const server = createServer({
71
+ apiKey,
72
+ baseUrl: config.baseUrl,
73
+ toolFilter: config.toolFilter,
74
+ });
75
+ await server.connect(transport);
76
+ await transport.handleRequest(req, res, req.body);
77
+ return;
78
+ }
79
+ res.status(400).json({
80
+ error: "Bad request — missing Mcp-Session-Id or not an initialize request",
81
+ });
82
+ });
83
+ // Root — landing page instead of Express 404
84
+ app.get("/", (_req, res) => {
85
+ res.json({
86
+ name: "ListBee MCP",
87
+ description: "Commerce API for AI agents",
88
+ endpoint: "/mcp",
89
+ transport: "streamable-http",
90
+ docs: "https://docs.listbee.so",
91
+ package: "npx listbee-mcp",
92
+ });
93
+ });
94
+ // Health checks
95
+ app.get("/health", (_req, res) => {
96
+ res.json({ status: "ok" });
97
+ });
98
+ app.get("/ready", (_req, res) => {
99
+ res.json({ status: "ready", sessions: sessions.size });
100
+ });
101
+ startTtlSweep();
102
+ // Graceful shutdown
103
+ const server = app.listen(config.port, "0.0.0.0", () => {
104
+ console.error(`ListBee MCP server (HTTP) listening on port ${config.port}`);
105
+ console.error(`Endpoint: http://localhost:${config.port}/mcp`);
106
+ });
107
+ const shutdown = () => {
108
+ console.error("\nShutting down...");
109
+ for (const [id, transport] of transports) {
110
+ transport.close();
111
+ transports.delete(id);
112
+ sessions.delete(id);
113
+ }
114
+ server.close(() => process.exit(0));
115
+ setTimeout(() => process.exit(1), 5000);
116
+ };
117
+ process.on("SIGINT", shutdown);
118
+ process.on("SIGTERM", shutdown);
119
+ }
120
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/transports/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;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AE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface StdioConfig {
2
+ apiKey: string;
3
+ baseUrl: string;
4
+ toolFilter?: Set<string>;
5
+ }
6
+ export declare function runStdio(config: StdioConfig): Promise<void>;
7
+ //# sourceMappingURL=stdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBjE"}
@@ -0,0 +1,18 @@
1
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { createServer } from "../server.js";
3
+ export async function runStdio(config) {
4
+ const server = createServer({
5
+ apiKey: config.apiKey,
6
+ baseUrl: config.baseUrl,
7
+ toolFilter: config.toolFilter,
8
+ });
9
+ const transport = new StdioServerTransport();
10
+ await server.connect(transport);
11
+ const shutdown = async () => {
12
+ await server.close();
13
+ process.exit(0);
14
+ };
15
+ process.on("SIGINT", shutdown);
16
+ process.on("SIGTERM", shutdown);
17
+ }
18
+ //# sourceMappingURL=stdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQ5C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAmB;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,18 +1,11 @@
1
1
  import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
- /**
3
- * Error thrown by ListBeeClient on non-2xx responses.
4
- */
5
- export declare class ListBeeApiError extends Error {
6
- readonly status: number;
7
- readonly body: unknown;
8
- constructor(status: number, body: unknown);
9
- }
10
2
  /**
11
3
  * Format a successful result as JSON text content.
12
4
  */
13
5
  export declare function jsonResult(data: unknown): CallToolResult;
14
6
  /**
15
7
  * Format an error as an isError result so the LLM can reason about it.
8
+ * Handles SDK's typed error hierarchy for structured output.
16
9
  */
17
10
  export declare function errorResult(err: unknown): CallToolResult;
18
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,OAAO;gBADb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO;CAShC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAIxD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAyBxD;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAO/E"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAIxD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAsCxD;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAO/E"}
package/dist/types.js CHANGED
@@ -1,19 +1,4 @@
1
- /**
2
- * Error thrown by ListBeeClient on non-2xx responses.
3
- */
4
- export class ListBeeApiError extends Error {
5
- status;
6
- body;
7
- constructor(status, body) {
8
- const msg = typeof body === "object" && body !== null && "detail" in body
9
- ? String(body.detail)
10
- : JSON.stringify(body);
11
- super(`ListBee API error ${status}: ${msg}`);
12
- this.status = status;
13
- this.body = body;
14
- this.name = "ListBeeApiError";
15
- }
16
- }
1
+ import { APIStatusError, APIConnectionError, APITimeoutError } from "listbee";
17
2
  /**
18
3
  * Format a successful result as JSON text content.
19
4
  */
@@ -24,9 +9,10 @@ export function jsonResult(data) {
24
9
  }
25
10
  /**
26
11
  * Format an error as an isError result so the LLM can reason about it.
12
+ * Handles SDK's typed error hierarchy for structured output.
27
13
  */
28
14
  export function errorResult(err) {
29
- if (err instanceof ListBeeApiError) {
15
+ if (err instanceof APIStatusError) {
30
16
  return {
31
17
  isError: true,
32
18
  content: [
@@ -34,12 +20,26 @@ export function errorResult(err) {
34
20
  type: "text",
35
21
  text: JSON.stringify({
36
22
  status: err.status,
37
- error: err.body,
23
+ code: err.code,
24
+ detail: err.detail,
25
+ ...(err.param ? { param: err.param } : {}),
38
26
  }, null, 2),
39
27
  },
40
28
  ],
41
29
  };
42
30
  }
31
+ if (err instanceof APIConnectionError) {
32
+ return {
33
+ isError: true,
34
+ content: [{ type: "text", text: `Connection error: ${err.message}` }],
35
+ };
36
+ }
37
+ if (err instanceof APITimeoutError) {
38
+ return {
39
+ isError: true,
40
+ content: [{ type: "text", text: `Request timed out: ${err.message}` }],
41
+ };
42
+ }
43
43
  const message = err instanceof Error ? err.message : String(err);
44
44
  return {
45
45
  isError: true,
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAEtB;IACA;IAFlB,YACkB,MAAc,EACd,IAAa;QAE7B,MAAM,GAAG,GACP,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,QAAQ,IAAI,IAAI;YAC3D,CAAC,CAAC,MAAM,CAAE,IAAgC,CAAC,MAAM,CAAC;YAClD,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,CAAC,qBAAqB,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;QAP7B,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QAO7B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CA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EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAI,EAAoB;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ToolMeta } from "../manifest.js";
1
+ import type { ToolMeta } from "./manifest.js";
2
2
  export interface Deliverable {
3
3
  type: string;
4
4
  token?: string;
@@ -15,4 +15,4 @@ export declare function autoTitle(name: string): string;
15
15
  * Complex tools get structured markdown; simple ones get a single sentence.
16
16
  */
17
17
  export declare function buildDescription(meta: ToolMeta): string;
18
- //# sourceMappingURL=shared.d.ts.map
18
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAsBvD"}
@@ -28,4 +28,4 @@ export function buildDescription(meta) {
28
28
  }
29
29
  return parts.join("\n\n");
30
30
  }
31
- //# sourceMappingURL=shared.js.map
31
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CACR,qFAAqF,CACtF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
package/mcp-tools.yaml CHANGED
@@ -17,12 +17,26 @@ tools:
17
17
  when_to_use: "Use when the user wants to sell something new."
18
18
  description: >
19
19
  Create a new listing for sale. Returns a checkout URL and readiness status.
20
+ Only name and price are required — but listings with rich content convert
21
+ significantly better. Fill in as many fields as you can: description, tagline,
22
+ highlights, badges, reviews, faqs, cta, cover_url. Write salesy, compelling
23
+ copy. The product page buyers see is built entirely from these fields.
20
24
  hints:
21
25
  - "Always check readiness.sellable in the response"
22
26
  - "readiness.next tells you the highest-priority action to take"
27
+ - "Only name + price are required, but fill in description, tagline, highlights, badges, reviews, faqs, cta for better conversions"
28
+ - "Write compelling, benefit-focused copy — this IS the product page buyers see"
29
+ - "checkout_schema and metadata are the only fields that don't appear on the product page"
23
30
  input_example:
24
31
  name: "50 Cold Outreach Templates"
25
32
  price: 1900
33
+ tagline: "Battle-tested templates that book meetings"
34
+ description: "50 proven cold outreach templates used by 500+ SDRs. Each template includes subject line, body, and follow-up sequence. Average 45% open rate."
35
+ highlights:
36
+ - "50 ready-to-send templates"
37
+ - "45% average open rate"
38
+ - "Follow-up sequences included"
39
+ cta: "Get the Templates"
26
40
 
27
41
  - type: operation
28
42
  operation_id: get_listing
@@ -113,7 +127,7 @@ tools:
113
127
  status: active
114
128
  when_to_use: "Use when the user has a file to sell. Upload first, then use the returned token in set_deliverables."
115
129
  description: >
116
- Fetches the file from the URL and uploads it to ListBee. Only use with URLs the user has provided or that you trust.
130
+ Upload a file and receive a token for use in deliverables.
117
131
  hints:
118
132
  - "Returns a file token — pass it to set_deliverables to attach the file to a listing"
119
133
 
@@ -145,6 +159,174 @@ tools:
145
159
  Push digital content to a buyer for an external fulfillment order.
146
160
  Not needed for managed delivery — ListBee handles that automatically.
147
161
 
162
+ - type: operation
163
+ operation_id: ship_order
164
+ name: ship_order
165
+ category: orders
166
+ priority: 7
167
+ status: active
168
+ when_to_use: "Use when a physical order needs shipping info recorded. Only for external fulfillment orders with physical goods."
169
+ description: >
170
+ Record shipping info (carrier + tracking code) and transition order to FULFILLED.
171
+ Only valid for external fulfillment orders. Idempotent with same tracking code.
172
+ hints:
173
+ - "Only works on orders in PAID state for EXTERNAL fulfillment listings"
174
+ - "Fires order.fulfilled webhook with shipping details"
175
+ input_example:
176
+ order_id: "ord_9xM4kP7nR2qT5wY1"
177
+ carrier: "USPS"
178
+ tracking_code: "9400111899223"
179
+
180
+ - type: operation
181
+ operation_id: refund_order
182
+ name: refund_order
183
+ category: orders
184
+ priority: 6
185
+ status: active
186
+ when_to_use: "When a buyer requests a refund or the seller needs to reverse a charge. Only works on paid or fulfilled orders."
187
+ description: >
188
+ Issue a full refund for an order. Refund is processed through Stripe on the
189
+ seller's connected account. Idempotent — already-refunded orders return as-is.
190
+ Order state (refund_amount, refunded_at) updates asynchronously via Stripe webhook.
191
+ hints:
192
+ - "Only works on orders in PAID or FULFILLED status"
193
+ - "Already-refunded orders return 200 with no action (idempotent)"
194
+ - "Fires order.refunded webhook after Stripe processes the refund"
195
+ input_example:
196
+ order_id: "ord_9xM4kP7nR2qT5wY1"
197
+
198
+ # --- Customers ---
199
+ - type: operation
200
+ operation_id: list_customers
201
+ name: list_customers
202
+ category: customers
203
+ priority: 7
204
+ status: active
205
+ when_to_use: "When the agent needs buyer email addresses for marketing, wants to analyze purchasing patterns, or needs to identify repeat customers."
206
+ description: >
207
+ List all customers (buyers) who have purchased from the seller. Auto-populated
208
+ from orders — no manual creation needed. Sorted by most recent purchase first.
209
+ Filter by email for exact match lookup.
210
+ hints:
211
+ - "Customers are auto-created on first order — read-only, no create/delete"
212
+ - "Use email filter to look up a specific buyer"
213
+ - "total_spent is in cents (smallest currency unit)"
214
+
215
+ - type: operation
216
+ operation_id: get_customer
217
+ name: get_customer
218
+ category: customers
219
+ priority: 6
220
+ status: active
221
+ when_to_use: "When the agent needs purchase history details for a specific buyer."
222
+ description: >
223
+ Get a customer by ID. Shows total orders, total spent, currency, and purchase dates.
224
+ Customers represent unique buyer emails that have purchased from the seller.
225
+ hints:
226
+ - "Use list_customers with email filter if you have the email but not the ID"
227
+
228
+ # --- Account ---
229
+ - type: operation
230
+ operation_id: get_account
231
+ name: get_account
232
+ category: account
233
+ priority: 8
234
+ status: active
235
+ when_to_use: "Use to check account status, readiness, billing, Stripe connection, and profile details."
236
+ description: >
237
+ Get the authenticated account's full state including readiness and billing status.
238
+ This is the first call an agent should make to understand what's set up.
239
+ hints:
240
+ - "Call this first to understand account state"
241
+ - "readiness.operational tells you if the account can sell"
242
+ - "Check payment_config to see if Stripe is connected"
243
+
244
+ - type: operation
245
+ operation_id: update_account
246
+ name: update_account
247
+ category: account
248
+ priority: 5
249
+ status: active
250
+ when_to_use: "Use to update account profile — display name, bio, avatar."
251
+ description: >
252
+ Update the account's display name, bio, or avatar. These appear on product pages
253
+ as the seller identity.
254
+
255
+ - type: operation
256
+ operation_id: delete_account
257
+ name: delete_account
258
+ category: account
259
+ priority: 1
260
+ status: active
261
+ when_to_use: "Use only when the user explicitly wants to permanently delete their account."
262
+ description: >
263
+ Permanently delete the account and all associated data. This is irreversible.
264
+ hints:
265
+ - "This is destructive and irreversible — confirm with the user first"
266
+
267
+ - type: operation
268
+ operation_id: create_account
269
+ name: create_account
270
+ category: account
271
+ priority: 10
272
+ status: active
273
+ when_to_use: "Use when a new user wants to sign up. First step in the onboarding flow."
274
+ description: >
275
+ Create a new ListBee account with an email address. Sends an OTP code to the email
276
+ for verification. Follow up with verify_otp to complete signup and get an API key.
277
+ hints:
278
+ - "This sends an OTP email — the user must provide the code"
279
+ - "After create_account, call verify_otp with the code"
280
+
281
+ - type: operation
282
+ operation_id: verify_otp
283
+ name: verify_otp
284
+ category: account
285
+ priority: 10
286
+ status: active
287
+ when_to_use: "Use after create_account to verify the email OTP code and complete signup."
288
+ description: >
289
+ Verify the OTP code sent to the user's email during account creation.
290
+ Returns an API key on success — store it securely for all future API calls.
291
+ hints:
292
+ - "The user must provide the OTP code from their email"
293
+ - "On success, returns an API key (lb_ prefixed) — this is the only time it's shown"
294
+
295
+ # --- API Keys ---
296
+ - type: operation
297
+ operation_id: list_api_keys
298
+ name: list_api_keys
299
+ category: api_keys
300
+ priority: 4
301
+ status: active
302
+ when_to_use: "Use to see all API keys for the account."
303
+ description: >
304
+ List all API keys. Shows key prefixes and names but not full key values
305
+ (those are only shown at creation time).
306
+
307
+ - type: operation
308
+ operation_id: create_api_key
309
+ name: create_api_key
310
+ category: api_keys
311
+ priority: 4
312
+ status: active
313
+ when_to_use: "Use when the user needs a new API key, e.g. for a separate agent or integration."
314
+ description: >
315
+ Create a new API key. The full key value (lb_ prefixed) is returned only once —
316
+ store it securely. Each key can have a name for identification.
317
+ hints:
318
+ - "The full key is only shown once at creation — store it immediately"
319
+
320
+ - type: operation
321
+ operation_id: delete_api_key
322
+ name: delete_api_key
323
+ category: api_keys
324
+ priority: 2
325
+ status: active
326
+ when_to_use: "Use to revoke an API key that is no longer needed or compromised."
327
+ description: >
328
+ Delete an API key. The key is immediately revoked and cannot be used again.
329
+
148
330
  # --- Stripe ---
149
331
  - type: operation
150
332
  operation_id: start_stripe_connect
@@ -161,6 +343,96 @@ tools:
161
343
  - "You cannot complete this — the human must open the URL"
162
344
  - "After the human completes onboarding, check readiness again"
163
345
 
346
+ - type: operation
347
+ operation_id: disconnect_stripe
348
+ name: disconnect_stripe
349
+ category: stripe
350
+ priority: 2
351
+ status: active
352
+ when_to_use: "Use when the user wants to disconnect their Stripe account."
353
+ description: >
354
+ Disconnect the Stripe account from ListBee. Existing listings retain their
355
+ payment snapshot but new checkouts will fail.
356
+ hints:
357
+ - "This doesn't delete the Stripe account — just disconnects it from ListBee"
358
+
359
+ # --- Webhooks ---
360
+ - type: operation
361
+ operation_id: list_webhooks
362
+ name: list_webhooks
363
+ category: webhooks
364
+ priority: 7
365
+ status: active
366
+ when_to_use: "Use to see configured webhooks and their delivery status."
367
+ description: >
368
+ List all webhooks for the account. Shows URL, events filter, and enabled status.
369
+
370
+ - type: operation
371
+ operation_id: create_webhook
372
+ name: create_webhook
373
+ category: webhooks
374
+ priority: 8
375
+ status: active
376
+ when_to_use: "Use when the user needs to receive order notifications at a URL. Required for external fulfillment."
377
+ description: >
378
+ Create a webhook endpoint. Specify the URL and which events to receive.
379
+ The webhook secret (whsec_ prefixed) is returned for signature verification.
380
+ hints:
381
+ - "Required for external fulfillment listings — readiness checks for this"
382
+ - "Common events: order.paid, order.fulfilled, order.refunded"
383
+ - "The secret is only shown once at creation"
384
+ input_example:
385
+ url: "https://your-server.com/webhooks"
386
+ events: ["order.paid", "order.fulfilled"]
387
+
388
+ - type: operation
389
+ operation_id: update_webhook
390
+ name: update_webhook
391
+ category: webhooks
392
+ priority: 5
393
+ status: active
394
+ when_to_use: "Use to change a webhook's URL, events filter, or enabled status."
395
+
396
+ - type: operation
397
+ operation_id: delete_webhook
398
+ name: delete_webhook
399
+ category: webhooks
400
+ priority: 3
401
+ status: active
402
+ when_to_use: "Use to remove a webhook endpoint."
403
+
404
+ - type: operation
405
+ operation_id: list_webhook_events
406
+ name: list_webhook_events
407
+ category: webhooks
408
+ priority: 5
409
+ status: active
410
+ when_to_use: "Use to check webhook delivery history — see which events were sent and whether they succeeded."
411
+ description: >
412
+ List recent events for a webhook. Shows delivery status, attempts, and errors.
413
+ Useful for debugging failed deliveries.
414
+
415
+ - type: operation
416
+ operation_id: retry_webhook_event
417
+ name: retry_webhook_event
418
+ category: webhooks
419
+ priority: 4
420
+ status: active
421
+ when_to_use: "Use when a webhook delivery failed and needs to be retried."
422
+ description: >
423
+ Retry delivery of a failed webhook event. Resets attempt counter.
424
+
425
+ - type: operation
426
+ operation_id: test_webhook
427
+ name: test_webhook
428
+ category: webhooks
429
+ priority: 5
430
+ status: active
431
+ when_to_use: "Use to send a test event to a webhook URL to verify it's working."
432
+ description: >
433
+ Send a test event to the webhook URL. Returns the delivery result.
434
+ Use this to verify webhook configuration before going live.
435
+
164
436
  # --- Future composite tools (v2+) ---
165
437
  # - type: composite
166
438
  # name: create_and_publish
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listbee-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for ListBee — commerce API for AI agents",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -15,18 +15,24 @@
15
15
  "node": ">=20"
16
16
  },
17
17
  "scripts": {
18
- "build": "tsc && chmod +x dist/index.js",
19
- "dev": "tsc --watch",
20
- "lint": "tsc --noEmit",
18
+ "generate": "tsx scripts/generate.ts",
19
+ "generate:check": "tsx scripts/generate.ts --check",
20
+ "build": "npm run generate && tsc && chmod +x dist/index.js",
21
+ "dev": "tsx src/index.ts",
22
+ "lint": "npm run generate:check && tsc --noEmit",
21
23
  "prepublishOnly": "npm run build"
22
24
  },
23
25
  "dependencies": {
24
26
  "@modelcontextprotocol/sdk": "1.29.0",
27
+ "listbee": "^0.6.1",
25
28
  "yaml": "2.8.3",
26
29
  "zod": "3.25.76"
27
30
  },
28
31
  "devDependencies": {
32
+ "@types/express": "^5.0.6",
29
33
  "@types/node": "22.19.17",
34
+ "json-schema-to-zod": "^2.8.1",
35
+ "tsx": "^4.21.0",
30
36
  "typescript": "5.9.3"
31
37
  },
32
38
  "repository": {
package/dist/client.d.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Thin fetch wrapper for the ListBee REST API.
3
- * All requests include Authorization header. Non-2xx throws ListBeeApiError.
4
- */
5
- export declare class ListBeeClient {
6
- private readonly apiKey;
7
- private readonly baseUrl;
8
- constructor(apiKey: string, baseUrl?: string);
9
- /**
10
- * Make an authenticated JSON request. Returns parsed response body.
11
- */
12
- request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
13
- /**
14
- * Upload a file via multipart form data to /v1/files.
15
- */
16
- uploadFile(fileBuffer: Uint8Array, filename: string): Promise<unknown>;
17
- }
18
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,MAAM,EAAE,OAAO,SAA2B;IAM9D;;OAEG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC;IA8Bb;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAsB7E"}