@webhooks-cc/mcp 1.10.1 → 1.12.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 +12 -13
- package/dist/bin/mcp.js +489 -167
- package/dist/index.d.mts +21 -6
- package/dist/index.d.ts +21 -6
- package/dist/index.js +494 -167
- package/dist/index.mjs +496 -168
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24,11 +24,12 @@ __export(index_exports, {
|
|
|
24
24
|
registerAgentRegistrationTools: () => registerAgentRegistrationTools,
|
|
25
25
|
registerPrompts: () => registerPrompts,
|
|
26
26
|
registerResources: () => registerResources,
|
|
27
|
+
registerSandboxTools: () => registerSandboxTools,
|
|
27
28
|
registerTools: () => registerTools
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(index_exports);
|
|
30
31
|
var import_mcp2 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
31
|
-
var
|
|
32
|
+
var import_sdk3 = require("@webhooks-cc/sdk");
|
|
32
33
|
|
|
33
34
|
// src/prompts.ts
|
|
34
35
|
var import_zod = require("zod");
|
|
@@ -405,6 +406,10 @@ function registerResources(server, client) {
|
|
|
405
406
|
);
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
// src/sandbox-tools.ts
|
|
410
|
+
var import_zod3 = require("zod");
|
|
411
|
+
var import_sdk2 = require("@webhooks-cc/sdk");
|
|
412
|
+
|
|
408
413
|
// src/tools.ts
|
|
409
414
|
var import_zod2 = require("zod");
|
|
410
415
|
var import_sdk = require("@webhooks-cc/sdk");
|
|
@@ -464,6 +469,44 @@ var mockResponseSchema = import_zod2.z.object({
|
|
|
464
469
|
`Response delay in milliseconds (${import_sdk.MOCK_RESPONSE_DELAY_MIN}-${import_sdk.MOCK_RESPONSE_DELAY_MAX}, default: none)`
|
|
465
470
|
)
|
|
466
471
|
});
|
|
472
|
+
var createEndpointShape = {
|
|
473
|
+
name: import_zod2.z.string().optional().describe("Display name for the endpoint"),
|
|
474
|
+
ephemeral: import_zod2.z.boolean().optional().describe("Create a temporary endpoint that auto-expires"),
|
|
475
|
+
expiresIn: durationOrTimestampSchema.optional().describe('Auto-expire after this duration, for example "12h"'),
|
|
476
|
+
mockResponse: mockResponseSchema.optional().describe("Optional mock response to return when the endpoint receives a request"),
|
|
477
|
+
responseRules: responseRulesSchema.optional().describe(
|
|
478
|
+
"Conditional response rules. Each rule has conditions and a response. First matching rule wins."
|
|
479
|
+
),
|
|
480
|
+
notificationUrl: import_zod2.z.string().url().optional().describe(
|
|
481
|
+
"URL to POST a JSON summary to after each captured request (e.g. Slack/Discord webhook)"
|
|
482
|
+
),
|
|
483
|
+
signingProvider: import_zod2.z.string().optional().describe(
|
|
484
|
+
"Signing provider for automatic signature verification (e.g. stripe, github, shopify)"
|
|
485
|
+
),
|
|
486
|
+
signingSecret: import_zod2.z.string().optional().describe(
|
|
487
|
+
"Signing secret (encrypted server-side, never returned). Required when signingProvider is set."
|
|
488
|
+
),
|
|
489
|
+
signingHeader: import_zod2.z.string().optional().describe("Custom signature header name. Only used with generic-hmac provider.")
|
|
490
|
+
};
|
|
491
|
+
var listEndpointsShape = {
|
|
492
|
+
team: import_zod2.z.string().min(1).optional().describe(
|
|
493
|
+
"Team id or name (case-insensitive). Keeps endpoints shared with you from that team and endpoints you own that are shared with it."
|
|
494
|
+
)
|
|
495
|
+
};
|
|
496
|
+
var getEndpointShape = { slug: import_zod2.z.string().describe("The endpoint slug") };
|
|
497
|
+
var deleteEndpointShape = { slug: import_zod2.z.string().describe("The endpoint slug to delete") };
|
|
498
|
+
var listRequestsShape = {
|
|
499
|
+
endpointSlug: import_zod2.z.string().describe("The endpoint slug"),
|
|
500
|
+
limit: import_zod2.z.number().int().min(1).max(100).default(25).describe("Max requests to return"),
|
|
501
|
+
since: import_zod2.z.number().optional().describe("Only return requests after this timestamp in ms"),
|
|
502
|
+
kind: kindSchema
|
|
503
|
+
};
|
|
504
|
+
var getRequestShape = { requestId: import_zod2.z.string().describe("The request ID") };
|
|
505
|
+
var waitForRequestShape = {
|
|
506
|
+
endpointSlug: import_zod2.z.string().describe("The endpoint slug to monitor"),
|
|
507
|
+
timeout: durationOrTimestampSchema.default("30s").describe('How long to wait, for example "30s"'),
|
|
508
|
+
pollInterval: durationOrTimestampSchema.optional().describe('Interval between polls, for example "500ms" or "1s"')
|
|
509
|
+
};
|
|
467
510
|
function textContent(text) {
|
|
468
511
|
return { content: [{ type: "text", text }] };
|
|
469
512
|
}
|
|
@@ -767,25 +810,7 @@ function registerTools(server, client) {
|
|
|
767
810
|
server.tool(
|
|
768
811
|
"create_endpoint",
|
|
769
812
|
"Create a webhook endpoint. Returns the endpoint slug, URL, and metadata.",
|
|
770
|
-
|
|
771
|
-
name: import_zod2.z.string().optional().describe("Display name for the endpoint"),
|
|
772
|
-
ephemeral: import_zod2.z.boolean().optional().describe("Create a temporary endpoint that auto-expires"),
|
|
773
|
-
expiresIn: durationOrTimestampSchema.optional().describe('Auto-expire after this duration, for example "12h"'),
|
|
774
|
-
mockResponse: mockResponseSchema.optional().describe("Optional mock response to return when the endpoint receives a request"),
|
|
775
|
-
responseRules: responseRulesSchema.optional().describe(
|
|
776
|
-
"Conditional response rules. Each rule has conditions and a response. First matching rule wins."
|
|
777
|
-
),
|
|
778
|
-
notificationUrl: import_zod2.z.string().url().optional().describe(
|
|
779
|
-
"URL to POST a JSON summary to after each captured request (e.g. Slack/Discord webhook)"
|
|
780
|
-
),
|
|
781
|
-
signingProvider: import_zod2.z.string().optional().describe(
|
|
782
|
-
"Signing provider for automatic signature verification (e.g. stripe, github, shopify)"
|
|
783
|
-
),
|
|
784
|
-
signingSecret: import_zod2.z.string().optional().describe(
|
|
785
|
-
"Signing secret (encrypted server-side, never returned). Required when signingProvider is set."
|
|
786
|
-
),
|
|
787
|
-
signingHeader: import_zod2.z.string().optional().describe("Custom signature header name. Only used with generic-hmac provider.")
|
|
788
|
-
},
|
|
813
|
+
createEndpointShape,
|
|
789
814
|
withErrorHandling(
|
|
790
815
|
async ({
|
|
791
816
|
name,
|
|
@@ -838,11 +863,7 @@ function registerTools(server, client) {
|
|
|
838
863
|
server.tool(
|
|
839
864
|
"list_endpoints",
|
|
840
865
|
"List webhook endpoints: those you own (with sharedWith) and those shared with you through teams (with fromTeam). Optionally keep only one team's endpoints.",
|
|
841
|
-
|
|
842
|
-
team: import_zod2.z.string().min(1).optional().describe(
|
|
843
|
-
"Team id or name (case-insensitive). Keeps endpoints shared with you from that team and endpoints you own that are shared with it."
|
|
844
|
-
)
|
|
845
|
-
},
|
|
866
|
+
listEndpointsShape,
|
|
846
867
|
withErrorHandling(async ({ team }) => {
|
|
847
868
|
const endpoints = await client.endpoints.list({ team });
|
|
848
869
|
return jsonContent(endpoints);
|
|
@@ -898,7 +919,7 @@ function registerTools(server, client) {
|
|
|
898
919
|
server.tool(
|
|
899
920
|
"get_endpoint",
|
|
900
921
|
"Get details for a specific webhook endpoint by slug.",
|
|
901
|
-
|
|
922
|
+
getEndpointShape,
|
|
902
923
|
withErrorHandling(async ({ slug }) => {
|
|
903
924
|
const endpoint = await client.endpoints.get(slug);
|
|
904
925
|
return jsonContent(endpoint);
|
|
@@ -951,7 +972,7 @@ function registerTools(server, client) {
|
|
|
951
972
|
server.tool(
|
|
952
973
|
"delete_endpoint",
|
|
953
974
|
"Delete a webhook endpoint and all its captured requests.",
|
|
954
|
-
|
|
975
|
+
deleteEndpointShape,
|
|
955
976
|
withErrorHandling(async ({ slug }) => {
|
|
956
977
|
await client.endpoints.delete(slug);
|
|
957
978
|
return textContent(`Endpoint "${slug}" deleted.`);
|
|
@@ -1055,12 +1076,7 @@ function registerTools(server, client) {
|
|
|
1055
1076
|
server.tool(
|
|
1056
1077
|
"list_requests",
|
|
1057
1078
|
"List recent captured requests for an endpoint, HTTP requests and emails together (filter with kind). For emails, list_emails is shorter.",
|
|
1058
|
-
|
|
1059
|
-
endpointSlug: import_zod2.z.string().describe("The endpoint slug"),
|
|
1060
|
-
limit: import_zod2.z.number().int().min(1).max(100).default(25).describe("Max requests to return"),
|
|
1061
|
-
since: import_zod2.z.number().optional().describe("Only return requests after this timestamp in ms"),
|
|
1062
|
-
kind: kindSchema
|
|
1063
|
-
},
|
|
1079
|
+
listRequestsShape,
|
|
1064
1080
|
withErrorHandling(async ({ endpointSlug, limit, since, kind }) => {
|
|
1065
1081
|
const requests = await client.requests.list(endpointSlug, { limit, since, kind });
|
|
1066
1082
|
return jsonContent(requests.map(compactRequest));
|
|
@@ -1114,7 +1130,7 @@ function registerTools(server, client) {
|
|
|
1114
1130
|
server.tool(
|
|
1115
1131
|
"get_request",
|
|
1116
1132
|
"Get full details for a specific captured request by ID.",
|
|
1117
|
-
|
|
1133
|
+
getRequestShape,
|
|
1118
1134
|
withErrorHandling(async ({ requestId }) => {
|
|
1119
1135
|
const request = await client.requests.get(requestId);
|
|
1120
1136
|
return jsonContent(compactRequest(request));
|
|
@@ -1123,11 +1139,7 @@ function registerTools(server, client) {
|
|
|
1123
1139
|
server.tool(
|
|
1124
1140
|
"wait_for_request",
|
|
1125
1141
|
"Wait for a request to arrive at an endpoint.",
|
|
1126
|
-
|
|
1127
|
-
endpointSlug: import_zod2.z.string().describe("The endpoint slug to monitor"),
|
|
1128
|
-
timeout: durationOrTimestampSchema.default("30s").describe('How long to wait, for example "30s"'),
|
|
1129
|
-
pollInterval: durationOrTimestampSchema.optional().describe('Interval between polls, for example "500ms" or "1s"')
|
|
1130
|
-
},
|
|
1142
|
+
waitForRequestShape,
|
|
1131
1143
|
withErrorHandling(async ({ endpointSlug, timeout, pollInterval }) => {
|
|
1132
1144
|
const request = await client.requests.waitFor(endpointSlug, { timeout, pollInterval });
|
|
1133
1145
|
return jsonContent(compactRequest(request));
|
|
@@ -1548,25 +1560,52 @@ function registerTools(server, client) {
|
|
|
1548
1560
|
);
|
|
1549
1561
|
server.tool(
|
|
1550
1562
|
"configure_forwarding",
|
|
1551
|
-
"
|
|
1563
|
+
"Change an endpoint's forwarding: the URL, on or off, which kinds (HTTP requests, emails), the format, your own headers, and the advanced options. Only the arguments you pass change. Owner only. Saving the first URL creates the signing secret. A Slack or Discord webhook URL gets a chat message automatically.",
|
|
1552
1564
|
{
|
|
1553
1565
|
slug: import_zod2.z.string().describe("The endpoint slug"),
|
|
1554
1566
|
url: httpUrlSchema.nullable().optional().describe("https URL on a public host name, or null to remove it (forwarding must be off)"),
|
|
1555
|
-
enabled: import_zod2.z.boolean().optional().describe("Turn forwarding on (needs a URL) or off (fails deliveries still waiting)")
|
|
1567
|
+
enabled: import_zod2.z.boolean().optional().describe("Turn forwarding on (needs a URL) or off (fails deliveries still waiting)"),
|
|
1568
|
+
http: import_zod2.z.boolean().optional().describe("Forward HTTP requests"),
|
|
1569
|
+
email: import_zod2.z.boolean().optional().describe("Forward emails"),
|
|
1570
|
+
format: import_zod2.z.enum(["auto", "as_received", "json", "chat"]).optional().describe(
|
|
1571
|
+
"auto (pick from the URL), as_received (relay HTTP requests unchanged; emails as signed JSON), json (signed JSON envelope for both kinds) or chat (Slack or Discord message)"
|
|
1572
|
+
),
|
|
1573
|
+
headers: import_zod2.z.array(
|
|
1574
|
+
import_zod2.z.object({
|
|
1575
|
+
name: import_zod2.z.string().describe("Header name, e.g. Authorization"),
|
|
1576
|
+
value: import_zod2.z.string().nullable().describe("Header value, or null to keep the value stored under this name")
|
|
1577
|
+
})
|
|
1578
|
+
).max(10).optional().describe(
|
|
1579
|
+
"Your own headers for every delivery (not chat). Replaces the whole list; [] removes them"
|
|
1580
|
+
),
|
|
1581
|
+
appendPath: import_zod2.z.boolean().optional().describe("Add the path after the slug to the URL for relayed requests (default true)"),
|
|
1582
|
+
retrySeconds: import_zod2.z.union([import_zod2.z.literal(0), import_zod2.z.literal(3600), import_zod2.z.literal(86400)]).optional().describe("Retry failed deliveries for 86400 (default), 3600 or 0 seconds"),
|
|
1583
|
+
keepOrder: import_zod2.z.boolean().optional().describe("One delivery at a time, in capture order (default false)"),
|
|
1584
|
+
sentField: import_zod2.z.string().max(128).nullable().optional().describe(
|
|
1585
|
+
"JSON body field with the sender's own timestamp, e.g. publishedAt or data.publishedAt; null clears it"
|
|
1586
|
+
)
|
|
1556
1587
|
},
|
|
1557
|
-
withErrorHandling(async ({ slug,
|
|
1558
|
-
const endpoint = await client.forwarding.configure(slug,
|
|
1588
|
+
withErrorHandling(async ({ slug, ...options }) => {
|
|
1589
|
+
const endpoint = await client.forwarding.configure(slug, options);
|
|
1559
1590
|
return jsonContent({
|
|
1560
1591
|
slug: endpoint.slug,
|
|
1561
1592
|
forwardEnabled: endpoint.forwardEnabled ?? false,
|
|
1562
1593
|
forwardUrl: endpoint.forwardUrl ?? null,
|
|
1563
|
-
hasForwardSecret: endpoint.hasForwardSecret ?? false
|
|
1594
|
+
hasForwardSecret: endpoint.hasForwardSecret ?? false,
|
|
1595
|
+
forwardHttp: endpoint.forwardHttp ?? false,
|
|
1596
|
+
forwardEmail: endpoint.forwardEmail ?? false,
|
|
1597
|
+
forwardFormat: endpoint.forwardFormat ?? "auto",
|
|
1598
|
+
forwardHeaders: endpoint.forwardHeaders ?? [],
|
|
1599
|
+
forwardAppendPath: endpoint.forwardAppendPath ?? true,
|
|
1600
|
+
forwardRetrySeconds: endpoint.forwardRetrySeconds ?? 86400,
|
|
1601
|
+
forwardKeepOrder: endpoint.forwardKeepOrder ?? false,
|
|
1602
|
+
forwardSentField: endpoint.forwardSentField ?? null
|
|
1564
1603
|
});
|
|
1565
1604
|
})
|
|
1566
1605
|
);
|
|
1567
1606
|
server.tool(
|
|
1568
1607
|
"get_forwarding_secret",
|
|
1569
|
-
"Read (or with rotate: true, replace) the whsec_ secret forwarded
|
|
1608
|
+
"Read (or with rotate: true, replace) the whsec_ secret forwarded deliveries are signed with. Owner only. Treat the value as a credential: put it in the handler's environment, not in code.",
|
|
1570
1609
|
{
|
|
1571
1610
|
slug: import_zod2.z.string().describe("The endpoint slug"),
|
|
1572
1611
|
rotate: import_zod2.z.boolean().default(false).describe("Replace the secret; every delivery from now on uses the new one")
|
|
@@ -1578,35 +1617,57 @@ function registerTools(server, client) {
|
|
|
1578
1617
|
);
|
|
1579
1618
|
server.tool(
|
|
1580
1619
|
"test_forwarding",
|
|
1581
|
-
"
|
|
1582
|
-
{
|
|
1583
|
-
|
|
1584
|
-
|
|
1620
|
+
"Send the endpoint's newest captured request of a kind (or a sample) to its forwarding URL once, exactly as a delivery would go out, and report the answer. Works with forwarding on or off; nothing is retried or logged.",
|
|
1621
|
+
{
|
|
1622
|
+
slug: import_zod2.z.string().describe("The endpoint slug"),
|
|
1623
|
+
kind: import_zod2.z.enum(["http", "email"]).optional().describe(
|
|
1624
|
+
"Which kind to send (default: http when HTTP requests are forwarded, else email)"
|
|
1625
|
+
)
|
|
1626
|
+
},
|
|
1627
|
+
withErrorHandling(async ({ slug, kind }) => {
|
|
1628
|
+
return jsonContent(await client.forwarding.test(slug, kind ? { kind } : {}));
|
|
1585
1629
|
})
|
|
1586
1630
|
);
|
|
1587
1631
|
server.tool(
|
|
1588
1632
|
"list_deliveries",
|
|
1589
|
-
"List forwarding deliveries: an endpoint's
|
|
1633
|
+
"List forwarding deliveries: an endpoint's delivery log with its counts (endpointSlug), or every delivery and try of one captured request or email (requestId). Rows carry senderAt when the request had the sender's own timestamp, so receivedAt - senderAt is the time to reach webhooks.cc.",
|
|
1590
1634
|
{
|
|
1591
|
-
endpointSlug: import_zod2.z.string().optional().describe("List the endpoint's
|
|
1592
|
-
requestId: import_zod2.z.string().optional().describe("List every delivery and try of this
|
|
1593
|
-
limit: import_zod2.z.number().int().min(1).max(
|
|
1635
|
+
endpointSlug: import_zod2.z.string().optional().describe("List the endpoint's delivery log"),
|
|
1636
|
+
requestId: import_zod2.z.string().optional().describe("List every delivery and try of this request"),
|
|
1637
|
+
limit: import_zod2.z.number().int().min(1).max(100).default(20).describe("With endpointSlug: max rows"),
|
|
1638
|
+
status: import_zod2.z.enum(["all", "pending", "failed"]).default("all").describe("With endpointSlug: all, pending (queued or retrying) or failed"),
|
|
1639
|
+
before: import_zod2.z.string().optional().describe("With endpointSlug: a row's cursor, to list older rows")
|
|
1594
1640
|
},
|
|
1595
|
-
withErrorHandling(async ({ endpointSlug, requestId, limit }) => {
|
|
1641
|
+
withErrorHandling(async ({ endpointSlug, requestId, limit, status, before }) => {
|
|
1596
1642
|
if (requestId === void 0 === (endpointSlug === void 0)) {
|
|
1597
1643
|
throw new Error("Pass exactly one of endpointSlug or requestId");
|
|
1598
1644
|
}
|
|
1599
|
-
return jsonContent(
|
|
1600
|
-
|
|
1601
|
-
|
|
1645
|
+
if (requestId) return jsonContent(await client.forwarding.requestDeliveries(requestId));
|
|
1646
|
+
const [summary, deliveries] = await Promise.all([
|
|
1647
|
+
client.forwarding.summary(endpointSlug),
|
|
1648
|
+
client.forwarding.deliveries(endpointSlug, { limit, status, before })
|
|
1649
|
+
]);
|
|
1650
|
+
return jsonContent({
|
|
1651
|
+
summary,
|
|
1652
|
+
deliveries,
|
|
1653
|
+
nextCursor: deliveries.length === limit ? deliveries[deliveries.length - 1]?.cursor ?? null : null
|
|
1654
|
+
});
|
|
1602
1655
|
})
|
|
1603
1656
|
);
|
|
1604
1657
|
server.tool(
|
|
1605
|
-
"
|
|
1606
|
-
"Forward
|
|
1607
|
-
{
|
|
1608
|
-
|
|
1609
|
-
|
|
1658
|
+
"redeliver",
|
|
1659
|
+
"Forward again with the endpoint's current settings: one captured request or email (requestId; it also sends one that was never forwarded), or every request whose latest delivery failed (endpointSlug, oldest first, up to 1,000 at a time). Owner only; fails while forwarding is off.",
|
|
1660
|
+
{
|
|
1661
|
+
requestId: import_zod2.z.string().optional().describe("The request or email to send again"),
|
|
1662
|
+
endpointSlug: import_zod2.z.string().optional().describe("Send every failed delivery of this endpoint again")
|
|
1663
|
+
},
|
|
1664
|
+
withErrorHandling(async ({ requestId, endpointSlug }) => {
|
|
1665
|
+
if (requestId === void 0 === (endpointSlug === void 0)) {
|
|
1666
|
+
throw new Error("Pass exactly one of requestId or endpointSlug");
|
|
1667
|
+
}
|
|
1668
|
+
return jsonContent(
|
|
1669
|
+
requestId ? await client.forwarding.redeliver(requestId) : await client.forwarding.redeliverFailed(endpointSlug)
|
|
1670
|
+
);
|
|
1610
1671
|
})
|
|
1611
1672
|
);
|
|
1612
1673
|
server.tool(
|
|
@@ -1618,127 +1679,392 @@ function registerTools(server, client) {
|
|
|
1618
1679
|
return jsonContent(description);
|
|
1619
1680
|
})
|
|
1620
1681
|
);
|
|
1621
|
-
registerAgentRegistrationTools(server);
|
|
1622
1682
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1683
|
+
|
|
1684
|
+
// src/sandbox-tools.ts
|
|
1685
|
+
var SANDBOX = {
|
|
1686
|
+
maxEndpoints: 3,
|
|
1687
|
+
requestsPerEndpoint: 25,
|
|
1688
|
+
requests: 100,
|
|
1689
|
+
lifetimeHours: 24
|
|
1690
|
+
};
|
|
1691
|
+
var DEFAULT_WAIT_SECONDS = 45;
|
|
1692
|
+
var MAX_WAIT_SECONDS = 600;
|
|
1693
|
+
var TOKEN_REFRESH_MARGIN_MS = 6e4;
|
|
1694
|
+
var DOCS_URL = "https://webhooks.cc/docs/agents";
|
|
1695
|
+
var ACCOUNT_ONLY_OPTIONS = [
|
|
1696
|
+
"mockResponse",
|
|
1697
|
+
"responseRules",
|
|
1698
|
+
"notificationUrl",
|
|
1699
|
+
"signingProvider",
|
|
1700
|
+
"signingSecret",
|
|
1701
|
+
"signingHeader"
|
|
1702
|
+
];
|
|
1703
|
+
var AgentSession = class {
|
|
1704
|
+
constructor(baseUrl, webhookUrl, clientName) {
|
|
1705
|
+
this.baseUrl = baseUrl;
|
|
1706
|
+
this.webhookUrl = webhookUrl;
|
|
1707
|
+
this.clientName = clientName;
|
|
1708
|
+
this.sandbox = null;
|
|
1709
|
+
this.claim = null;
|
|
1710
|
+
this.connected = false;
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* The sandbox, registered on first use and again after it expired. Tool
|
|
1714
|
+
* calls can run in parallel: this.sandbox is read again after every await,
|
|
1715
|
+
* and a new sandbox is assigned with no await in between, so parallel
|
|
1716
|
+
* calls share one registration. Calls waiting on a registration that fails
|
|
1717
|
+
* get its error (a 429 asks them to wait); the next call starts again.
|
|
1718
|
+
*/
|
|
1719
|
+
async sandboxClient() {
|
|
1720
|
+
while (this.sandbox) {
|
|
1721
|
+
const pending = this.sandbox;
|
|
1722
|
+
const sandbox = await pending;
|
|
1723
|
+
if (!this.expired(pending, sandbox)) return sandbox;
|
|
1724
|
+
}
|
|
1725
|
+
const created = import_sdk2.WebhooksCC.sandbox({
|
|
1726
|
+
baseUrl: this.baseUrl,
|
|
1727
|
+
webhookUrl: this.webhookUrl,
|
|
1728
|
+
clientName: this.clientName
|
|
1729
|
+
});
|
|
1730
|
+
this.sandbox = created;
|
|
1731
|
+
created.catch(() => {
|
|
1732
|
+
if (this.sandbox === created) this.sandbox = null;
|
|
1733
|
+
});
|
|
1734
|
+
return created;
|
|
1735
|
+
}
|
|
1736
|
+
/** The live sandbox, if one was registered; never registers one. */
|
|
1737
|
+
async existingSandbox() {
|
|
1738
|
+
const pending = this.sandbox;
|
|
1739
|
+
if (!pending) return null;
|
|
1740
|
+
let sandbox;
|
|
1741
|
+
try {
|
|
1742
|
+
sandbox = await pending;
|
|
1743
|
+
} catch {
|
|
1744
|
+
return null;
|
|
1745
|
+
}
|
|
1746
|
+
return this.expired(pending, sandbox) ? null : sandbox;
|
|
1747
|
+
}
|
|
1748
|
+
/** True when the sandbox is past its 24 hours; then it is dropped. */
|
|
1749
|
+
expired(pending, sandbox) {
|
|
1750
|
+
if (sandbox.expiresAt.getTime() > Date.now()) return false;
|
|
1751
|
+
if (this.sandbox === pending) this.sandbox = null;
|
|
1752
|
+
if (this.claim?.kind === "sandbox" && this.claim.claimToken === sandbox.registration.claimToken) {
|
|
1753
|
+
this.claim = null;
|
|
1754
|
+
}
|
|
1755
|
+
return true;
|
|
1756
|
+
}
|
|
1757
|
+
async requireSandbox() {
|
|
1758
|
+
const sandbox = await this.existingSandbox();
|
|
1759
|
+
if (!sandbox) {
|
|
1760
|
+
throw new Error("No sandbox yet: create_endpoint starts one.");
|
|
1761
|
+
}
|
|
1762
|
+
return sandbox;
|
|
1763
|
+
}
|
|
1764
|
+
forgetSandbox() {
|
|
1765
|
+
this.sandbox = null;
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
function claimedTokens(baseUrl, assertion, first) {
|
|
1769
|
+
let current = first;
|
|
1770
|
+
let pending = null;
|
|
1771
|
+
return async (options) => {
|
|
1772
|
+
if (!options?.forceRefresh && current.expiresAt.getTime() - Date.now() > TOKEN_REFRESH_MARGIN_MS) {
|
|
1773
|
+
return current.accessToken;
|
|
1774
|
+
}
|
|
1775
|
+
if (!pending) {
|
|
1776
|
+
pending = import_sdk2.WebhooksCC.agent.exchange({ baseUrl, assertion }).finally(() => {
|
|
1777
|
+
pending = null;
|
|
1639
1778
|
});
|
|
1640
|
-
}
|
|
1779
|
+
}
|
|
1780
|
+
current = await pending;
|
|
1781
|
+
return current.accessToken;
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function minutesLeft(until) {
|
|
1785
|
+
return Math.max(1, Math.round((until.getTime() - Date.now()) / 6e4));
|
|
1786
|
+
}
|
|
1787
|
+
function onlyKind(requests, kind) {
|
|
1788
|
+
if (!kind) return requests;
|
|
1789
|
+
return requests.filter((request) => (request.kind ?? "http") === kind);
|
|
1790
|
+
}
|
|
1791
|
+
function registerSandboxTools(server, options = {}) {
|
|
1792
|
+
const baseUrl = options.baseUrl ?? process.env.WHK_BASE_URL ?? "https://webhooks.cc";
|
|
1793
|
+
const session = new AgentSession(
|
|
1794
|
+
baseUrl,
|
|
1795
|
+
options.webhookUrl ?? process.env.WHK_WEBHOOK_URL,
|
|
1796
|
+
options.clientName ?? "webhooks-cc-mcp"
|
|
1641
1797
|
);
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1798
|
+
const registered = [];
|
|
1799
|
+
const limits = `up to ${SANDBOX.maxEndpoints} endpoints at a time, ${SANDBOX.requestsPerEndpoint} captured requests each and ${SANDBOX.requests} in all, deleted ${SANDBOX.lifetimeHours} hours after the sandbox was created`;
|
|
1800
|
+
registered.push(
|
|
1801
|
+
server.tool(
|
|
1802
|
+
"create_endpoint",
|
|
1803
|
+
`Create a temporary webhook capture endpoint in the agent sandbox (no account needed): ${limits}. The first call registers the sandbox, which takes a few seconds of proof of work. Mock responses, notifications and signature verification need an account: see connect_account.`,
|
|
1804
|
+
createEndpointShape,
|
|
1805
|
+
withErrorHandling(async (args) => {
|
|
1806
|
+
const accountOnly = ACCOUNT_ONLY_OPTIONS.filter((key) => args[key] !== void 0);
|
|
1807
|
+
if (accountOnly.length > 0) {
|
|
1808
|
+
throw new Error(
|
|
1809
|
+
`${accountOnly.join(", ")} need an account; sandbox endpoints only capture and answer 200. Call connect_account to connect one.`
|
|
1810
|
+
);
|
|
1811
|
+
}
|
|
1812
|
+
const sandbox = await session.sandboxClient();
|
|
1813
|
+
const endpoint = await sandbox.endpoints.create();
|
|
1814
|
+
const ignored = args.name !== void 0 || args.expiresIn !== void 0;
|
|
1815
|
+
return jsonContent(
|
|
1816
|
+
ignored ? {
|
|
1817
|
+
...endpoint,
|
|
1818
|
+
note: "Sandbox endpoints have no name and expire with the sandbox."
|
|
1819
|
+
} : endpoint
|
|
1820
|
+
);
|
|
1821
|
+
})
|
|
1822
|
+
)
|
|
1663
1823
|
);
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1824
|
+
registered.push(
|
|
1825
|
+
server.tool(
|
|
1826
|
+
"list_endpoints",
|
|
1827
|
+
"List this agent's sandbox endpoints. Empty until create_endpoint starts the sandbox.",
|
|
1828
|
+
listEndpointsShape,
|
|
1829
|
+
withErrorHandling(async ({ team }) => {
|
|
1830
|
+
if (team !== void 0) {
|
|
1831
|
+
throw new Error("Teams need an account. Call connect_account to connect one.");
|
|
1832
|
+
}
|
|
1833
|
+
const sandbox = await session.existingSandbox();
|
|
1834
|
+
return jsonContent(sandbox ? await sandbox.endpoints.list() : []);
|
|
1835
|
+
})
|
|
1836
|
+
)
|
|
1674
1837
|
);
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
return jsonContent({
|
|
1685
|
-
claimToken: challenge.claimToken,
|
|
1686
|
-
expiresAt: challenge.claimTokenExpires,
|
|
1687
|
-
postClaimScopes: challenge.postClaimScopes,
|
|
1688
|
-
next_step: `A one-time code was emailed to ${email}. Ask the human for it, then call verify_agent_otp with this claimToken and the code.`
|
|
1689
|
-
});
|
|
1690
|
-
})
|
|
1838
|
+
registered.push(
|
|
1839
|
+
server.tool(
|
|
1840
|
+
"get_endpoint",
|
|
1841
|
+
"Get one of this agent's sandbox endpoints by slug, with its sandbox limits and usage.",
|
|
1842
|
+
getEndpointShape,
|
|
1843
|
+
withErrorHandling(async ({ slug }) => {
|
|
1844
|
+
return jsonContent(await (await session.requireSandbox()).endpoints.get(slug));
|
|
1845
|
+
})
|
|
1846
|
+
)
|
|
1691
1847
|
);
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
credential: issued.credential,
|
|
1703
|
-
scopes: issued.scopes,
|
|
1704
|
-
usage: "Set WHK_API_KEY to `credential` to use the authenticated tools."
|
|
1705
|
-
});
|
|
1706
|
-
})
|
|
1848
|
+
registered.push(
|
|
1849
|
+
server.tool(
|
|
1850
|
+
"delete_endpoint",
|
|
1851
|
+
"Delete one of this agent's sandbox endpoints and its captured requests. Frees a slot; the sandbox's request budget is not refunded.",
|
|
1852
|
+
deleteEndpointShape,
|
|
1853
|
+
withErrorHandling(async ({ slug }) => {
|
|
1854
|
+
await (await session.requireSandbox()).endpoints.delete(slug);
|
|
1855
|
+
return jsonContent({ deleted: slug });
|
|
1856
|
+
})
|
|
1857
|
+
)
|
|
1707
1858
|
);
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1859
|
+
registered.push(
|
|
1860
|
+
server.tool(
|
|
1861
|
+
"list_requests",
|
|
1862
|
+
"List recent requests captured by a sandbox endpoint, newest first.",
|
|
1863
|
+
listRequestsShape,
|
|
1864
|
+
withErrorHandling(async ({ endpointSlug, limit, since, kind }) => {
|
|
1865
|
+
const sandbox = await session.requireSandbox();
|
|
1866
|
+
const requests = await sandbox.requests.list(endpointSlug, { limit, since });
|
|
1867
|
+
return jsonContent(onlyKind(requests, kind).map(compactRequest));
|
|
1868
|
+
})
|
|
1869
|
+
)
|
|
1870
|
+
);
|
|
1871
|
+
registered.push(
|
|
1872
|
+
server.tool(
|
|
1873
|
+
"get_request",
|
|
1874
|
+
"Get full details for a request captured by a sandbox endpoint.",
|
|
1875
|
+
getRequestShape,
|
|
1876
|
+
withErrorHandling(async ({ requestId }) => {
|
|
1877
|
+
const sandbox = await session.requireSandbox();
|
|
1878
|
+
return jsonContent(compactRequest(await sandbox.requests.get(requestId)));
|
|
1879
|
+
})
|
|
1880
|
+
)
|
|
1881
|
+
);
|
|
1882
|
+
registered.push(
|
|
1883
|
+
server.tool(
|
|
1884
|
+
"wait_for_request",
|
|
1885
|
+
"Wait for a request to arrive at a sandbox endpoint.",
|
|
1886
|
+
waitForRequestShape,
|
|
1887
|
+
withErrorHandling(async ({ endpointSlug, timeout, pollInterval }) => {
|
|
1888
|
+
const sandbox = await session.requireSandbox();
|
|
1889
|
+
const request = await sandbox.requests.waitFor(endpointSlug, { timeout, pollInterval });
|
|
1890
|
+
return jsonContent(compactRequest(request));
|
|
1891
|
+
})
|
|
1892
|
+
)
|
|
1893
|
+
);
|
|
1894
|
+
registered.push(
|
|
1895
|
+
server.tool(
|
|
1896
|
+
"connect_account",
|
|
1897
|
+
"Connect this agent to a human's webhooks.cc account, for the full tool set (mock responses, signatures, email, teams) and to keep the sandbox endpoints. Returns a link and a 6-digit code: show both to the human, who signs in or signs up with that email and enters the code. Then call wait_for_connection. Calling again gives a new code.",
|
|
1898
|
+
{
|
|
1899
|
+
email: import_zod3.z.string().email({ message: "Invalid email address" }).describe("The human's email address; only someone signed in as it can connect")
|
|
1900
|
+
},
|
|
1901
|
+
withErrorHandling(async ({ email }) => {
|
|
1902
|
+
if (session.connected) {
|
|
1903
|
+
return jsonContent({ connected: true, message: "Already connected to an account." });
|
|
1904
|
+
}
|
|
1905
|
+
const normalized = email.trim().toLowerCase();
|
|
1906
|
+
const sandbox = await session.existingSandbox();
|
|
1907
|
+
let claim;
|
|
1908
|
+
if (sandbox) {
|
|
1909
|
+
claim = {
|
|
1910
|
+
kind: "sandbox",
|
|
1911
|
+
claimToken: sandbox.registration.claimToken,
|
|
1912
|
+
email: normalized,
|
|
1913
|
+
attempt: await sandbox.claim({ email: normalized }),
|
|
1914
|
+
claimExpires: sandbox.expiresAt
|
|
1915
|
+
};
|
|
1916
|
+
} else if (session.claim?.kind === "service_auth" && session.claim.email === normalized && session.claim.claimExpires.getTime() > Date.now()) {
|
|
1917
|
+
const attempt = await import_sdk2.WebhooksCC.agent.startClaim({
|
|
1918
|
+
baseUrl,
|
|
1919
|
+
claimToken: session.claim.claimToken
|
|
1920
|
+
});
|
|
1921
|
+
claim = { ...session.claim, attempt };
|
|
1922
|
+
} else {
|
|
1923
|
+
const registration = await import_sdk2.WebhooksCC.agent.registerServiceAuth({
|
|
1924
|
+
baseUrl,
|
|
1925
|
+
email: normalized,
|
|
1926
|
+
clientName: session.clientName
|
|
1927
|
+
});
|
|
1928
|
+
claim = {
|
|
1929
|
+
kind: "service_auth",
|
|
1930
|
+
claimToken: registration.claimToken,
|
|
1931
|
+
email: normalized,
|
|
1932
|
+
attempt: registration.claim,
|
|
1933
|
+
claimExpires: registration.claimTokenExpires
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
session.claim = claim;
|
|
1937
|
+
const { verificationUri, userCode, expiresAt } = claim.attempt;
|
|
1938
|
+
return jsonContent({
|
|
1939
|
+
verificationUri,
|
|
1940
|
+
userCode,
|
|
1941
|
+
expiresAt: expiresAt.toISOString(),
|
|
1942
|
+
tellTheHuman: `Open ${verificationUri}, sign in or sign up as ${normalized}, and enter the code ${userCode}.`,
|
|
1943
|
+
next: `Show the human that line, then call wait_for_connection. The code works for about ${minutesLeft(expiresAt)} minutes; connect_account gives a new one.`,
|
|
1944
|
+
...claim.kind === "sandbox" ? { endpoints: "The sandbox endpoints move into that account with what they captured." } : {}
|
|
1945
|
+
});
|
|
1946
|
+
})
|
|
1947
|
+
)
|
|
1948
|
+
);
|
|
1949
|
+
registered.push(
|
|
1950
|
+
server.tool(
|
|
1951
|
+
"wait_for_connection",
|
|
1952
|
+
`Wait for the human to enter the code from connect_account. On success the full webhooks.cc tools for their account replace these sandbox tools. Returns after timeoutSeconds (default ${DEFAULT_WAIT_SECONDS}) if they have not finished yet; call it again to keep waiting.`,
|
|
1953
|
+
{
|
|
1954
|
+
timeoutSeconds: import_zod3.z.number().int().min(1).max(MAX_WAIT_SECONDS).optional().describe(`How long to wait, in seconds (default ${DEFAULT_WAIT_SECONDS})`)
|
|
1955
|
+
},
|
|
1956
|
+
withErrorHandling(async ({ timeoutSeconds }) => {
|
|
1957
|
+
if (session.connected) {
|
|
1958
|
+
return jsonContent({ connected: true, message: "Already connected to an account." });
|
|
1959
|
+
}
|
|
1960
|
+
const claim = session.claim;
|
|
1961
|
+
if (!claim) {
|
|
1962
|
+
throw new Error("Nothing to wait for: call connect_account first.");
|
|
1963
|
+
}
|
|
1964
|
+
let claimed;
|
|
1965
|
+
try {
|
|
1966
|
+
claimed = await import_sdk2.WebhooksCC.agent.waitForClaim({
|
|
1967
|
+
baseUrl,
|
|
1968
|
+
claimToken: claim.claimToken,
|
|
1969
|
+
interval: claim.attempt.interval,
|
|
1970
|
+
timeout: (timeoutSeconds ?? DEFAULT_WAIT_SECONDS) * 1e3
|
|
1971
|
+
});
|
|
1972
|
+
} catch (error) {
|
|
1973
|
+
if (!(error instanceof import_sdk2.AgentAuthError)) throw error;
|
|
1974
|
+
if (error.code === "timeout") {
|
|
1975
|
+
return jsonContent({
|
|
1976
|
+
connected: false,
|
|
1977
|
+
status: "waiting",
|
|
1978
|
+
message: `Not connected yet. The code works until ${claim.attempt.expiresAt.toISOString()}; call wait_for_connection again.`
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
if (error.code === "expired_token") {
|
|
1982
|
+
return jsonContent({
|
|
1983
|
+
connected: false,
|
|
1984
|
+
status: "expired",
|
|
1985
|
+
message: "The code expired. Call connect_account for a new one."
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
if (error.code === "access_denied") {
|
|
1989
|
+
return jsonContent({
|
|
1990
|
+
connected: false,
|
|
1991
|
+
status: "declined",
|
|
1992
|
+
message: "The human declined. Call connect_account again only if they ask you to."
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
throw error;
|
|
1996
|
+
}
|
|
1997
|
+
const client = new import_sdk2.WebhooksCC({
|
|
1998
|
+
baseUrl,
|
|
1999
|
+
webhookUrl: session.webhookUrl,
|
|
2000
|
+
getAccessToken: claimedTokens(baseUrl, claimed.identityAssertion, claimed.token)
|
|
2001
|
+
});
|
|
2002
|
+
session.connected = true;
|
|
2003
|
+
session.claim = null;
|
|
2004
|
+
session.forgetSandbox();
|
|
2005
|
+
for (const tool of registered) tool.remove();
|
|
2006
|
+
registerTools(server, client);
|
|
2007
|
+
options.onConnected?.(client);
|
|
2008
|
+
return jsonContent({
|
|
2009
|
+
connected: true,
|
|
2010
|
+
email: claim.email,
|
|
2011
|
+
scope: claimed.token.scope,
|
|
2012
|
+
message: `Connected to the webhooks.cc account of ${claim.email}. The full tool set has replaced the sandbox tools (the tool list changed; if your client does not pick that up, ask the user to restart it).${claim.kind === "sandbox" ? " The sandbox endpoints are now that account's endpoints, with what they captured." : ""} This connection lasts while this MCP server runs; for a lasting setup, the human can create an API key under Account and set WHK_API_KEY.`
|
|
2013
|
+
});
|
|
2014
|
+
})
|
|
2015
|
+
)
|
|
2016
|
+
);
|
|
2017
|
+
registered.push(
|
|
2018
|
+
server.tool(
|
|
2019
|
+
"about_sandbox",
|
|
2020
|
+
"Explain what this agent can do without a webhooks.cc account, the sandbox limits, and how to connect an account. No network call.",
|
|
2021
|
+
{},
|
|
2022
|
+
withErrorHandling(async () => {
|
|
2023
|
+
return jsonContent({
|
|
2024
|
+
mode: "sandbox (no WHK_API_KEY)",
|
|
2025
|
+
sandbox: {
|
|
2026
|
+
maxEndpoints: SANDBOX.maxEndpoints,
|
|
2027
|
+
requestsPerEndpoint: SANDBOX.requestsPerEndpoint,
|
|
2028
|
+
requestsInAll: SANDBOX.requests,
|
|
2029
|
+
lifetimeHours: SANDBOX.lifetimeHours,
|
|
2030
|
+
startsWith: "create_endpoint (registers the sandbox; a few seconds of proof of work)",
|
|
2031
|
+
captures: "Endpoints answer every request with 200; only this agent can read what they capture.",
|
|
2032
|
+
notAvailable: "Mock responses, response rules, notifications, signature verification, email capture, forwarding, teams and sending webhooks."
|
|
2033
|
+
},
|
|
2034
|
+
connectAnAccount: [
|
|
2035
|
+
"Call connect_account with the human's email and show them the link and code it returns.",
|
|
2036
|
+
"Call wait_for_connection until it reports connected; the full tools for their account then replace the sandbox tools.",
|
|
2037
|
+
"Sandbox endpoints move into the account with their captured requests."
|
|
2038
|
+
],
|
|
2039
|
+
withAnApiKey: "Set WHK_API_KEY to a whcc_ key from the dashboard and restart for the full tools from the start.",
|
|
2040
|
+
docs: DOCS_URL,
|
|
2041
|
+
protocol: `${baseUrl}/auth.md`
|
|
2042
|
+
});
|
|
2043
|
+
})
|
|
2044
|
+
)
|
|
1722
2045
|
);
|
|
1723
2046
|
}
|
|
2047
|
+
function registerAgentRegistrationTools(server) {
|
|
2048
|
+
registerSandboxTools(server);
|
|
2049
|
+
}
|
|
1724
2050
|
|
|
1725
2051
|
// src/index.ts
|
|
1726
|
-
var VERSION = true ? "1.
|
|
2052
|
+
var VERSION = true ? "1.12.0" : "0.0.0-dev";
|
|
1727
2053
|
function createServer(options = {}) {
|
|
1728
2054
|
const apiKey = options.apiKey ?? process.env.WHK_API_KEY;
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
2055
|
+
const webhookUrl = options.webhookUrl ?? process.env.WHK_WEBHOOK_URL;
|
|
2056
|
+
const baseUrl = options.baseUrl ?? process.env.WHK_BASE_URL;
|
|
2057
|
+
const server = new import_mcp2.McpServer(
|
|
2058
|
+
{ name: "webhooks-cc", version: VERSION },
|
|
2059
|
+
// Connecting an account swaps every tool at once: one list_changed, not dozens.
|
|
2060
|
+
{ debouncedNotificationMethods: ["notifications/tools/list_changed"] }
|
|
2061
|
+
);
|
|
1733
2062
|
if (!apiKey) {
|
|
1734
|
-
|
|
2063
|
+
registerSandboxTools(server, { baseUrl, webhookUrl });
|
|
2064
|
+
registerPrompts(server);
|
|
1735
2065
|
return server;
|
|
1736
2066
|
}
|
|
1737
|
-
const client = new
|
|
1738
|
-
apiKey,
|
|
1739
|
-
webhookUrl: options.webhookUrl ?? process.env.WHK_WEBHOOK_URL,
|
|
1740
|
-
baseUrl: options.baseUrl ?? process.env.WHK_BASE_URL
|
|
1741
|
-
});
|
|
2067
|
+
const client = new import_sdk3.WebhooksCC({ apiKey, webhookUrl, baseUrl });
|
|
1742
2068
|
registerTools(server, client);
|
|
1743
2069
|
registerPrompts(server);
|
|
1744
2070
|
registerResources(server, client);
|
|
@@ -1750,5 +2076,6 @@ function createServer(options = {}) {
|
|
|
1750
2076
|
registerAgentRegistrationTools,
|
|
1751
2077
|
registerPrompts,
|
|
1752
2078
|
registerResources,
|
|
2079
|
+
registerSandboxTools,
|
|
1753
2080
|
registerTools
|
|
1754
2081
|
});
|