@webhooks-cc/mcp 1.23.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/README.md +43 -16
- package/dist/bin/mcp.js +1355 -638
- package/dist/{chunk-TMX4P6ZZ.mjs → chunk-VANGXSK7.mjs} +522 -33
- package/dist/index.d.mts +84 -10
- package/dist/index.d.ts +84 -10
- package/dist/index.js +1322 -581
- package/dist/index.mjs +290 -34
- package/dist/tools-Bg9zP80n.d.mts +276 -0
- package/dist/tools-Bg9zP80n.d.ts +276 -0
- package/dist/tools.d.mts +3 -200
- package/dist/tools.d.ts +3 -200
- package/dist/tools.js +526 -33
- package/dist/tools.mjs +15 -1
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,72 @@
|
|
|
1
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
2
|
-
export { REMOTE_MAX_WAIT_MS, RegisterToolsOptions, RegisteredToolHandle, ToolServer, registerTools } from './tools.mjs';
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
3
2
|
import { WebhooksCC } from '@webhooks-cc/sdk';
|
|
3
|
+
import { T as ToolGroup, a as ToolServer, R as RegisteredToolHandle } from './tools-Bg9zP80n.mjs';
|
|
4
|
+
export { E as ENABLE_TOOLS, b as REMOTE_MAX_WAIT_MS, c as RegisterToolsOptions, d as TOOL_CATALOG, e as TOOL_GROUPS, f as TOOL_GROUP_NAMES, g as ToolAnnotationsHint, h as clientLoadsEverything, i as defaultToolGroups, p as parseToolGroups, r as registerTools, t as toolAnnotations } from './tools-Bg9zP80n.mjs';
|
|
4
5
|
import 'zod';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The local (stdio) server's view of its tools: which groups it loads, and
|
|
9
|
+
* the enable_tools tool that loads more. The hosted server chooses its own
|
|
10
|
+
* groups per request and has no enable_tools.
|
|
11
|
+
*/
|
|
12
|
+
/** registerTools' view of a v2 McpServer: each tool with its title and annotations. */
|
|
13
|
+
declare function asToolServer(server: McpServer): ToolServer;
|
|
14
|
+
/** Which tools a local server lists. */
|
|
15
|
+
interface ToolSelection {
|
|
16
|
+
/** The groups named by WHK_MCP_TOOLS (or the tools option); null to choose by client. */
|
|
17
|
+
groups: ReadonlySet<ToolGroup> | null;
|
|
18
|
+
/** Only the tools that change nothing (WHK_MCP_READ_ONLY). */
|
|
19
|
+
readOnly: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ToolSelectionOptions {
|
|
22
|
+
/** Tool groups, such as "all" or "core,teams" (default: WHK_MCP_TOOLS, else by client). */
|
|
23
|
+
tools?: string;
|
|
24
|
+
/** Only the tools that change nothing (default: WHK_MCP_READ_ONLY). */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The selection from the options, else the environment. Unknown group names go to stderr. */
|
|
28
|
+
declare function toolSelection(options?: ToolSelectionOptions): ToolSelection;
|
|
29
|
+
/**
|
|
30
|
+
* An account's tools on a local server, by group. show() registers the
|
|
31
|
+
* groups the server starts with (and enable_tools while any group is left),
|
|
32
|
+
* load() adds groups, and the client's name (clientIdentified) loads every
|
|
33
|
+
* group for clients that take long tool lists, unless WHK_MCP_TOOLS chose.
|
|
34
|
+
* Everything registered in one tick reaches the client as one list_changed,
|
|
35
|
+
* since the server debounces it.
|
|
36
|
+
*/
|
|
37
|
+
declare class LocalToolGroups {
|
|
38
|
+
private readonly server;
|
|
39
|
+
readonly selection: ToolSelection;
|
|
40
|
+
private client;
|
|
41
|
+
private loaded;
|
|
42
|
+
private handles;
|
|
43
|
+
private enableTools;
|
|
44
|
+
private clientKnown;
|
|
45
|
+
private clientName;
|
|
46
|
+
constructor(server: ToolServer, selection: ToolSelection);
|
|
47
|
+
/** The groups an account's tools start with. */
|
|
48
|
+
private startingGroups;
|
|
49
|
+
/** Registers the tools for an account; the handle removes them all again. */
|
|
50
|
+
show(client: WebhooksCC): RegisteredToolHandle;
|
|
51
|
+
/** Removes every account tool, enable_tools included. */
|
|
52
|
+
hide(): void;
|
|
53
|
+
/** The groups loaded now. */
|
|
54
|
+
loadedGroups(): ToolGroup[];
|
|
55
|
+
/**
|
|
56
|
+
* The client named itself (initialize, or a 2026-07-28 request's _meta).
|
|
57
|
+
* Without a WHK_MCP_TOOLS setting, a client that takes long tool lists
|
|
58
|
+
* gets every group. Only the first name counts.
|
|
59
|
+
*/
|
|
60
|
+
clientIdentified(name: string | undefined): void;
|
|
61
|
+
/** Registers the groups not loaded yet; returns the tools each one added. */
|
|
62
|
+
load(groups: readonly ToolGroup[]): Partial<Record<ToolGroup, string[]>>;
|
|
63
|
+
/** (Re)registers enable_tools with the current groups, or drops it once all are loaded. */
|
|
64
|
+
private showEnableTools;
|
|
65
|
+
}
|
|
66
|
+
/** Groups for a server, watching for the client that connects. */
|
|
67
|
+
declare function localToolGroups(server: McpServer, selection: ToolSelection): LocalToolGroups;
|
|
68
|
+
|
|
69
|
+
interface SandboxToolOptions extends ToolSelectionOptions {
|
|
7
70
|
/** API base URL (default: WHK_BASE_URL or https://webhooks.cc). */
|
|
8
71
|
baseUrl?: string;
|
|
9
72
|
/** Webhook receiver URL (default: WHK_WEBHOOK_URL or https://go.webhooks.cc). */
|
|
@@ -18,6 +81,11 @@ interface SandboxToolOptions {
|
|
|
18
81
|
credentialsFile?: string | false;
|
|
19
82
|
/** Called whenever the tools switch to a human's account, with a client for it. */
|
|
20
83
|
onConnected?: (client: WebhooksCC) => void;
|
|
84
|
+
/**
|
|
85
|
+
* The account tools' groups, when the caller already made them for this
|
|
86
|
+
* server (createServer does); otherwise made from tools and readOnly.
|
|
87
|
+
*/
|
|
88
|
+
toolGroups?: LocalToolGroups;
|
|
21
89
|
}
|
|
22
90
|
/**
|
|
23
91
|
* Registers the agent tools: the full tools when the credential file holds a
|
|
@@ -37,7 +105,7 @@ declare function registerPrompts(server: McpServer): void;
|
|
|
37
105
|
|
|
38
106
|
declare function registerResources(server: McpServer, client: WebhooksCC): void;
|
|
39
107
|
|
|
40
|
-
interface CreateServerOptions {
|
|
108
|
+
interface CreateServerOptions extends ToolSelectionOptions {
|
|
41
109
|
/** API key for webhooks.cc (default: reads WHK_API_KEY env var) */
|
|
42
110
|
apiKey?: string;
|
|
43
111
|
/** Custom webhook receiver URL (default: reads WHK_WEBHOOK_URL or https://go.webhooks.cc) */
|
|
@@ -52,18 +120,24 @@ interface CreateServerOptions {
|
|
|
52
120
|
credentialsFile?: string | false;
|
|
53
121
|
}
|
|
54
122
|
/**
|
|
55
|
-
* Create an MCP server with
|
|
123
|
+
* Create an MCP server with the webhooks.cc tools, prompts, and resources registered.
|
|
124
|
+
*
|
|
125
|
+
* Which tools it lists: the groups in `tools` (default WHK_MCP_TOOLS, such
|
|
126
|
+
* as "all" or "core,teams"); without a setting, the core tools, and every
|
|
127
|
+
* group for clients that take long tool lists (Claude Code, Codex, ChatGPT)
|
|
128
|
+
* once they connect. enable_tools loads more groups during a session.
|
|
129
|
+
* `readOnly` (default WHK_MCP_READ_ONLY) lists only the tools that change
|
|
130
|
+
* nothing.
|
|
56
131
|
*
|
|
57
132
|
* @example
|
|
58
133
|
* ```ts
|
|
59
134
|
* import { createServer } from "@webhooks-cc/mcp";
|
|
60
|
-
* import {
|
|
135
|
+
* import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
61
136
|
*
|
|
62
|
-
*
|
|
63
|
-
* await server.connect(new StdioServerTransport());
|
|
137
|
+
* serveStdio(() => createServer({ apiKey: "whcc_..." }));
|
|
64
138
|
* ```
|
|
65
139
|
*/
|
|
66
140
|
declare function createServer(options?: CreateServerOptions): McpServer;
|
|
67
141
|
|
|
68
|
-
export { createServer, registerAgentRegistrationTools, registerPrompts, registerResources, registerSandboxTools };
|
|
69
|
-
export type { CreateServerOptions, SandboxToolOptions };
|
|
142
|
+
export { LocalToolGroups, RegisteredToolHandle, ToolGroup, ToolServer, asToolServer, createServer, localToolGroups, registerAgentRegistrationTools, registerPrompts, registerResources, registerSandboxTools, toolSelection };
|
|
143
|
+
export type { CreateServerOptions, SandboxToolOptions, ToolSelection, ToolSelectionOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,72 @@
|
|
|
1
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
2
|
-
export { REMOTE_MAX_WAIT_MS, RegisterToolsOptions, RegisteredToolHandle, ToolServer, registerTools } from './tools.js';
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
3
2
|
import { WebhooksCC } from '@webhooks-cc/sdk';
|
|
3
|
+
import { T as ToolGroup, a as ToolServer, R as RegisteredToolHandle } from './tools-Bg9zP80n.js';
|
|
4
|
+
export { E as ENABLE_TOOLS, b as REMOTE_MAX_WAIT_MS, c as RegisterToolsOptions, d as TOOL_CATALOG, e as TOOL_GROUPS, f as TOOL_GROUP_NAMES, g as ToolAnnotationsHint, h as clientLoadsEverything, i as defaultToolGroups, p as parseToolGroups, r as registerTools, t as toolAnnotations } from './tools-Bg9zP80n.js';
|
|
4
5
|
import 'zod';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The local (stdio) server's view of its tools: which groups it loads, and
|
|
9
|
+
* the enable_tools tool that loads more. The hosted server chooses its own
|
|
10
|
+
* groups per request and has no enable_tools.
|
|
11
|
+
*/
|
|
12
|
+
/** registerTools' view of a v2 McpServer: each tool with its title and annotations. */
|
|
13
|
+
declare function asToolServer(server: McpServer): ToolServer;
|
|
14
|
+
/** Which tools a local server lists. */
|
|
15
|
+
interface ToolSelection {
|
|
16
|
+
/** The groups named by WHK_MCP_TOOLS (or the tools option); null to choose by client. */
|
|
17
|
+
groups: ReadonlySet<ToolGroup> | null;
|
|
18
|
+
/** Only the tools that change nothing (WHK_MCP_READ_ONLY). */
|
|
19
|
+
readOnly: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ToolSelectionOptions {
|
|
22
|
+
/** Tool groups, such as "all" or "core,teams" (default: WHK_MCP_TOOLS, else by client). */
|
|
23
|
+
tools?: string;
|
|
24
|
+
/** Only the tools that change nothing (default: WHK_MCP_READ_ONLY). */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The selection from the options, else the environment. Unknown group names go to stderr. */
|
|
28
|
+
declare function toolSelection(options?: ToolSelectionOptions): ToolSelection;
|
|
29
|
+
/**
|
|
30
|
+
* An account's tools on a local server, by group. show() registers the
|
|
31
|
+
* groups the server starts with (and enable_tools while any group is left),
|
|
32
|
+
* load() adds groups, and the client's name (clientIdentified) loads every
|
|
33
|
+
* group for clients that take long tool lists, unless WHK_MCP_TOOLS chose.
|
|
34
|
+
* Everything registered in one tick reaches the client as one list_changed,
|
|
35
|
+
* since the server debounces it.
|
|
36
|
+
*/
|
|
37
|
+
declare class LocalToolGroups {
|
|
38
|
+
private readonly server;
|
|
39
|
+
readonly selection: ToolSelection;
|
|
40
|
+
private client;
|
|
41
|
+
private loaded;
|
|
42
|
+
private handles;
|
|
43
|
+
private enableTools;
|
|
44
|
+
private clientKnown;
|
|
45
|
+
private clientName;
|
|
46
|
+
constructor(server: ToolServer, selection: ToolSelection);
|
|
47
|
+
/** The groups an account's tools start with. */
|
|
48
|
+
private startingGroups;
|
|
49
|
+
/** Registers the tools for an account; the handle removes them all again. */
|
|
50
|
+
show(client: WebhooksCC): RegisteredToolHandle;
|
|
51
|
+
/** Removes every account tool, enable_tools included. */
|
|
52
|
+
hide(): void;
|
|
53
|
+
/** The groups loaded now. */
|
|
54
|
+
loadedGroups(): ToolGroup[];
|
|
55
|
+
/**
|
|
56
|
+
* The client named itself (initialize, or a 2026-07-28 request's _meta).
|
|
57
|
+
* Without a WHK_MCP_TOOLS setting, a client that takes long tool lists
|
|
58
|
+
* gets every group. Only the first name counts.
|
|
59
|
+
*/
|
|
60
|
+
clientIdentified(name: string | undefined): void;
|
|
61
|
+
/** Registers the groups not loaded yet; returns the tools each one added. */
|
|
62
|
+
load(groups: readonly ToolGroup[]): Partial<Record<ToolGroup, string[]>>;
|
|
63
|
+
/** (Re)registers enable_tools with the current groups, or drops it once all are loaded. */
|
|
64
|
+
private showEnableTools;
|
|
65
|
+
}
|
|
66
|
+
/** Groups for a server, watching for the client that connects. */
|
|
67
|
+
declare function localToolGroups(server: McpServer, selection: ToolSelection): LocalToolGroups;
|
|
68
|
+
|
|
69
|
+
interface SandboxToolOptions extends ToolSelectionOptions {
|
|
7
70
|
/** API base URL (default: WHK_BASE_URL or https://webhooks.cc). */
|
|
8
71
|
baseUrl?: string;
|
|
9
72
|
/** Webhook receiver URL (default: WHK_WEBHOOK_URL or https://go.webhooks.cc). */
|
|
@@ -18,6 +81,11 @@ interface SandboxToolOptions {
|
|
|
18
81
|
credentialsFile?: string | false;
|
|
19
82
|
/** Called whenever the tools switch to a human's account, with a client for it. */
|
|
20
83
|
onConnected?: (client: WebhooksCC) => void;
|
|
84
|
+
/**
|
|
85
|
+
* The account tools' groups, when the caller already made them for this
|
|
86
|
+
* server (createServer does); otherwise made from tools and readOnly.
|
|
87
|
+
*/
|
|
88
|
+
toolGroups?: LocalToolGroups;
|
|
21
89
|
}
|
|
22
90
|
/**
|
|
23
91
|
* Registers the agent tools: the full tools when the credential file holds a
|
|
@@ -37,7 +105,7 @@ declare function registerPrompts(server: McpServer): void;
|
|
|
37
105
|
|
|
38
106
|
declare function registerResources(server: McpServer, client: WebhooksCC): void;
|
|
39
107
|
|
|
40
|
-
interface CreateServerOptions {
|
|
108
|
+
interface CreateServerOptions extends ToolSelectionOptions {
|
|
41
109
|
/** API key for webhooks.cc (default: reads WHK_API_KEY env var) */
|
|
42
110
|
apiKey?: string;
|
|
43
111
|
/** Custom webhook receiver URL (default: reads WHK_WEBHOOK_URL or https://go.webhooks.cc) */
|
|
@@ -52,18 +120,24 @@ interface CreateServerOptions {
|
|
|
52
120
|
credentialsFile?: string | false;
|
|
53
121
|
}
|
|
54
122
|
/**
|
|
55
|
-
* Create an MCP server with
|
|
123
|
+
* Create an MCP server with the webhooks.cc tools, prompts, and resources registered.
|
|
124
|
+
*
|
|
125
|
+
* Which tools it lists: the groups in `tools` (default WHK_MCP_TOOLS, such
|
|
126
|
+
* as "all" or "core,teams"); without a setting, the core tools, and every
|
|
127
|
+
* group for clients that take long tool lists (Claude Code, Codex, ChatGPT)
|
|
128
|
+
* once they connect. enable_tools loads more groups during a session.
|
|
129
|
+
* `readOnly` (default WHK_MCP_READ_ONLY) lists only the tools that change
|
|
130
|
+
* nothing.
|
|
56
131
|
*
|
|
57
132
|
* @example
|
|
58
133
|
* ```ts
|
|
59
134
|
* import { createServer } from "@webhooks-cc/mcp";
|
|
60
|
-
* import {
|
|
135
|
+
* import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
61
136
|
*
|
|
62
|
-
*
|
|
63
|
-
* await server.connect(new StdioServerTransport());
|
|
137
|
+
* serveStdio(() => createServer({ apiKey: "whcc_..." }));
|
|
64
138
|
* ```
|
|
65
139
|
*/
|
|
66
140
|
declare function createServer(options?: CreateServerOptions): McpServer;
|
|
67
141
|
|
|
68
|
-
export { createServer, registerAgentRegistrationTools, registerPrompts, registerResources, registerSandboxTools };
|
|
69
|
-
export type { CreateServerOptions, SandboxToolOptions };
|
|
142
|
+
export { LocalToolGroups, RegisteredToolHandle, ToolGroup, ToolServer, asToolServer, createServer, localToolGroups, registerAgentRegistrationTools, registerPrompts, registerResources, registerSandboxTools, toolSelection };
|
|
143
|
+
export type { CreateServerOptions, SandboxToolOptions, ToolSelection, ToolSelectionOptions };
|