@webhooks-cc/mcp 1.14.0 → 1.15.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 +42 -22
- package/dist/bin/mcp.js +255 -161
- package/dist/chunk-RHQD2GRD.mjs +1819 -0
- package/dist/index.d.mts +21 -9
- package/dist/index.d.ts +21 -9
- package/dist/index.js +219 -135
- package/dist/index.mjs +161 -1861
- package/dist/tools.d.mts +171 -0
- package/dist/tools.d.ts +171 -0
- package/dist/tools.js +1827 -0
- package/dist/tools.mjs +34 -0
- package/package.json +7 -2
package/dist/tools.d.mts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WebhooksCC, Request, PayloadSchemaFormat } from '@webhooks-cc/sdk';
|
|
3
|
+
|
|
4
|
+
declare const createEndpointShape: {
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
expiresIn: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
|
+
mockResponse: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
status: z.ZodNumber;
|
|
10
|
+
body: z.ZodDefault<z.ZodString>;
|
|
11
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
responseRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
17
|
+
logic: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
and: "and";
|
|
19
|
+
or: "or";
|
|
20
|
+
}>>>;
|
|
21
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
22
|
+
field: z.ZodEnum<{
|
|
23
|
+
body: "body";
|
|
24
|
+
method: "method";
|
|
25
|
+
path: "path";
|
|
26
|
+
header: "header";
|
|
27
|
+
query: "query";
|
|
28
|
+
body_contains: "body_contains";
|
|
29
|
+
body_path: "body_path";
|
|
30
|
+
content_type: "content_type";
|
|
31
|
+
size: "size";
|
|
32
|
+
kind: "kind";
|
|
33
|
+
email: "email";
|
|
34
|
+
email_field: "email_field";
|
|
35
|
+
spam_score: "spam_score";
|
|
36
|
+
email_auth: "email_auth";
|
|
37
|
+
signature: "signature";
|
|
38
|
+
}>;
|
|
39
|
+
op: z.ZodEnum<{
|
|
40
|
+
eq: "eq";
|
|
41
|
+
neq: "neq";
|
|
42
|
+
contains: "contains";
|
|
43
|
+
not_contains: "not_contains";
|
|
44
|
+
starts_with: "starts_with";
|
|
45
|
+
ends_with: "ends_with";
|
|
46
|
+
matches: "matches";
|
|
47
|
+
regex: "regex";
|
|
48
|
+
exists: "exists";
|
|
49
|
+
not_exists: "not_exists";
|
|
50
|
+
gt: "gt";
|
|
51
|
+
gte: "gte";
|
|
52
|
+
lt: "lt";
|
|
53
|
+
lte: "lte";
|
|
54
|
+
}>;
|
|
55
|
+
value: z.ZodOptional<z.ZodString>;
|
|
56
|
+
name: z.ZodOptional<z.ZodString>;
|
|
57
|
+
path: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
response: z.ZodLazy<z.ZodObject<{
|
|
60
|
+
status: z.ZodNumber;
|
|
61
|
+
body: z.ZodDefault<z.ZodString>;
|
|
62
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
notificationUrl: z.ZodOptional<z.ZodString>;
|
|
67
|
+
signingProvider: z.ZodOptional<z.ZodString>;
|
|
68
|
+
signingSecret: z.ZodOptional<z.ZodString>;
|
|
69
|
+
signingHeader: z.ZodOptional<z.ZodString>;
|
|
70
|
+
};
|
|
71
|
+
declare const listEndpointsShape: {
|
|
72
|
+
team: z.ZodOptional<z.ZodString>;
|
|
73
|
+
};
|
|
74
|
+
declare const getEndpointShape: {
|
|
75
|
+
slug: z.ZodString;
|
|
76
|
+
};
|
|
77
|
+
declare const deleteEndpointShape: {
|
|
78
|
+
slug: z.ZodString;
|
|
79
|
+
};
|
|
80
|
+
declare const listRequestsShape: {
|
|
81
|
+
endpointSlug: z.ZodString;
|
|
82
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
83
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
email: "email";
|
|
86
|
+
http: "http";
|
|
87
|
+
}>>;
|
|
88
|
+
};
|
|
89
|
+
declare const getRequestShape: {
|
|
90
|
+
requestId: z.ZodString;
|
|
91
|
+
};
|
|
92
|
+
declare const waitForRequestShape: {
|
|
93
|
+
endpointSlug: z.ZodString;
|
|
94
|
+
timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
95
|
+
pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
96
|
+
};
|
|
97
|
+
declare const payloadSchemaShape: {
|
|
98
|
+
endpointSlug: z.ZodString;
|
|
99
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
100
|
+
typescript: "typescript";
|
|
101
|
+
zod: "zod";
|
|
102
|
+
pydantic: "pydantic";
|
|
103
|
+
"json-schema": "json-schema";
|
|
104
|
+
}>>;
|
|
105
|
+
name: z.ZodOptional<z.ZodString>;
|
|
106
|
+
event: z.ZodOptional<z.ZodString>;
|
|
107
|
+
method: z.ZodOptional<z.ZodString>;
|
|
108
|
+
path: z.ZodOptional<z.ZodString>;
|
|
109
|
+
requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
111
|
+
};
|
|
112
|
+
type PayloadSchemaArgs = {
|
|
113
|
+
format: PayloadSchemaFormat;
|
|
114
|
+
name?: string;
|
|
115
|
+
event?: string;
|
|
116
|
+
method?: string;
|
|
117
|
+
path?: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* generate_payload_schema for the full and the sandbox tools: filter the
|
|
121
|
+
* requests, learn one schema from their bodies, and say what it was built
|
|
122
|
+
* from, warning when several events were mixed.
|
|
123
|
+
*/
|
|
124
|
+
declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
|
|
125
|
+
type TextContent = {
|
|
126
|
+
type: "text";
|
|
127
|
+
text: string;
|
|
128
|
+
};
|
|
129
|
+
type ToolResult = {
|
|
130
|
+
content: TextContent[];
|
|
131
|
+
isError?: boolean;
|
|
132
|
+
};
|
|
133
|
+
/** Create a text content response for MCP tools. */
|
|
134
|
+
declare function textContent(text: string): ToolResult;
|
|
135
|
+
declare function jsonContent(value: unknown): ToolResult;
|
|
136
|
+
/** Wrap a tool handler with error handling that returns structured MCP errors. */
|
|
137
|
+
declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
|
|
138
|
+
/** Register all webhook tools on an MCP server instance. */
|
|
139
|
+
/**
|
|
140
|
+
* What registerTools needs from a server: the stdio server's McpServer has
|
|
141
|
+
* it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
|
|
142
|
+
* serve the same tools.
|
|
143
|
+
*/
|
|
144
|
+
interface ToolServer {
|
|
145
|
+
tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>): RegisteredToolHandle;
|
|
146
|
+
}
|
|
147
|
+
/** A registered tool, removable when the tool set is swapped. */
|
|
148
|
+
interface RegisteredToolHandle {
|
|
149
|
+
remove(): void;
|
|
150
|
+
}
|
|
151
|
+
interface RegisterToolsOptions {
|
|
152
|
+
/**
|
|
153
|
+
* The hosted server (webhooks.cc/mcp): leave out the tools that send to a
|
|
154
|
+
* URL the caller names, which would run from webhooks.cc's network and
|
|
155
|
+
* could never reach the caller's machine anyway, refuse targetUrl on the
|
|
156
|
+
* others, and cap waits below the proxy's timeout.
|
|
157
|
+
*/
|
|
158
|
+
remote?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
|
|
161
|
+
declare const REMOTE_MAX_WAIT_MS = 50000;
|
|
162
|
+
/** Shortest poll interval on the hosted server: each poll is an API request. */
|
|
163
|
+
declare const REMOTE_MIN_POLL_MS = 1000;
|
|
164
|
+
/**
|
|
165
|
+
* Registers the webhooks.cc tools for an account client. Returns their
|
|
166
|
+
* handles, so a caller can swap the tool set later.
|
|
167
|
+
*/
|
|
168
|
+
declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
|
|
169
|
+
|
|
170
|
+
export { REMOTE_MAX_WAIT_MS, REMOTE_MIN_POLL_MS, createEndpointShape, deleteEndpointShape, getEndpointShape, getRequestShape, jsonContent, listEndpointsShape, listRequestsShape, payloadSchemaResult, payloadSchemaShape, registerTools, textContent, waitForRequestShape, withErrorHandling };
|
|
171
|
+
export type { RegisterToolsOptions, RegisteredToolHandle, ToolResult, ToolServer };
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WebhooksCC, Request, PayloadSchemaFormat } from '@webhooks-cc/sdk';
|
|
3
|
+
|
|
4
|
+
declare const createEndpointShape: {
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
expiresIn: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
|
+
mockResponse: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
status: z.ZodNumber;
|
|
10
|
+
body: z.ZodDefault<z.ZodString>;
|
|
11
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
responseRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
17
|
+
logic: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
and: "and";
|
|
19
|
+
or: "or";
|
|
20
|
+
}>>>;
|
|
21
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
22
|
+
field: z.ZodEnum<{
|
|
23
|
+
body: "body";
|
|
24
|
+
method: "method";
|
|
25
|
+
path: "path";
|
|
26
|
+
header: "header";
|
|
27
|
+
query: "query";
|
|
28
|
+
body_contains: "body_contains";
|
|
29
|
+
body_path: "body_path";
|
|
30
|
+
content_type: "content_type";
|
|
31
|
+
size: "size";
|
|
32
|
+
kind: "kind";
|
|
33
|
+
email: "email";
|
|
34
|
+
email_field: "email_field";
|
|
35
|
+
spam_score: "spam_score";
|
|
36
|
+
email_auth: "email_auth";
|
|
37
|
+
signature: "signature";
|
|
38
|
+
}>;
|
|
39
|
+
op: z.ZodEnum<{
|
|
40
|
+
eq: "eq";
|
|
41
|
+
neq: "neq";
|
|
42
|
+
contains: "contains";
|
|
43
|
+
not_contains: "not_contains";
|
|
44
|
+
starts_with: "starts_with";
|
|
45
|
+
ends_with: "ends_with";
|
|
46
|
+
matches: "matches";
|
|
47
|
+
regex: "regex";
|
|
48
|
+
exists: "exists";
|
|
49
|
+
not_exists: "not_exists";
|
|
50
|
+
gt: "gt";
|
|
51
|
+
gte: "gte";
|
|
52
|
+
lt: "lt";
|
|
53
|
+
lte: "lte";
|
|
54
|
+
}>;
|
|
55
|
+
value: z.ZodOptional<z.ZodString>;
|
|
56
|
+
name: z.ZodOptional<z.ZodString>;
|
|
57
|
+
path: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
response: z.ZodLazy<z.ZodObject<{
|
|
60
|
+
status: z.ZodNumber;
|
|
61
|
+
body: z.ZodDefault<z.ZodString>;
|
|
62
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
notificationUrl: z.ZodOptional<z.ZodString>;
|
|
67
|
+
signingProvider: z.ZodOptional<z.ZodString>;
|
|
68
|
+
signingSecret: z.ZodOptional<z.ZodString>;
|
|
69
|
+
signingHeader: z.ZodOptional<z.ZodString>;
|
|
70
|
+
};
|
|
71
|
+
declare const listEndpointsShape: {
|
|
72
|
+
team: z.ZodOptional<z.ZodString>;
|
|
73
|
+
};
|
|
74
|
+
declare const getEndpointShape: {
|
|
75
|
+
slug: z.ZodString;
|
|
76
|
+
};
|
|
77
|
+
declare const deleteEndpointShape: {
|
|
78
|
+
slug: z.ZodString;
|
|
79
|
+
};
|
|
80
|
+
declare const listRequestsShape: {
|
|
81
|
+
endpointSlug: z.ZodString;
|
|
82
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
83
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
email: "email";
|
|
86
|
+
http: "http";
|
|
87
|
+
}>>;
|
|
88
|
+
};
|
|
89
|
+
declare const getRequestShape: {
|
|
90
|
+
requestId: z.ZodString;
|
|
91
|
+
};
|
|
92
|
+
declare const waitForRequestShape: {
|
|
93
|
+
endpointSlug: z.ZodString;
|
|
94
|
+
timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
95
|
+
pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
96
|
+
};
|
|
97
|
+
declare const payloadSchemaShape: {
|
|
98
|
+
endpointSlug: z.ZodString;
|
|
99
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
100
|
+
typescript: "typescript";
|
|
101
|
+
zod: "zod";
|
|
102
|
+
pydantic: "pydantic";
|
|
103
|
+
"json-schema": "json-schema";
|
|
104
|
+
}>>;
|
|
105
|
+
name: z.ZodOptional<z.ZodString>;
|
|
106
|
+
event: z.ZodOptional<z.ZodString>;
|
|
107
|
+
method: z.ZodOptional<z.ZodString>;
|
|
108
|
+
path: z.ZodOptional<z.ZodString>;
|
|
109
|
+
requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
111
|
+
};
|
|
112
|
+
type PayloadSchemaArgs = {
|
|
113
|
+
format: PayloadSchemaFormat;
|
|
114
|
+
name?: string;
|
|
115
|
+
event?: string;
|
|
116
|
+
method?: string;
|
|
117
|
+
path?: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* generate_payload_schema for the full and the sandbox tools: filter the
|
|
121
|
+
* requests, learn one schema from their bodies, and say what it was built
|
|
122
|
+
* from, warning when several events were mixed.
|
|
123
|
+
*/
|
|
124
|
+
declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
|
|
125
|
+
type TextContent = {
|
|
126
|
+
type: "text";
|
|
127
|
+
text: string;
|
|
128
|
+
};
|
|
129
|
+
type ToolResult = {
|
|
130
|
+
content: TextContent[];
|
|
131
|
+
isError?: boolean;
|
|
132
|
+
};
|
|
133
|
+
/** Create a text content response for MCP tools. */
|
|
134
|
+
declare function textContent(text: string): ToolResult;
|
|
135
|
+
declare function jsonContent(value: unknown): ToolResult;
|
|
136
|
+
/** Wrap a tool handler with error handling that returns structured MCP errors. */
|
|
137
|
+
declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
|
|
138
|
+
/** Register all webhook tools on an MCP server instance. */
|
|
139
|
+
/**
|
|
140
|
+
* What registerTools needs from a server: the stdio server's McpServer has
|
|
141
|
+
* it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
|
|
142
|
+
* serve the same tools.
|
|
143
|
+
*/
|
|
144
|
+
interface ToolServer {
|
|
145
|
+
tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>): RegisteredToolHandle;
|
|
146
|
+
}
|
|
147
|
+
/** A registered tool, removable when the tool set is swapped. */
|
|
148
|
+
interface RegisteredToolHandle {
|
|
149
|
+
remove(): void;
|
|
150
|
+
}
|
|
151
|
+
interface RegisterToolsOptions {
|
|
152
|
+
/**
|
|
153
|
+
* The hosted server (webhooks.cc/mcp): leave out the tools that send to a
|
|
154
|
+
* URL the caller names, which would run from webhooks.cc's network and
|
|
155
|
+
* could never reach the caller's machine anyway, refuse targetUrl on the
|
|
156
|
+
* others, and cap waits below the proxy's timeout.
|
|
157
|
+
*/
|
|
158
|
+
remote?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
|
|
161
|
+
declare const REMOTE_MAX_WAIT_MS = 50000;
|
|
162
|
+
/** Shortest poll interval on the hosted server: each poll is an API request. */
|
|
163
|
+
declare const REMOTE_MIN_POLL_MS = 1000;
|
|
164
|
+
/**
|
|
165
|
+
* Registers the webhooks.cc tools for an account client. Returns their
|
|
166
|
+
* handles, so a caller can swap the tool set later.
|
|
167
|
+
*/
|
|
168
|
+
declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
|
|
169
|
+
|
|
170
|
+
export { REMOTE_MAX_WAIT_MS, REMOTE_MIN_POLL_MS, createEndpointShape, deleteEndpointShape, getEndpointShape, getRequestShape, jsonContent, listEndpointsShape, listRequestsShape, payloadSchemaResult, payloadSchemaShape, registerTools, textContent, waitForRequestShape, withErrorHandling };
|
|
171
|
+
export type { RegisterToolsOptions, RegisteredToolHandle, ToolResult, ToolServer };
|