@webhooks-cc/mcp 1.24.0 → 2.0.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/dist/tools.d.mts CHANGED
@@ -1,200 +1,3 @@
1
- import { z } from 'zod';
2
- import { WebhooksCC, Request, PayloadSchemaFormat, TunnelShareList } 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
- site: z.ZodOptional<z.ZodEnum<{
68
- webhooks: "webhooks";
69
- mailhooks: "mailhooks";
70
- both: "both";
71
- }>>;
72
- signingProvider: z.ZodOptional<z.ZodString>;
73
- signingSecret: z.ZodOptional<z.ZodString>;
74
- signingHeader: z.ZodOptional<z.ZodString>;
75
- };
76
- declare const listEndpointsShape: {
77
- team: z.ZodOptional<z.ZodString>;
78
- };
79
- declare const getEndpointShape: {
80
- slug: z.ZodString;
81
- };
82
- declare const deleteEndpointShape: {
83
- slug: z.ZodString;
84
- };
85
- declare const listRequestsShape: {
86
- endpointSlug: z.ZodString;
87
- limit: z.ZodDefault<z.ZodNumber>;
88
- since: z.ZodOptional<z.ZodNumber>;
89
- kind: z.ZodOptional<z.ZodEnum<{
90
- email: "email";
91
- http: "http";
92
- }>>;
93
- };
94
- declare const getRequestShape: {
95
- requestId: z.ZodString;
96
- };
97
- declare const waitForRequestShape: {
98
- endpointSlug: z.ZodString;
99
- timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
100
- pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
101
- };
102
- declare const payloadSchemaShape: {
103
- endpointSlug: z.ZodString;
104
- format: z.ZodDefault<z.ZodEnum<{
105
- typescript: "typescript";
106
- zod: "zod";
107
- pydantic: "pydantic";
108
- "json-schema": "json-schema";
109
- }>>;
110
- name: z.ZodOptional<z.ZodString>;
111
- event: z.ZodOptional<z.ZodString>;
112
- method: z.ZodOptional<z.ZodString>;
113
- path: z.ZodOptional<z.ZodString>;
114
- requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
- limit: z.ZodDefault<z.ZodNumber>;
116
- };
117
- type PayloadSchemaArgs = {
118
- format: PayloadSchemaFormat;
119
- name?: string;
120
- event?: string;
121
- method?: string;
122
- path?: string;
123
- };
124
- /**
125
- * generate_payload_schema for the full and the sandbox tools: filter the
126
- * requests, learn one schema from their bodies, and say what it was built
127
- * from, warning when several events were mixed.
128
- */
129
- declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
130
- type TextContent = {
131
- type: "text";
132
- text: string;
133
- };
134
- type ToolResult = {
135
- content: TextContent[];
136
- isError?: boolean;
137
- };
138
- declare function textContent(text: string): ToolResult;
139
- declare function jsonContent(value: unknown): ToolResult;
140
- /** Wrap a tool handler with error handling that returns structured MCP errors. */
141
- declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
142
- /** Register all webhook tools on an MCP server instance. */
143
- /**
144
- * What registerTools needs from a server: the stdio server's McpServer has
145
- * it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
146
- * serve the same tools.
147
- */
148
- interface ToolServer {
149
- tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>): RegisteredToolHandle;
150
- }
151
- /** A registered tool, removable when the tool set is swapped. */
152
- interface RegisteredToolHandle {
153
- remove(): void;
154
- }
155
- interface RegisterToolsOptions {
156
- /**
157
- * The hosted server (webhooks.cc/mcp): leave out the tools that send to a
158
- * URL the caller names, which would run from webhooks.cc's network and
159
- * could never reach the caller's machine anyway, refuse targetUrl on the
160
- * others, and cap waits below the proxy's timeout.
161
- */
162
- remote?: boolean;
163
- }
164
- /**
165
- * Tools that only make sense next to the caller: they post to a URL of the
166
- * caller's choosing, or (share_port) run the whk CLI on the caller's machine.
167
- */
168
- declare const LOCAL_ONLY_TOOLS: Set<string>;
169
- /** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
170
- declare const REMOTE_MAX_WAIT_MS = 50000;
171
- /** Shortest poll interval on the hosted server: each poll is an API request. */
172
- declare const REMOTE_MIN_POLL_MS = 1000;
173
- /**
174
- * What an agent can do about the account's sharing limits, from a share
175
- * list: the next step when slots or data run out, so it never has to send
176
- * the person to the dashboard. `remote` for the hosted server, which has no
177
- * share_port.
178
- */
179
- declare function shareHints(list: TunnelShareList, remote?: boolean): string[];
180
- /**
181
- * A server hint in this server's words: the whk commands it names become
182
- * the tools that do the same, so an agent does not reach for a CLI. On the
183
- * hosted server (`remote`) `whk share` stays a command for the person's
184
- * computer, since that server has no share_port.
185
- */
186
- declare function toolWords(hint: string, remote?: boolean): string;
187
- /**
188
- * A share list with hints for an agent, for list_shares and share_port: the
189
- * server's own (in tool words) and this server's, without repeats, so
190
- * nothing the server says (a suspension, a pause) is lost.
191
- */
192
- declare function withShareHints(list: TunnelShareList, remote?: boolean): Record<string, unknown>;
193
- /**
194
- * Registers the webhooks.cc tools for an account client. Returns their
195
- * handles, so a caller can swap the tool set later.
196
- */
197
- declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
198
-
199
- export { LOCAL_ONLY_TOOLS, REMOTE_MAX_WAIT_MS, REMOTE_MIN_POLL_MS, createEndpointShape, deleteEndpointShape, getEndpointShape, getRequestShape, jsonContent, listEndpointsShape, listRequestsShape, payloadSchemaResult, payloadSchemaShape, registerTools, shareHints, textContent, toolWords, waitForRequestShape, withErrorHandling, withShareHints };
200
- export type { RegisterToolsOptions, RegisteredToolHandle, ToolResult, ToolServer };
1
+ import 'zod';
2
+ import '@webhooks-cc/sdk';
3
+ export { L as LOCAL_ONLY_TOOLS, b as REMOTE_MAX_WAIT_MS, j as REMOTE_MIN_POLL_MS, c as RegisterToolsOptions, R as RegisteredToolHandle, d as TOOL_CATALOG, e as TOOL_GROUPS, f as TOOL_GROUP_NAMES, g as ToolAnnotationsHint, T as ToolGroup, k as ToolResult, a as ToolServer, h as clientLoadsEverything, l as createEndpointShape, i as defaultToolGroups, m as deleteEndpointShape, n as getEndpointShape, o as getRequestShape, q as jsonContent, s as listEndpointsShape, u as listRequestsShape, p as parseToolGroups, v as payloadSchemaResult, w as payloadSchemaShape, r as registerTools, x as shareHints, y as textContent, t as toolAnnotations, z as toolWords, A as waitForRequestShape, B as withErrorHandling, C as withShareHints } from './tools-Bg9zP80n.mjs';
package/dist/tools.d.ts CHANGED
@@ -1,200 +1,3 @@
1
- import { z } from 'zod';
2
- import { WebhooksCC, Request, PayloadSchemaFormat, TunnelShareList } 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
- site: z.ZodOptional<z.ZodEnum<{
68
- webhooks: "webhooks";
69
- mailhooks: "mailhooks";
70
- both: "both";
71
- }>>;
72
- signingProvider: z.ZodOptional<z.ZodString>;
73
- signingSecret: z.ZodOptional<z.ZodString>;
74
- signingHeader: z.ZodOptional<z.ZodString>;
75
- };
76
- declare const listEndpointsShape: {
77
- team: z.ZodOptional<z.ZodString>;
78
- };
79
- declare const getEndpointShape: {
80
- slug: z.ZodString;
81
- };
82
- declare const deleteEndpointShape: {
83
- slug: z.ZodString;
84
- };
85
- declare const listRequestsShape: {
86
- endpointSlug: z.ZodString;
87
- limit: z.ZodDefault<z.ZodNumber>;
88
- since: z.ZodOptional<z.ZodNumber>;
89
- kind: z.ZodOptional<z.ZodEnum<{
90
- email: "email";
91
- http: "http";
92
- }>>;
93
- };
94
- declare const getRequestShape: {
95
- requestId: z.ZodString;
96
- };
97
- declare const waitForRequestShape: {
98
- endpointSlug: z.ZodString;
99
- timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
100
- pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
101
- };
102
- declare const payloadSchemaShape: {
103
- endpointSlug: z.ZodString;
104
- format: z.ZodDefault<z.ZodEnum<{
105
- typescript: "typescript";
106
- zod: "zod";
107
- pydantic: "pydantic";
108
- "json-schema": "json-schema";
109
- }>>;
110
- name: z.ZodOptional<z.ZodString>;
111
- event: z.ZodOptional<z.ZodString>;
112
- method: z.ZodOptional<z.ZodString>;
113
- path: z.ZodOptional<z.ZodString>;
114
- requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
- limit: z.ZodDefault<z.ZodNumber>;
116
- };
117
- type PayloadSchemaArgs = {
118
- format: PayloadSchemaFormat;
119
- name?: string;
120
- event?: string;
121
- method?: string;
122
- path?: string;
123
- };
124
- /**
125
- * generate_payload_schema for the full and the sandbox tools: filter the
126
- * requests, learn one schema from their bodies, and say what it was built
127
- * from, warning when several events were mixed.
128
- */
129
- declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
130
- type TextContent = {
131
- type: "text";
132
- text: string;
133
- };
134
- type ToolResult = {
135
- content: TextContent[];
136
- isError?: boolean;
137
- };
138
- declare function textContent(text: string): ToolResult;
139
- declare function jsonContent(value: unknown): ToolResult;
140
- /** Wrap a tool handler with error handling that returns structured MCP errors. */
141
- declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
142
- /** Register all webhook tools on an MCP server instance. */
143
- /**
144
- * What registerTools needs from a server: the stdio server's McpServer has
145
- * it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
146
- * serve the same tools.
147
- */
148
- interface ToolServer {
149
- tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>): RegisteredToolHandle;
150
- }
151
- /** A registered tool, removable when the tool set is swapped. */
152
- interface RegisteredToolHandle {
153
- remove(): void;
154
- }
155
- interface RegisterToolsOptions {
156
- /**
157
- * The hosted server (webhooks.cc/mcp): leave out the tools that send to a
158
- * URL the caller names, which would run from webhooks.cc's network and
159
- * could never reach the caller's machine anyway, refuse targetUrl on the
160
- * others, and cap waits below the proxy's timeout.
161
- */
162
- remote?: boolean;
163
- }
164
- /**
165
- * Tools that only make sense next to the caller: they post to a URL of the
166
- * caller's choosing, or (share_port) run the whk CLI on the caller's machine.
167
- */
168
- declare const LOCAL_ONLY_TOOLS: Set<string>;
169
- /** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
170
- declare const REMOTE_MAX_WAIT_MS = 50000;
171
- /** Shortest poll interval on the hosted server: each poll is an API request. */
172
- declare const REMOTE_MIN_POLL_MS = 1000;
173
- /**
174
- * What an agent can do about the account's sharing limits, from a share
175
- * list: the next step when slots or data run out, so it never has to send
176
- * the person to the dashboard. `remote` for the hosted server, which has no
177
- * share_port.
178
- */
179
- declare function shareHints(list: TunnelShareList, remote?: boolean): string[];
180
- /**
181
- * A server hint in this server's words: the whk commands it names become
182
- * the tools that do the same, so an agent does not reach for a CLI. On the
183
- * hosted server (`remote`) `whk share` stays a command for the person's
184
- * computer, since that server has no share_port.
185
- */
186
- declare function toolWords(hint: string, remote?: boolean): string;
187
- /**
188
- * A share list with hints for an agent, for list_shares and share_port: the
189
- * server's own (in tool words) and this server's, without repeats, so
190
- * nothing the server says (a suspension, a pause) is lost.
191
- */
192
- declare function withShareHints(list: TunnelShareList, remote?: boolean): Record<string, unknown>;
193
- /**
194
- * Registers the webhooks.cc tools for an account client. Returns their
195
- * handles, so a caller can swap the tool set later.
196
- */
197
- declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
198
-
199
- export { LOCAL_ONLY_TOOLS, REMOTE_MAX_WAIT_MS, REMOTE_MIN_POLL_MS, createEndpointShape, deleteEndpointShape, getEndpointShape, getRequestShape, jsonContent, listEndpointsShape, listRequestsShape, payloadSchemaResult, payloadSchemaShape, registerTools, shareHints, textContent, toolWords, waitForRequestShape, withErrorHandling, withShareHints };
200
- export type { RegisterToolsOptions, RegisteredToolHandle, ToolResult, ToolServer };
1
+ import 'zod';
2
+ import '@webhooks-cc/sdk';
3
+ export { L as LOCAL_ONLY_TOOLS, b as REMOTE_MAX_WAIT_MS, j as REMOTE_MIN_POLL_MS, c as RegisterToolsOptions, R as RegisteredToolHandle, d as TOOL_CATALOG, e as TOOL_GROUPS, f as TOOL_GROUP_NAMES, g as ToolAnnotationsHint, T as ToolGroup, k as ToolResult, a as ToolServer, h as clientLoadsEverything, l as createEndpointShape, i as defaultToolGroups, m as deleteEndpointShape, n as getEndpointShape, o as getRequestShape, q as jsonContent, s as listEndpointsShape, u as listRequestsShape, p as parseToolGroups, v as payloadSchemaResult, w as payloadSchemaShape, r as registerTools, x as shareHints, y as textContent, t as toolAnnotations, z as toolWords, A as waitForRequestShape, B as withErrorHandling, C as withShareHints } from './tools-Bg9zP80n.js';