@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.
@@ -0,0 +1,276 @@
1
+ import { z } from 'zod';
2
+ import { WebhooksCC, Request, PayloadSchemaFormat, TunnelShareList } from '@webhooks-cc/sdk';
3
+
4
+ /**
5
+ * Every tool's group and behaviour hints, in one place. registerTools()
6
+ * reads it for each tool it registers: the group decides whether a server
7
+ * loads the tool (see TOOL_GROUPS), and the hints become the tool's MCP
8
+ * annotations, so a client can tell reads from changes and changes from
9
+ * deletions without guessing from the name. A test fails when a registered
10
+ * tool has no entry here, or an entry names no tool.
11
+ */
12
+ /**
13
+ * The groups past the core. "core" is what every server loads unless told
14
+ * otherwise; the rest load on request (WHK_MCP_TOOLS, ?tools= on the hosted
15
+ * server, or enable_tools on a local one) or for clients that load tools on
16
+ * demand themselves.
17
+ */
18
+ declare const TOOL_GROUPS: {
19
+ readonly core: "Endpoints, captured requests and emails, sending test webhooks, signatures, forwarding destinations, deliveries, previews of your local app and their logs, usage and approvals";
20
+ readonly forwarding: "The rest of forwarding: preview what a destination would send, the endpoint's forwarding settings and signing secret, test deliveries";
21
+ readonly layouts: "Email layouts and named fields: try layouts and fields on a captured email, add ready-made layouts, and AI setup";
22
+ readonly extras: "Bulk endpoint changes, favourites, request counts and payload schemas";
23
+ readonly teams: "Teams: members, invites, sharing endpoints with a team, and pricing team changes";
24
+ readonly account: "The account: billing, API keys, connected agents, public share links to requests, and the display name";
25
+ readonly domains: "Custom inbound email domains: add, verify, route and remove them";
26
+ readonly sheets: "Google Sheets destinations: Google accounts, spreadsheets and their tabs";
27
+ readonly names: "Preview names: reserve, release and password-protect them";
28
+ };
29
+ type ToolGroup = keyof typeof TOOL_GROUPS;
30
+ declare const TOOL_GROUP_NAMES: ToolGroup[];
31
+ /** What a tool does, as MCP's tool annotations describe it. */
32
+ interface Behaviour {
33
+ /** Changes nothing anywhere. */
34
+ readOnly?: true;
35
+ /** Removes or gives up something that is not simply put back. */
36
+ destructive?: true;
37
+ /** Calling it again with the same arguments changes nothing more. */
38
+ idempotent?: true;
39
+ /** Reaches past webhooks.cc: a URL you name, an email inbox, Google, Anthropic. */
40
+ openWorld?: true;
41
+ }
42
+ interface CatalogEntry extends Behaviour {
43
+ group: ToolGroup;
44
+ }
45
+ declare const TOOL_CATALOG: Record<string, CatalogEntry>;
46
+ /** The tool that loads more groups on a local server; always loaded there. */
47
+ declare const ENABLE_TOOLS = "enable_tools";
48
+ /** MCP tool annotations for a catalogued tool. */
49
+ declare function toolAnnotations(name: string): {
50
+ title: string;
51
+ readOnlyHint: boolean;
52
+ destructiveHint: boolean;
53
+ idempotentHint: boolean;
54
+ openWorldHint: boolean;
55
+ };
56
+ /**
57
+ * Which groups a server loads, from a setting such as "all", "core,teams" or
58
+ * "core+teams". Unknown names are reported so the caller can say so; an
59
+ * empty setting is the default. "core" is always loaded.
60
+ */
61
+ declare function parseToolGroups(setting: string | null | undefined): {
62
+ groups: Set<ToolGroup>;
63
+ unknown: string[];
64
+ } | null;
65
+ declare function clientLoadsEverything(clientName: string | undefined): boolean;
66
+ /** The groups for a server: the setting when there is one, else by client. */
67
+ declare function defaultToolGroups(clientName: string | undefined): Set<ToolGroup>;
68
+
69
+ declare const createEndpointShape: {
70
+ name: z.ZodOptional<z.ZodString>;
71
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
72
+ expiresIn: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
73
+ mockResponse: z.ZodOptional<z.ZodObject<{
74
+ status: z.ZodNumber;
75
+ body: z.ZodDefault<z.ZodString>;
76
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
77
+ delay: z.ZodOptional<z.ZodNumber>;
78
+ }, z.core.$strip>>;
79
+ responseRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ name: z.ZodOptional<z.ZodString>;
81
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
82
+ logic: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
83
+ and: "and";
84
+ or: "or";
85
+ }>>>;
86
+ conditions: z.ZodArray<z.ZodObject<{
87
+ field: z.ZodEnum<{
88
+ body: "body";
89
+ method: "method";
90
+ path: "path";
91
+ header: "header";
92
+ query: "query";
93
+ body_contains: "body_contains";
94
+ body_path: "body_path";
95
+ content_type: "content_type";
96
+ size: "size";
97
+ kind: "kind";
98
+ email: "email";
99
+ email_field: "email_field";
100
+ spam_score: "spam_score";
101
+ email_auth: "email_auth";
102
+ signature: "signature";
103
+ }>;
104
+ op: z.ZodEnum<{
105
+ eq: "eq";
106
+ neq: "neq";
107
+ contains: "contains";
108
+ not_contains: "not_contains";
109
+ starts_with: "starts_with";
110
+ ends_with: "ends_with";
111
+ matches: "matches";
112
+ regex: "regex";
113
+ exists: "exists";
114
+ not_exists: "not_exists";
115
+ gt: "gt";
116
+ gte: "gte";
117
+ lt: "lt";
118
+ lte: "lte";
119
+ }>;
120
+ value: z.ZodOptional<z.ZodString>;
121
+ name: z.ZodOptional<z.ZodString>;
122
+ path: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>>;
124
+ response: z.ZodLazy<z.ZodObject<{
125
+ status: z.ZodNumber;
126
+ body: z.ZodDefault<z.ZodString>;
127
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
128
+ delay: z.ZodOptional<z.ZodNumber>;
129
+ }, z.core.$strip>>;
130
+ }, z.core.$strip>>>;
131
+ notificationUrl: z.ZodOptional<z.ZodString>;
132
+ site: z.ZodOptional<z.ZodEnum<{
133
+ webhooks: "webhooks";
134
+ mailhooks: "mailhooks";
135
+ both: "both";
136
+ }>>;
137
+ signingProvider: z.ZodOptional<z.ZodString>;
138
+ signingSecret: z.ZodOptional<z.ZodString>;
139
+ signingHeader: z.ZodOptional<z.ZodString>;
140
+ };
141
+ declare const listEndpointsShape: {
142
+ team: z.ZodOptional<z.ZodString>;
143
+ };
144
+ declare const getEndpointShape: {
145
+ slug: z.ZodString;
146
+ };
147
+ declare const deleteEndpointShape: {
148
+ slug: z.ZodString;
149
+ };
150
+ declare const listRequestsShape: {
151
+ endpointSlug: z.ZodString;
152
+ limit: z.ZodDefault<z.ZodNumber>;
153
+ since: z.ZodOptional<z.ZodNumber>;
154
+ kind: z.ZodOptional<z.ZodEnum<{
155
+ email: "email";
156
+ http: "http";
157
+ }>>;
158
+ };
159
+ declare const getRequestShape: {
160
+ requestId: z.ZodString;
161
+ };
162
+ declare const waitForRequestShape: {
163
+ endpointSlug: z.ZodString;
164
+ timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
165
+ pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
166
+ };
167
+ declare const payloadSchemaShape: {
168
+ endpointSlug: z.ZodString;
169
+ format: z.ZodDefault<z.ZodEnum<{
170
+ typescript: "typescript";
171
+ zod: "zod";
172
+ pydantic: "pydantic";
173
+ "json-schema": "json-schema";
174
+ }>>;
175
+ name: z.ZodOptional<z.ZodString>;
176
+ event: z.ZodOptional<z.ZodString>;
177
+ method: z.ZodOptional<z.ZodString>;
178
+ path: z.ZodOptional<z.ZodString>;
179
+ requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
+ limit: z.ZodDefault<z.ZodNumber>;
181
+ };
182
+ type PayloadSchemaArgs = {
183
+ format: PayloadSchemaFormat;
184
+ name?: string;
185
+ event?: string;
186
+ method?: string;
187
+ path?: string;
188
+ };
189
+ /**
190
+ * generate_payload_schema for the full and the sandbox tools: filter the
191
+ * requests, learn one schema from their bodies, and say what it was built
192
+ * from, warning when several events were mixed.
193
+ */
194
+ declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
195
+ type TextContent = {
196
+ type: "text";
197
+ text: string;
198
+ };
199
+ type ToolResult = {
200
+ content: TextContent[];
201
+ isError?: boolean;
202
+ };
203
+ declare function textContent(text: string): ToolResult;
204
+ declare function jsonContent(value: unknown): ToolResult;
205
+ /** Wrap a tool handler with error handling that returns structured MCP errors. */
206
+ declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
207
+ /** Register all webhook tools on an MCP server instance. */
208
+ /**
209
+ * What registerTools needs from a server: the stdio server's McpServer has
210
+ * it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
211
+ * serve the same tools.
212
+ */
213
+ interface ToolServer {
214
+ tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>,
215
+ /** MCP tool annotations (catalog.ts), set by registerTools for every tool. */
216
+ annotations?: ToolAnnotationsHint): RegisteredToolHandle;
217
+ }
218
+ /** MCP tool annotations as registerTools passes them on. */
219
+ type ToolAnnotationsHint = ReturnType<typeof toolAnnotations>;
220
+ /** A registered tool, removable when the tool set is swapped. */
221
+ interface RegisteredToolHandle {
222
+ remove(): void;
223
+ }
224
+ interface RegisterToolsOptions {
225
+ /**
226
+ * The hosted server (webhooks.cc/mcp): leave out the tools that send to a
227
+ * URL the caller names, which would run from webhooks.cc's network and
228
+ * could never reach the caller's machine anyway, refuse targetUrl on the
229
+ * others, and cap waits below the proxy's timeout.
230
+ */
231
+ remote?: boolean;
232
+ /**
233
+ * The tool groups to register (catalog.ts). Default: every group, as before
234
+ * groups existed; the servers choose (WHK_MCP_TOOLS, ?tools=, the client).
235
+ */
236
+ groups?: ReadonlySet<ToolGroup>;
237
+ /** Register only the tools that change nothing (readOnlyHint). */
238
+ readOnly?: boolean;
239
+ }
240
+ /**
241
+ * Tools that only make sense next to the caller: they post to a URL of the
242
+ * caller's choosing, or (share_port) run the whk CLI on the caller's machine.
243
+ */
244
+ declare const LOCAL_ONLY_TOOLS: Set<string>;
245
+ /** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
246
+ declare const REMOTE_MAX_WAIT_MS = 50000;
247
+ /** Shortest poll interval on the hosted server: each poll is an API request. */
248
+ declare const REMOTE_MIN_POLL_MS = 1000;
249
+ /**
250
+ * What an agent can do about the account's sharing limits, from a share
251
+ * list: the next step when slots or data run out, so it never has to send
252
+ * the person to the dashboard. `remote` for the hosted server, which has no
253
+ * share_port.
254
+ */
255
+ declare function shareHints(list: TunnelShareList, remote?: boolean): string[];
256
+ /**
257
+ * A server hint in this server's words: the whk commands it names become
258
+ * the tools that do the same, so an agent does not reach for a CLI. On the
259
+ * hosted server (`remote`) `whk share` stays a command for the person's
260
+ * computer, since that server has no share_port.
261
+ */
262
+ declare function toolWords(hint: string, remote?: boolean): string;
263
+ /**
264
+ * A share list with hints for an agent, for list_shares and share_port: the
265
+ * server's own (in tool words) and this server's, without repeats, so
266
+ * nothing the server says (a suspension, a pause) is lost.
267
+ */
268
+ declare function withShareHints(list: TunnelShareList, remote?: boolean): Record<string, unknown>;
269
+ /**
270
+ * Registers the webhooks.cc tools for an account client. Returns their
271
+ * handles, so a caller can swap the tool set later.
272
+ */
273
+ declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
274
+
275
+ export { waitForRequestShape as A, withErrorHandling as B, withShareHints as C, ENABLE_TOOLS as E, LOCAL_ONLY_TOOLS as L, REMOTE_MAX_WAIT_MS as b, TOOL_CATALOG as d, TOOL_GROUPS as e, TOOL_GROUP_NAMES as f, clientLoadsEverything as h, defaultToolGroups as i, REMOTE_MIN_POLL_MS as j, createEndpointShape as l, deleteEndpointShape as m, getEndpointShape as n, getRequestShape as o, parseToolGroups as p, jsonContent as q, registerTools as r, listEndpointsShape as s, toolAnnotations as t, listRequestsShape as u, payloadSchemaResult as v, payloadSchemaShape as w, shareHints as x, textContent as y, toolWords as z };
276
+ export type { RegisteredToolHandle as R, ToolGroup as T, ToolServer as a, RegisterToolsOptions as c, ToolAnnotationsHint as g, ToolResult as k };
@@ -0,0 +1,276 @@
1
+ import { z } from 'zod';
2
+ import { WebhooksCC, Request, PayloadSchemaFormat, TunnelShareList } from '@webhooks-cc/sdk';
3
+
4
+ /**
5
+ * Every tool's group and behaviour hints, in one place. registerTools()
6
+ * reads it for each tool it registers: the group decides whether a server
7
+ * loads the tool (see TOOL_GROUPS), and the hints become the tool's MCP
8
+ * annotations, so a client can tell reads from changes and changes from
9
+ * deletions without guessing from the name. A test fails when a registered
10
+ * tool has no entry here, or an entry names no tool.
11
+ */
12
+ /**
13
+ * The groups past the core. "core" is what every server loads unless told
14
+ * otherwise; the rest load on request (WHK_MCP_TOOLS, ?tools= on the hosted
15
+ * server, or enable_tools on a local one) or for clients that load tools on
16
+ * demand themselves.
17
+ */
18
+ declare const TOOL_GROUPS: {
19
+ readonly core: "Endpoints, captured requests and emails, sending test webhooks, signatures, forwarding destinations, deliveries, previews of your local app and their logs, usage and approvals";
20
+ readonly forwarding: "The rest of forwarding: preview what a destination would send, the endpoint's forwarding settings and signing secret, test deliveries";
21
+ readonly layouts: "Email layouts and named fields: try layouts and fields on a captured email, add ready-made layouts, and AI setup";
22
+ readonly extras: "Bulk endpoint changes, favourites, request counts and payload schemas";
23
+ readonly teams: "Teams: members, invites, sharing endpoints with a team, and pricing team changes";
24
+ readonly account: "The account: billing, API keys, connected agents, public share links to requests, and the display name";
25
+ readonly domains: "Custom inbound email domains: add, verify, route and remove them";
26
+ readonly sheets: "Google Sheets destinations: Google accounts, spreadsheets and their tabs";
27
+ readonly names: "Preview names: reserve, release and password-protect them";
28
+ };
29
+ type ToolGroup = keyof typeof TOOL_GROUPS;
30
+ declare const TOOL_GROUP_NAMES: ToolGroup[];
31
+ /** What a tool does, as MCP's tool annotations describe it. */
32
+ interface Behaviour {
33
+ /** Changes nothing anywhere. */
34
+ readOnly?: true;
35
+ /** Removes or gives up something that is not simply put back. */
36
+ destructive?: true;
37
+ /** Calling it again with the same arguments changes nothing more. */
38
+ idempotent?: true;
39
+ /** Reaches past webhooks.cc: a URL you name, an email inbox, Google, Anthropic. */
40
+ openWorld?: true;
41
+ }
42
+ interface CatalogEntry extends Behaviour {
43
+ group: ToolGroup;
44
+ }
45
+ declare const TOOL_CATALOG: Record<string, CatalogEntry>;
46
+ /** The tool that loads more groups on a local server; always loaded there. */
47
+ declare const ENABLE_TOOLS = "enable_tools";
48
+ /** MCP tool annotations for a catalogued tool. */
49
+ declare function toolAnnotations(name: string): {
50
+ title: string;
51
+ readOnlyHint: boolean;
52
+ destructiveHint: boolean;
53
+ idempotentHint: boolean;
54
+ openWorldHint: boolean;
55
+ };
56
+ /**
57
+ * Which groups a server loads, from a setting such as "all", "core,teams" or
58
+ * "core+teams". Unknown names are reported so the caller can say so; an
59
+ * empty setting is the default. "core" is always loaded.
60
+ */
61
+ declare function parseToolGroups(setting: string | null | undefined): {
62
+ groups: Set<ToolGroup>;
63
+ unknown: string[];
64
+ } | null;
65
+ declare function clientLoadsEverything(clientName: string | undefined): boolean;
66
+ /** The groups for a server: the setting when there is one, else by client. */
67
+ declare function defaultToolGroups(clientName: string | undefined): Set<ToolGroup>;
68
+
69
+ declare const createEndpointShape: {
70
+ name: z.ZodOptional<z.ZodString>;
71
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
72
+ expiresIn: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
73
+ mockResponse: z.ZodOptional<z.ZodObject<{
74
+ status: z.ZodNumber;
75
+ body: z.ZodDefault<z.ZodString>;
76
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
77
+ delay: z.ZodOptional<z.ZodNumber>;
78
+ }, z.core.$strip>>;
79
+ responseRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ name: z.ZodOptional<z.ZodString>;
81
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
82
+ logic: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
83
+ and: "and";
84
+ or: "or";
85
+ }>>>;
86
+ conditions: z.ZodArray<z.ZodObject<{
87
+ field: z.ZodEnum<{
88
+ body: "body";
89
+ method: "method";
90
+ path: "path";
91
+ header: "header";
92
+ query: "query";
93
+ body_contains: "body_contains";
94
+ body_path: "body_path";
95
+ content_type: "content_type";
96
+ size: "size";
97
+ kind: "kind";
98
+ email: "email";
99
+ email_field: "email_field";
100
+ spam_score: "spam_score";
101
+ email_auth: "email_auth";
102
+ signature: "signature";
103
+ }>;
104
+ op: z.ZodEnum<{
105
+ eq: "eq";
106
+ neq: "neq";
107
+ contains: "contains";
108
+ not_contains: "not_contains";
109
+ starts_with: "starts_with";
110
+ ends_with: "ends_with";
111
+ matches: "matches";
112
+ regex: "regex";
113
+ exists: "exists";
114
+ not_exists: "not_exists";
115
+ gt: "gt";
116
+ gte: "gte";
117
+ lt: "lt";
118
+ lte: "lte";
119
+ }>;
120
+ value: z.ZodOptional<z.ZodString>;
121
+ name: z.ZodOptional<z.ZodString>;
122
+ path: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>>;
124
+ response: z.ZodLazy<z.ZodObject<{
125
+ status: z.ZodNumber;
126
+ body: z.ZodDefault<z.ZodString>;
127
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
128
+ delay: z.ZodOptional<z.ZodNumber>;
129
+ }, z.core.$strip>>;
130
+ }, z.core.$strip>>>;
131
+ notificationUrl: z.ZodOptional<z.ZodString>;
132
+ site: z.ZodOptional<z.ZodEnum<{
133
+ webhooks: "webhooks";
134
+ mailhooks: "mailhooks";
135
+ both: "both";
136
+ }>>;
137
+ signingProvider: z.ZodOptional<z.ZodString>;
138
+ signingSecret: z.ZodOptional<z.ZodString>;
139
+ signingHeader: z.ZodOptional<z.ZodString>;
140
+ };
141
+ declare const listEndpointsShape: {
142
+ team: z.ZodOptional<z.ZodString>;
143
+ };
144
+ declare const getEndpointShape: {
145
+ slug: z.ZodString;
146
+ };
147
+ declare const deleteEndpointShape: {
148
+ slug: z.ZodString;
149
+ };
150
+ declare const listRequestsShape: {
151
+ endpointSlug: z.ZodString;
152
+ limit: z.ZodDefault<z.ZodNumber>;
153
+ since: z.ZodOptional<z.ZodNumber>;
154
+ kind: z.ZodOptional<z.ZodEnum<{
155
+ email: "email";
156
+ http: "http";
157
+ }>>;
158
+ };
159
+ declare const getRequestShape: {
160
+ requestId: z.ZodString;
161
+ };
162
+ declare const waitForRequestShape: {
163
+ endpointSlug: z.ZodString;
164
+ timeout: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
165
+ pollInterval: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
166
+ };
167
+ declare const payloadSchemaShape: {
168
+ endpointSlug: z.ZodString;
169
+ format: z.ZodDefault<z.ZodEnum<{
170
+ typescript: "typescript";
171
+ zod: "zod";
172
+ pydantic: "pydantic";
173
+ "json-schema": "json-schema";
174
+ }>>;
175
+ name: z.ZodOptional<z.ZodString>;
176
+ event: z.ZodOptional<z.ZodString>;
177
+ method: z.ZodOptional<z.ZodString>;
178
+ path: z.ZodOptional<z.ZodString>;
179
+ requestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
+ limit: z.ZodDefault<z.ZodNumber>;
181
+ };
182
+ type PayloadSchemaArgs = {
183
+ format: PayloadSchemaFormat;
184
+ name?: string;
185
+ event?: string;
186
+ method?: string;
187
+ path?: string;
188
+ };
189
+ /**
190
+ * generate_payload_schema for the full and the sandbox tools: filter the
191
+ * requests, learn one schema from their bodies, and say what it was built
192
+ * from, warning when several events were mixed.
193
+ */
194
+ declare function payloadSchemaResult(requests: Request[], args: PayloadSchemaArgs): ToolResult;
195
+ type TextContent = {
196
+ type: "text";
197
+ text: string;
198
+ };
199
+ type ToolResult = {
200
+ content: TextContent[];
201
+ isError?: boolean;
202
+ };
203
+ declare function textContent(text: string): ToolResult;
204
+ declare function jsonContent(value: unknown): ToolResult;
205
+ /** Wrap a tool handler with error handling that returns structured MCP errors. */
206
+ declare function withErrorHandling<T>(handler: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
207
+ /** Register all webhook tools on an MCP server instance. */
208
+ /**
209
+ * What registerTools needs from a server: the stdio server's McpServer has
210
+ * it, and the hosted server at webhooks.cc/mcp adapts its own to it, so both
211
+ * serve the same tools.
212
+ */
213
+ interface ToolServer {
214
+ tool<Shape extends z.ZodRawShape>(name: string, description: string, shape: Shape, handler: (args: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>,
215
+ /** MCP tool annotations (catalog.ts), set by registerTools for every tool. */
216
+ annotations?: ToolAnnotationsHint): RegisteredToolHandle;
217
+ }
218
+ /** MCP tool annotations as registerTools passes them on. */
219
+ type ToolAnnotationsHint = ReturnType<typeof toolAnnotations>;
220
+ /** A registered tool, removable when the tool set is swapped. */
221
+ interface RegisteredToolHandle {
222
+ remove(): void;
223
+ }
224
+ interface RegisterToolsOptions {
225
+ /**
226
+ * The hosted server (webhooks.cc/mcp): leave out the tools that send to a
227
+ * URL the caller names, which would run from webhooks.cc's network and
228
+ * could never reach the caller's machine anyway, refuse targetUrl on the
229
+ * others, and cap waits below the proxy's timeout.
230
+ */
231
+ remote?: boolean;
232
+ /**
233
+ * The tool groups to register (catalog.ts). Default: every group, as before
234
+ * groups existed; the servers choose (WHK_MCP_TOOLS, ?tools=, the client).
235
+ */
236
+ groups?: ReadonlySet<ToolGroup>;
237
+ /** Register only the tools that change nothing (readOnlyHint). */
238
+ readOnly?: boolean;
239
+ }
240
+ /**
241
+ * Tools that only make sense next to the caller: they post to a URL of the
242
+ * caller's choosing, or (share_port) run the whk CLI on the caller's machine.
243
+ */
244
+ declare const LOCAL_ONLY_TOOLS: Set<string>;
245
+ /** Longest wait on the hosted server; Cloudflare ends a request after 100 seconds. */
246
+ declare const REMOTE_MAX_WAIT_MS = 50000;
247
+ /** Shortest poll interval on the hosted server: each poll is an API request. */
248
+ declare const REMOTE_MIN_POLL_MS = 1000;
249
+ /**
250
+ * What an agent can do about the account's sharing limits, from a share
251
+ * list: the next step when slots or data run out, so it never has to send
252
+ * the person to the dashboard. `remote` for the hosted server, which has no
253
+ * share_port.
254
+ */
255
+ declare function shareHints(list: TunnelShareList, remote?: boolean): string[];
256
+ /**
257
+ * A server hint in this server's words: the whk commands it names become
258
+ * the tools that do the same, so an agent does not reach for a CLI. On the
259
+ * hosted server (`remote`) `whk share` stays a command for the person's
260
+ * computer, since that server has no share_port.
261
+ */
262
+ declare function toolWords(hint: string, remote?: boolean): string;
263
+ /**
264
+ * A share list with hints for an agent, for list_shares and share_port: the
265
+ * server's own (in tool words) and this server's, without repeats, so
266
+ * nothing the server says (a suspension, a pause) is lost.
267
+ */
268
+ declare function withShareHints(list: TunnelShareList, remote?: boolean): Record<string, unknown>;
269
+ /**
270
+ * Registers the webhooks.cc tools for an account client. Returns their
271
+ * handles, so a caller can swap the tool set later.
272
+ */
273
+ declare function registerTools(target: ToolServer, client: WebhooksCC, options?: RegisterToolsOptions): RegisteredToolHandle[];
274
+
275
+ export { waitForRequestShape as A, withErrorHandling as B, withShareHints as C, ENABLE_TOOLS as E, LOCAL_ONLY_TOOLS as L, REMOTE_MAX_WAIT_MS as b, TOOL_CATALOG as d, TOOL_GROUPS as e, TOOL_GROUP_NAMES as f, clientLoadsEverything as h, defaultToolGroups as i, REMOTE_MIN_POLL_MS as j, createEndpointShape as l, deleteEndpointShape as m, getEndpointShape as n, getRequestShape as o, parseToolGroups as p, jsonContent as q, registerTools as r, listEndpointsShape as s, toolAnnotations as t, listRequestsShape as u, payloadSchemaResult as v, payloadSchemaShape as w, shareHints as x, textContent as y, toolWords as z };
276
+ export type { RegisteredToolHandle as R, ToolGroup as T, ToolServer as a, RegisterToolsOptions as c, ToolAnnotationsHint as g, ToolResult as k };