@zyphr-dev/mcp-server 0.1.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/README.md +117 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2315 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
- package/src/client.ts +25 -0
- package/src/config.test.ts +64 -0
- package/src/config.ts +33 -0
- package/src/index.ts +24 -0
- package/src/integration/quickstart/email.ts +646 -0
- package/src/integration/quickstart/inbox.ts +222 -0
- package/src/integration/quickstart/index.ts +45 -0
- package/src/integration/quickstart/push.ts +216 -0
- package/src/integration/quickstart/quickstart.test.ts +108 -0
- package/src/integration/quickstart/sms.ts +205 -0
- package/src/integration/quickstart/webhook.ts +664 -0
- package/src/integration/quickstart-types.ts +31 -0
- package/src/integration/sdk-snippets.test.ts +63 -0
- package/src/integration/sdk-snippets.ts +248 -0
- package/src/result.test.ts +107 -0
- package/src/result.ts +65 -0
- package/src/schemas.ts +231 -0
- package/src/server.ts +26 -0
- package/src/tools/index.ts +7 -0
- package/src/tools/integration.ts +54 -0
- package/src/tools/send.ts +153 -0
- package/src/tools/subscribers.ts +126 -0
- package/src/tools/templates.ts +87 -0
- package/src/tools/webhooks.ts +82 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { getZyphrClient } from '../client.js';
|
|
3
|
+
import { isToolEnabled, type ToolGuards } from '../config.js';
|
|
4
|
+
import { runTool } from '../result.js';
|
|
5
|
+
import {
|
|
6
|
+
createWebhookShape,
|
|
7
|
+
getWebhookDeliveriesShape,
|
|
8
|
+
listWebhooksShape,
|
|
9
|
+
} from '../schemas.js';
|
|
10
|
+
|
|
11
|
+
export function registerWebhookTools(server: McpServer, guards: ToolGuards): void {
|
|
12
|
+
if (isToolEnabled({ name: 'list_webhooks', mutates: false }, guards)) {
|
|
13
|
+
server.registerTool(
|
|
14
|
+
'list_webhooks',
|
|
15
|
+
{
|
|
16
|
+
title: 'List webhooks',
|
|
17
|
+
description: 'List webhook endpoints configured for the account.',
|
|
18
|
+
inputSchema: listWebhooksShape,
|
|
19
|
+
},
|
|
20
|
+
async (args) => {
|
|
21
|
+
return runTool(async () => {
|
|
22
|
+
const zyphr = getZyphrClient();
|
|
23
|
+
return await zyphr.webhooks.listWebhooks(args.limit, args.offset);
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isToolEnabled({ name: 'create_webhook', mutates: true }, guards)) {
|
|
30
|
+
server.registerTool(
|
|
31
|
+
'create_webhook',
|
|
32
|
+
{
|
|
33
|
+
title: 'Create webhook',
|
|
34
|
+
description:
|
|
35
|
+
'Register a new webhook endpoint. Subscribe to event types like "email.*", "subscriber.created", or "*".',
|
|
36
|
+
inputSchema: createWebhookShape,
|
|
37
|
+
},
|
|
38
|
+
async (args) => {
|
|
39
|
+
return runTool(async () => {
|
|
40
|
+
const zyphr = getZyphrClient();
|
|
41
|
+
return await zyphr.webhooks.createWebhook({
|
|
42
|
+
url: args.url,
|
|
43
|
+
events: args.events,
|
|
44
|
+
description: args.description,
|
|
45
|
+
secret: args.secret,
|
|
46
|
+
metadata: args.metadata,
|
|
47
|
+
headers: args.headers,
|
|
48
|
+
version: args.version,
|
|
49
|
+
rateLimit: args.rateLimit,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (isToolEnabled({ name: 'get_webhook_deliveries', mutates: false }, guards)) {
|
|
57
|
+
server.registerTool(
|
|
58
|
+
'get_webhook_deliveries',
|
|
59
|
+
{
|
|
60
|
+
title: 'List webhook deliveries',
|
|
61
|
+
description:
|
|
62
|
+
'Inspect delivery history for a webhook endpoint. Filter by status (pending/delivering/delivered/failed/exhausted), event type, or date range. Useful for debugging why a webhook is not firing.',
|
|
63
|
+
inputSchema: getWebhookDeliveriesShape,
|
|
64
|
+
},
|
|
65
|
+
async (args) => {
|
|
66
|
+
return runTool(async () => {
|
|
67
|
+
const zyphr = getZyphrClient();
|
|
68
|
+
return await zyphr.webhooks.listWebhookDeliveries(
|
|
69
|
+
args.webhookId,
|
|
70
|
+
args.status,
|
|
71
|
+
args.eventType,
|
|
72
|
+
args.search,
|
|
73
|
+
args.startDate ? new Date(args.startDate) : undefined,
|
|
74
|
+
args.endDate ? new Date(args.endDate) : undefined,
|
|
75
|
+
args.limit,
|
|
76
|
+
args.offset,
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|