@webhooks-cc/mcp 1.13.0 → 1.14.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 +15 -9
- package/dist/bin/mcp.js +252 -42
- package/dist/index.js +252 -42
- package/dist/index.mjs +256 -44
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -407,7 +407,6 @@ import {
|
|
|
407
407
|
MAX_CONDITION_NAME_LEN,
|
|
408
408
|
MAX_CONDITION_PATH_LEN,
|
|
409
409
|
MAX_RULE_NAME_LEN,
|
|
410
|
-
MAX_GLOB_PATTERN_LEN,
|
|
411
410
|
NotFoundError,
|
|
412
411
|
RateLimitError,
|
|
413
412
|
TEMPLATE_METADATA,
|
|
@@ -421,7 +420,10 @@ import {
|
|
|
421
420
|
extractLink,
|
|
422
421
|
detectWebhookInfo,
|
|
423
422
|
generateRequestSchema,
|
|
424
|
-
PAYLOAD_SCHEMA_FORMATS
|
|
423
|
+
PAYLOAD_SCHEMA_FORMATS,
|
|
424
|
+
CONDITION_FIELDS,
|
|
425
|
+
CONDITION_OPS,
|
|
426
|
+
conditionIssues
|
|
425
427
|
} from "@webhooks-cc/sdk";
|
|
426
428
|
var MAX_BODY_SIZE = MAX_OUTPUT;
|
|
427
429
|
var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
|
|
@@ -441,28 +443,75 @@ var methodSchema = z2.enum(HTTP_METHODS).default("POST").describe("HTTP method (
|
|
|
441
443
|
var kindSchema = z2.enum(["http", "email"]).optional().describe('Only HTTP requests ("http") or only captured emails ("email")');
|
|
442
444
|
var EMAIL_SCAN_LIMIT = 100;
|
|
443
445
|
var durationOrTimestampSchema = z2.union([z2.string(), z2.number()]);
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
446
|
+
var CONDITION_FIELD_NAMES = Object.keys(CONDITION_FIELDS);
|
|
447
|
+
var CONDITION_OP_NAMES = CONDITION_OPS;
|
|
448
|
+
function conditionSchema(use) {
|
|
449
|
+
const fields = use === "response" ? CONDITION_FIELD_NAMES.filter((field) => CONDITION_FIELDS[field].response) : CONDITION_FIELD_NAMES;
|
|
450
|
+
return z2.object({
|
|
451
|
+
field: z2.enum(fields).describe(
|
|
452
|
+
use === "response" ? "What to read: method, path, header (name), query (name), body (text), body_path (path into a JSON or form body), content_type, size" : "What to read: method, path, header (name), query (name), body, body_path (path), content_type, size, kind (http or email), email (name: subject, from, to, text or tag), spam_score, email_auth (name: spf, dkim or dmarc), signature (verified, failed or missing)"
|
|
453
|
+
),
|
|
454
|
+
op: z2.enum(CONDITION_OP_NAMES).describe(
|
|
455
|
+
"eq, neq, contains, not_contains, starts_with, ends_with, matches (glob: * one path segment, ** any, ? one character), regex (RE2, searched anywhere; (?i) ignores case), exists, not_exists, gt, gte, lt, lte (numbers)"
|
|
456
|
+
),
|
|
457
|
+
value: z2.string().max(MAX_CONDITION_VALUE_LEN).optional().describe(`What to compare with (not for exists and not_exists)`),
|
|
458
|
+
name: z2.string().max(MAX_CONDITION_NAME_LEN).optional().describe("Header or query parameter name; the email part; spf, dkim or dmarc"),
|
|
459
|
+
path: z2.string().max(MAX_CONDITION_PATH_LEN).optional().describe('Dot path for body_path, e.g. data.object.status or items.0.sku or a["odd.key"]')
|
|
460
|
+
}).superRefine((condition, ctx) => {
|
|
461
|
+
for (const issue of conditionIssues(condition, { use })) {
|
|
462
|
+
ctx.addIssue({ code: "custom", message: issue });
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
var ruleConditionSchema = conditionSchema("response");
|
|
467
|
+
var destinationFields = {
|
|
468
|
+
name: z2.string().max(100).nullable().optional().describe("A name for the list and the log"),
|
|
469
|
+
enabled: z2.boolean().optional().describe("Send to it (default true)"),
|
|
470
|
+
http: z2.boolean().optional().describe("Takes HTTP requests (default true)"),
|
|
471
|
+
email: z2.boolean().optional().describe("Takes emails (default true)"),
|
|
472
|
+
filter: z2.object({
|
|
473
|
+
logic: z2.enum(["and", "or"]).optional().describe("and (default): every condition; or: any"),
|
|
474
|
+
conditions: z2.array(conditionSchema("filter")).max(10)
|
|
475
|
+
}).nullable().optional().describe(
|
|
476
|
+
"Send only captures that match (null: everything it takes). Conditions like response rules plus kind, email (name: subject, from, to, text, tag), spam_score, email_auth (name: spf, dkim, dmarc) and signature (verified, failed, missing)"
|
|
449
477
|
),
|
|
450
|
-
|
|
451
|
-
|
|
478
|
+
format: z2.enum([
|
|
479
|
+
"auto",
|
|
480
|
+
"as_received",
|
|
481
|
+
"json",
|
|
482
|
+
"template",
|
|
483
|
+
"chat",
|
|
484
|
+
"postmark",
|
|
485
|
+
"sendgrid",
|
|
486
|
+
"mailgun",
|
|
487
|
+
"cloudmailin"
|
|
488
|
+
]).optional().describe(
|
|
489
|
+
"auto (pick from the URL), as_received (relay HTTP requests unchanged; emails as signed JSON), json (signed JSON envelope), template (your bodyTemplate, signed like json), chat (Slack or Discord message), or an inbound mail provider's shape for emails (postmark, sendgrid, mailgun, cloudmailin; HTTP requests then go as received), to test the inbound handler you wrote for that provider"
|
|
452
490
|
),
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
)
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
|
|
461
|
-
)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
491
|
+
mailgunSigningKey: z2.string().max(200).nullable().optional().describe(
|
|
492
|
+
"For format mailgun: your Mailgun HTTP webhook signing key, so the form's signature verifies; null removes it. Write-only."
|
|
493
|
+
),
|
|
494
|
+
bodyTemplate: z2.unknown().optional().describe(
|
|
495
|
+
`For format template: any JSON value whose strings hold {{ placeholders }}, e.g. {"event": "{{ json.type }}", "amount": "{{ json.data.amount }}", "code": "{{ codes.0 }}"}. A string that is only a placeholder keeps the value's type; a missing field becomes null. HTTP requests read method, path, query.x, headers.x, body, json.path, id, receivedAt, signature; emails read the email.received fields (subject, from.address, to, text, codes, links, auth, spam, tag)`
|
|
496
|
+
),
|
|
497
|
+
messageTemplate: z2.string().max(4e3).nullable().optional().describe(
|
|
498
|
+
"For format chat: the message text with {{ placeholders }}; null sends the standard message"
|
|
499
|
+
),
|
|
500
|
+
headers: z2.array(
|
|
501
|
+
z2.object({
|
|
502
|
+
name: z2.string().describe("Header name, e.g. Authorization"),
|
|
503
|
+
value: z2.string().nullable().describe("Value, or null to keep the stored one")
|
|
504
|
+
})
|
|
505
|
+
).max(10).optional().describe("Your own headers for every delivery (not chat). Replaces the whole list"),
|
|
506
|
+
appendPath: z2.boolean().optional().describe("Append the captured path to the URL (as_received)"),
|
|
507
|
+
retrySeconds: z2.union([z2.literal(0), z2.literal(3600), z2.literal(86400)]).optional().describe("Retry failed deliveries for 86400 (default), 3600 or 0 seconds"),
|
|
508
|
+
keepOrder: z2.boolean().optional().describe("One delivery at a time, in capture order"),
|
|
509
|
+
sentField: z2.string().max(128).nullable().optional().describe("JSON body field with the sender's own timestamp"),
|
|
510
|
+
throttleSeconds: z2.number().int().min(0).max(3600).optional().describe(
|
|
511
|
+
"At most one delivery every N seconds; the rest are not sent (1 makes a heads-up channel)"
|
|
512
|
+
),
|
|
513
|
+
delaySeconds: z2.number().int().min(0).max(3600).optional().describe("Wait this long after the capture before sending, like a callback")
|
|
514
|
+
};
|
|
466
515
|
var responseRuleSchema = z2.object({
|
|
467
516
|
name: z2.string().max(MAX_RULE_NAME_LEN).optional().describe(`Human-readable rule name (max ${MAX_RULE_NAME_LEN} chars)`),
|
|
468
517
|
enabled: z2.boolean().optional().default(true).describe("Whether this rule is active"),
|
|
@@ -473,8 +522,10 @@ var responseRuleSchema = z2.object({
|
|
|
473
522
|
var responseRulesSchema = z2.array(responseRuleSchema).max(50).describe("Ordered conditional response rules (first match wins, max 50)");
|
|
474
523
|
var mockResponseSchema = z2.object({
|
|
475
524
|
status: z2.number().int().min(MOCK_RESPONSE_STATUS_MIN).max(MOCK_RESPONSE_STATUS_MAX).describe(`HTTP status code (${MOCK_RESPONSE_STATUS_MIN}-${MOCK_RESPONSE_STATUS_MAX})`),
|
|
476
|
-
body: z2.string().default("").describe(
|
|
477
|
-
|
|
525
|
+
body: z2.string().default("").describe(
|
|
526
|
+
'Response body (default: empty). {{ placeholders }} are filled in from the request: {{ json.id }} (a JSON or form body field), {{ body }}, {{ headers.user-agent }}, {{ query.page }}, {{ method }}, {{ path }}, {{ id }}, {{ uuid }}, {{ now }}; filters: | default: "x", | json, | lower, | upper, | truncate: 80'
|
|
527
|
+
),
|
|
528
|
+
headers: z2.record(z2.string(), z2.string()).default({}).describe("Response headers (default: none); values may use {{ placeholders }} too"),
|
|
478
529
|
delay: z2.number().int().min(MOCK_RESPONSE_DELAY_MIN).max(MOCK_RESPONSE_DELAY_MAX).optional().describe(
|
|
479
530
|
`Response delay in milliseconds (${MOCK_RESPONSE_DELAY_MIN}-${MOCK_RESPONSE_DELAY_MAX}, default: none)`
|
|
480
531
|
)
|
|
@@ -829,6 +880,8 @@ var ESSENTIAL_DETAIL_FIELDS = [
|
|
|
829
880
|
"tag",
|
|
830
881
|
"subject",
|
|
831
882
|
"from",
|
|
883
|
+
"fields",
|
|
884
|
+
"replyText",
|
|
832
885
|
"size",
|
|
833
886
|
"test",
|
|
834
887
|
"spam",
|
|
@@ -838,6 +891,11 @@ var ESSENTIAL_DETAIL_FIELDS = [
|
|
|
838
891
|
"html",
|
|
839
892
|
"htmlTruncated"
|
|
840
893
|
];
|
|
894
|
+
function shrinkRendered(rendered, max) {
|
|
895
|
+
const body = typeof rendered.body === "string" ? rendered.body : "";
|
|
896
|
+
if (body.length <= max - 1024) return rendered;
|
|
897
|
+
return { ...rendered, body: body.slice(0, max - 1024), bodyTruncated: true };
|
|
898
|
+
}
|
|
841
899
|
function emailDetail(client, email, view, includeHtml) {
|
|
842
900
|
const { data } = client.emails.toJson(email, {
|
|
843
901
|
endpoint: view.endpoint,
|
|
@@ -1000,7 +1058,7 @@ function registerTools(server, client) {
|
|
|
1000
1058
|
);
|
|
1001
1059
|
server.tool(
|
|
1002
1060
|
"update_endpoint",
|
|
1003
|
-
"Update an endpoint name, mock response, conditional response rules, signing configuration,
|
|
1061
|
+
"Update an endpoint name, mock response, conditional response rules, signing configuration, whether codes and links are picked out of its emails, or the named fields picked out of them.",
|
|
1004
1062
|
{
|
|
1005
1063
|
slug: z2.string().describe("The endpoint slug to update"),
|
|
1006
1064
|
name: z2.string().optional().describe("New display name"),
|
|
@@ -1014,7 +1072,17 @@ function registerTools(server, client) {
|
|
|
1014
1072
|
signingHeader: z2.string().nullable().optional().describe(
|
|
1015
1073
|
"Custom signature header name (only for generic-hmac provider), or null to clear"
|
|
1016
1074
|
),
|
|
1017
|
-
showEmailExtracts: z2.boolean().optional().describe("Pick codes and links out of emails (dashboard and forwarded JSON). Owner only.")
|
|
1075
|
+
showEmailExtracts: z2.boolean().optional().describe("Pick codes and links out of emails (dashboard and forwarded JSON). Owner only."),
|
|
1076
|
+
emailFields: z2.array(
|
|
1077
|
+
z2.object({
|
|
1078
|
+
name: z2.string().describe("Letters, digits and _, starting with a letter: {{ fields.name }}"),
|
|
1079
|
+
from: z2.enum(["subject", "text", "html", "from", "to", "header"]).describe("What it reads; html is the HTML as text"),
|
|
1080
|
+
header: z2.string().optional().describe('The header name, for from "header"'),
|
|
1081
|
+
pattern: z2.string().describe("RE2 regular expression; the first group is the value (no lookarounds)")
|
|
1082
|
+
})
|
|
1083
|
+
).max(20).nullable().optional().describe(
|
|
1084
|
+
"Named fields picked out of every email: shown with it, `fields` in its JSON, read by forwarding templates and filters (email_field). Replaces the list; null or [] removes them. Owner only."
|
|
1085
|
+
)
|
|
1018
1086
|
},
|
|
1019
1087
|
withErrorHandling(
|
|
1020
1088
|
async ({
|
|
@@ -1026,7 +1094,8 @@ function registerTools(server, client) {
|
|
|
1026
1094
|
signingProvider,
|
|
1027
1095
|
signingSecret,
|
|
1028
1096
|
signingHeader,
|
|
1029
|
-
showEmailExtracts
|
|
1097
|
+
showEmailExtracts,
|
|
1098
|
+
emailFields
|
|
1030
1099
|
}) => {
|
|
1031
1100
|
const endpoint = await client.endpoints.update(slug, {
|
|
1032
1101
|
name,
|
|
@@ -1036,12 +1105,33 @@ function registerTools(server, client) {
|
|
|
1036
1105
|
signingProvider,
|
|
1037
1106
|
signingSecret,
|
|
1038
1107
|
signingHeader,
|
|
1039
|
-
showEmailExtracts
|
|
1108
|
+
showEmailExtracts,
|
|
1109
|
+
emailFields
|
|
1040
1110
|
});
|
|
1041
1111
|
return jsonContent(endpoint);
|
|
1042
1112
|
}
|
|
1043
1113
|
)
|
|
1044
1114
|
);
|
|
1115
|
+
server.tool(
|
|
1116
|
+
"preview_response",
|
|
1117
|
+
"Dry run of an endpoint's responses: which response rule answers a captured request, and the response with its {{ placeholders }} filled in, exactly as the receiver would send it. Nothing is sent. Pass mockResponse or responseRules to try settings before saving them with update_endpoint.",
|
|
1118
|
+
{
|
|
1119
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1120
|
+
requestId: z2.string().optional().describe(
|
|
1121
|
+
"A captured request on the endpoint (default: the newest HTTP request, or a sample)"
|
|
1122
|
+
),
|
|
1123
|
+
mockResponse: mockResponseSchema.nullable().optional().describe("Try this default response instead of the saved one (null: none)"),
|
|
1124
|
+
responseRules: responseRulesSchema.nullable().optional().describe("Try these rules instead of the saved ones (null: none)")
|
|
1125
|
+
},
|
|
1126
|
+
withErrorHandling(async ({ slug, requestId, mockResponse, responseRules }) => {
|
|
1127
|
+
const preview = await client.endpoints.previewResponse(slug, {
|
|
1128
|
+
...requestId ? { requestId } : {},
|
|
1129
|
+
...mockResponse !== void 0 ? { mockResponse } : {},
|
|
1130
|
+
...responseRules !== void 0 ? { responseRules } : {}
|
|
1131
|
+
});
|
|
1132
|
+
return jsonContent(preview);
|
|
1133
|
+
})
|
|
1134
|
+
);
|
|
1045
1135
|
server.tool(
|
|
1046
1136
|
"delete_endpoint",
|
|
1047
1137
|
"Delete a webhook endpoint and all its captured requests.",
|
|
@@ -1257,6 +1347,39 @@ function registerTools(server, client) {
|
|
|
1257
1347
|
});
|
|
1258
1348
|
})
|
|
1259
1349
|
);
|
|
1350
|
+
server.tool(
|
|
1351
|
+
"render_email",
|
|
1352
|
+
"A captured email in the shape an inbound mail provider posts it (postmark, sendgrid, mailgun, cloudmailin), to test the inbound handler you wrote for that provider against real mail. Returns the method, headers and body; with targetUrl (your local handler), posts it there and returns the answer. A Mailgun form is signed when you pass the signing key your handler checks.",
|
|
1353
|
+
{
|
|
1354
|
+
requestId: z2.string().describe("The captured email's request ID"),
|
|
1355
|
+
format: z2.enum(["postmark", "sendgrid", "mailgun", "cloudmailin", "json"]).describe("Whose shape; json is webhooks.cc's own email.received JSON (unsigned)"),
|
|
1356
|
+
mailgunSigningKey: z2.string().optional().describe("For mailgun: the signing key your handler verifies with (a test key)"),
|
|
1357
|
+
targetUrl: httpUrlSchema.optional().describe("Post it here, e.g. http://localhost:3000/api/inbound/postmark")
|
|
1358
|
+
},
|
|
1359
|
+
withErrorHandling(async ({ requestId, format, mailgunSigningKey, targetUrl }) => {
|
|
1360
|
+
const rendered = await client.emails.render(requestId, {
|
|
1361
|
+
format,
|
|
1362
|
+
...mailgunSigningKey ? { mailgunSigningKey } : {}
|
|
1363
|
+
});
|
|
1364
|
+
if (!targetUrl) {
|
|
1365
|
+
return jsonContent(
|
|
1366
|
+
shrinkRendered(rendered, MAX_BODY_SIZE)
|
|
1367
|
+
);
|
|
1368
|
+
}
|
|
1369
|
+
const response = await fetch(targetUrl, {
|
|
1370
|
+
method: "POST",
|
|
1371
|
+
headers: { "content-type": rendered.headers["content-type"] },
|
|
1372
|
+
body: rendered.body,
|
|
1373
|
+
redirect: "manual"
|
|
1374
|
+
});
|
|
1375
|
+
return jsonContent({
|
|
1376
|
+
format,
|
|
1377
|
+
status: response.status,
|
|
1378
|
+
statusText: response.statusText,
|
|
1379
|
+
body: await readBodyTruncated(response)
|
|
1380
|
+
});
|
|
1381
|
+
})
|
|
1382
|
+
);
|
|
1260
1383
|
server.tool(
|
|
1261
1384
|
"compare_requests",
|
|
1262
1385
|
"Compare two captured requests and show the structured differences.",
|
|
@@ -1640,9 +1763,79 @@ function registerTools(server, client) {
|
|
|
1640
1763
|
return jsonContent({ ...result, address: client.emails.address(slug, tag) });
|
|
1641
1764
|
})
|
|
1642
1765
|
);
|
|
1766
|
+
server.tool(
|
|
1767
|
+
"list_destinations",
|
|
1768
|
+
"List where an endpoint's captures go: its destinations (up to 10) with their URL, kinds, filter, format, templates and timing, and with summary: true their last 24 hours. Owner only.",
|
|
1769
|
+
{
|
|
1770
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1771
|
+
summary: z2.boolean().default(true).describe("Add each destination's last 24 hours")
|
|
1772
|
+
},
|
|
1773
|
+
withErrorHandling(async ({ slug, summary }) => {
|
|
1774
|
+
return jsonContent(await client.destinations.list(slug, { summary }));
|
|
1775
|
+
})
|
|
1776
|
+
);
|
|
1777
|
+
server.tool(
|
|
1778
|
+
"add_destination",
|
|
1779
|
+
"Add a destination for an endpoint's captures: your server (as received or signed JSON), a Slack or Discord channel (chat, optionally your own messageTemplate, throttleSeconds 1 for a heads-up), or a JSON body you shape with bodyTemplate (for Zapier, n8n or your API). filter sends only matching captures; delaySeconds makes it a callback. Each destination gets its own signing secret. Check it with preview_destination before relying on it. Owner only.",
|
|
1780
|
+
{
|
|
1781
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1782
|
+
url: httpUrlSchema.describe("https URL on a public host name, or a Slack or Discord webhook"),
|
|
1783
|
+
...destinationFields
|
|
1784
|
+
},
|
|
1785
|
+
withErrorHandling(async ({ slug, ...input }) => {
|
|
1786
|
+
return jsonContent(await client.destinations.create(slug, input));
|
|
1787
|
+
})
|
|
1788
|
+
);
|
|
1789
|
+
server.tool(
|
|
1790
|
+
"update_destination",
|
|
1791
|
+
"Change a destination: any of its fields; only the ones you pass change. Owner only.",
|
|
1792
|
+
{
|
|
1793
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1794
|
+
destinationId: z2.string().describe("The destination's id (from list_destinations)"),
|
|
1795
|
+
url: httpUrlSchema.optional().describe("A new URL"),
|
|
1796
|
+
...destinationFields
|
|
1797
|
+
},
|
|
1798
|
+
withErrorHandling(async ({ slug, destinationId, ...input }) => {
|
|
1799
|
+
return jsonContent(await client.destinations.update(slug, destinationId, input));
|
|
1800
|
+
})
|
|
1801
|
+
);
|
|
1802
|
+
server.tool(
|
|
1803
|
+
"remove_destination",
|
|
1804
|
+
"Remove a destination. Deliveries still waiting for it are marked failed; its log stays. Owner only.",
|
|
1805
|
+
{
|
|
1806
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1807
|
+
destinationId: z2.string().describe("The destination's id")
|
|
1808
|
+
},
|
|
1809
|
+
withErrorHandling(async ({ slug, destinationId }) => {
|
|
1810
|
+
await client.destinations.delete(slug, destinationId);
|
|
1811
|
+
return textContent(`Destination ${destinationId} removed.`);
|
|
1812
|
+
})
|
|
1813
|
+
);
|
|
1814
|
+
server.tool(
|
|
1815
|
+
"preview_destination",
|
|
1816
|
+
"Dry run of a destination against a captured request: whether its filter lets the request through and the exact request it would send (method, URL, headers, body with placeholders filled in). Nothing is sent. Use destinationId for a saved destination, destination for unsaved fields (on top of the saved ones, or with a url on their own), or both.",
|
|
1817
|
+
{
|
|
1818
|
+
slug: z2.string().describe("The endpoint slug"),
|
|
1819
|
+
destinationId: z2.string().optional().describe("A saved destination"),
|
|
1820
|
+
destination: z2.object({ url: httpUrlSchema.optional(), ...destinationFields }).optional().describe("Unsaved fields to try"),
|
|
1821
|
+
requestId: z2.string().optional().describe("A captured request (default: the newest of the kind it takes, or a sample)")
|
|
1822
|
+
},
|
|
1823
|
+
withErrorHandling(async ({ slug, destinationId, destination, requestId }) => {
|
|
1824
|
+
if (!destinationId && !destination?.url) {
|
|
1825
|
+
throw new Error("Pass destinationId, or a destination with a url");
|
|
1826
|
+
}
|
|
1827
|
+
return jsonContent(
|
|
1828
|
+
await client.destinations.preview(slug, {
|
|
1829
|
+
...destinationId ? { destinationId } : {},
|
|
1830
|
+
...destination ? { destination } : {},
|
|
1831
|
+
...requestId ? { requestId } : {}
|
|
1832
|
+
})
|
|
1833
|
+
);
|
|
1834
|
+
})
|
|
1835
|
+
);
|
|
1643
1836
|
server.tool(
|
|
1644
1837
|
"configure_forwarding",
|
|
1645
|
-
"Change an endpoint's forwarding: the URL, on or off, which kinds
|
|
1838
|
+
"Change an endpoint's primary forwarding destination (the one the endpoint's forward* fields stand for): the URL, on or off, which kinds, the format, your own headers, and the advanced options. Only the arguments you pass change. Owner only. For several destinations, filters, templates, throttling or delays, use add_destination and update_destination.",
|
|
1646
1839
|
{
|
|
1647
1840
|
slug: z2.string().describe("The endpoint slug"),
|
|
1648
1841
|
url: httpUrlSchema.nullable().optional().describe("https URL on a public host name, or null to remove it (forwarding must be off)"),
|
|
@@ -1690,23 +1883,32 @@ function registerTools(server, client) {
|
|
|
1690
1883
|
"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.",
|
|
1691
1884
|
{
|
|
1692
1885
|
slug: z2.string().describe("The endpoint slug"),
|
|
1886
|
+
destinationId: z2.string().optional().describe("A destination (default: the endpoint's primary destination)"),
|
|
1693
1887
|
rotate: z2.boolean().default(false).describe("Replace the secret; every delivery from now on uses the new one")
|
|
1694
1888
|
},
|
|
1695
|
-
withErrorHandling(async ({ slug, rotate }) => {
|
|
1696
|
-
const secret = rotate ? await client.forwarding.rotateSecret(slug) : await client.forwarding.secret(slug);
|
|
1889
|
+
withErrorHandling(async ({ slug, destinationId, rotate }) => {
|
|
1890
|
+
const secret = destinationId ? rotate ? await client.destinations.rotateSecret(slug, destinationId) : await client.destinations.secret(slug, destinationId) : rotate ? await client.forwarding.rotateSecret(slug) : await client.forwarding.secret(slug);
|
|
1697
1891
|
return jsonContent({ secret, rotated: rotate });
|
|
1698
1892
|
})
|
|
1699
1893
|
);
|
|
1700
1894
|
server.tool(
|
|
1701
1895
|
"test_forwarding",
|
|
1702
|
-
"Send the endpoint's newest captured request of a kind (or a sample) to
|
|
1896
|
+
"Send the endpoint's newest captured request of a kind (or a sample, or requestId) to a destination once, exactly as a delivery would go out, and report the answer. Works whether it is on or off, and whatever its filter says; nothing is retried or logged.",
|
|
1703
1897
|
{
|
|
1704
1898
|
slug: z2.string().describe("The endpoint slug"),
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
)
|
|
1899
|
+
destinationId: z2.string().optional().describe("A destination (default: the endpoint's primary destination)"),
|
|
1900
|
+
kind: z2.enum(["http", "email"]).optional().describe("Which kind to send (default: http when the destination takes HTTP requests)"),
|
|
1901
|
+
requestId: z2.string().optional().describe("With destinationId: a captured request to send")
|
|
1708
1902
|
},
|
|
1709
|
-
withErrorHandling(async ({ slug, kind }) => {
|
|
1903
|
+
withErrorHandling(async ({ slug, destinationId, kind, requestId }) => {
|
|
1904
|
+
if (destinationId) {
|
|
1905
|
+
return jsonContent(
|
|
1906
|
+
await client.destinations.test(slug, destinationId, {
|
|
1907
|
+
...kind ? { kind } : {},
|
|
1908
|
+
...requestId ? { requestId } : {}
|
|
1909
|
+
})
|
|
1910
|
+
);
|
|
1911
|
+
}
|
|
1710
1912
|
return jsonContent(await client.forwarding.test(slug, kind ? { kind } : {}));
|
|
1711
1913
|
})
|
|
1712
1914
|
);
|
|
@@ -1717,17 +1919,25 @@ function registerTools(server, client) {
|
|
|
1717
1919
|
endpointSlug: z2.string().optional().describe("List the endpoint's delivery log"),
|
|
1718
1920
|
requestId: z2.string().optional().describe("List every delivery and try of this request"),
|
|
1719
1921
|
limit: z2.number().int().min(1).max(100).default(20).describe("With endpointSlug: max rows"),
|
|
1720
|
-
status: z2.enum(["all", "pending", "failed"]).default("all").describe(
|
|
1922
|
+
status: z2.enum(["all", "pending", "failed", "skipped"]).default("all").describe(
|
|
1923
|
+
"With endpointSlug: all, pending (queued or retrying), failed or skipped (filtered out)"
|
|
1924
|
+
),
|
|
1925
|
+
destinationId: z2.string().optional().describe("With endpointSlug: only this destination"),
|
|
1721
1926
|
before: z2.string().optional().describe("With endpointSlug: a row's cursor, to list older rows")
|
|
1722
1927
|
},
|
|
1723
|
-
withErrorHandling(async ({ endpointSlug, requestId, limit, status, before }) => {
|
|
1928
|
+
withErrorHandling(async ({ endpointSlug, requestId, limit, status, destinationId, before }) => {
|
|
1724
1929
|
if (requestId === void 0 === (endpointSlug === void 0)) {
|
|
1725
1930
|
throw new Error("Pass exactly one of endpointSlug or requestId");
|
|
1726
1931
|
}
|
|
1727
1932
|
if (requestId) return jsonContent(await client.forwarding.requestDeliveries(requestId));
|
|
1728
1933
|
const [summary, deliveries] = await Promise.all([
|
|
1729
1934
|
client.forwarding.summary(endpointSlug),
|
|
1730
|
-
client.forwarding.deliveries(endpointSlug, {
|
|
1935
|
+
client.forwarding.deliveries(endpointSlug, {
|
|
1936
|
+
limit,
|
|
1937
|
+
status,
|
|
1938
|
+
before,
|
|
1939
|
+
...destinationId ? { destinationId } : {}
|
|
1940
|
+
})
|
|
1731
1941
|
]);
|
|
1732
1942
|
return jsonContent({
|
|
1733
1943
|
summary,
|
|
@@ -1738,17 +1948,19 @@ function registerTools(server, client) {
|
|
|
1738
1948
|
);
|
|
1739
1949
|
server.tool(
|
|
1740
1950
|
"redeliver",
|
|
1741
|
-
"Forward again with the
|
|
1951
|
+
"Forward again with the current settings: one captured request or email (requestId; to every destination that takes it, or with destinationId to that one whatever its filter says), or every request whose latest delivery failed (endpointSlug, optionally only destinationId, oldest first, up to 1,000 at a time per destination). Owner only.",
|
|
1742
1952
|
{
|
|
1743
1953
|
requestId: z2.string().optional().describe("The request or email to send again"),
|
|
1744
|
-
endpointSlug: z2.string().optional().describe("Send every failed delivery of this endpoint again")
|
|
1954
|
+
endpointSlug: z2.string().optional().describe("Send every failed delivery of this endpoint again"),
|
|
1955
|
+
destinationId: z2.string().optional().describe("Only this destination")
|
|
1745
1956
|
},
|
|
1746
|
-
withErrorHandling(async ({ requestId, endpointSlug }) => {
|
|
1957
|
+
withErrorHandling(async ({ requestId, endpointSlug, destinationId }) => {
|
|
1747
1958
|
if (requestId === void 0 === (endpointSlug === void 0)) {
|
|
1748
1959
|
throw new Error("Pass exactly one of requestId or endpointSlug");
|
|
1749
1960
|
}
|
|
1961
|
+
const options = destinationId ? { destinationId } : {};
|
|
1750
1962
|
return jsonContent(
|
|
1751
|
-
requestId ? await client.forwarding.redeliver(requestId) : await client.forwarding.redeliverFailed(endpointSlug)
|
|
1963
|
+
requestId ? await client.forwarding.redeliver(requestId, options) : await client.forwarding.redeliverFailed(endpointSlug, options)
|
|
1752
1964
|
);
|
|
1753
1965
|
})
|
|
1754
1966
|
);
|
|
@@ -2143,7 +2355,7 @@ function registerAgentRegistrationTools(server) {
|
|
|
2143
2355
|
}
|
|
2144
2356
|
|
|
2145
2357
|
// src/index.ts
|
|
2146
|
-
var VERSION = true ? "1.
|
|
2358
|
+
var VERSION = true ? "1.14.0" : "0.0.0-dev";
|
|
2147
2359
|
function createServer(options = {}) {
|
|
2148
2360
|
const apiKey = options.apiKey ?? process.env.WHK_API_KEY;
|
|
2149
2361
|
const webhookUrl = options.webhookUrl ?? process.env.WHK_WEBHOOK_URL;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webhooks-cc/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"mcpName": "io.github.kroqdotdev/webhooks-cc",
|
|
5
5
|
"description": "MCP server for webhooks.cc — AI agent integration for webhook testing",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://webhooks.cc",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@modelcontextprotocol/sdk": "^1.32.
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
41
41
|
"zod": "^4.6.7",
|
|
42
|
-
"@webhooks-cc/sdk": "1.
|
|
42
|
+
"@webhooks-cc/sdk": "1.18.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^26.6.5",
|