@notifkit/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 devkitshq
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # @notifkit/mcp
2
+
3
+ An [MCP](https://modelcontextprotocol.io) server for notifkit. Point a terminal agent at your notifkit deployment and it can send notifications, manage templates and users, build workflows, and read the delivery log — without you writing a script for each one.
4
+
5
+ Speaks stdio, so it works with Claude Code, Claude Desktop, and any other MCP client.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install -g @notifkit/mcp
11
+ ```
12
+
13
+ Or skip the install and let your client run it with `npx -y @notifkit/mcp`.
14
+
15
+ ## Configure
16
+
17
+ Three environment variables:
18
+
19
+ | Variable | Required | Notes |
20
+ | --------------------- | ---------------------- | ------------------------------------------ |
21
+ | `NOTIFKIT_API_KEY` | yes | A project API key, or your `ADMIN_API_KEY` |
22
+ | `NOTIFKIT_URL` | no | Defaults to `http://localhost:3000` |
23
+ | `NOTIFKIT_PROJECT_ID` | only with an admin key | Which project the admin key should act on |
24
+
25
+ A project-scoped key already carries its project, so it needs no `NOTIFKIT_PROJECT_ID`. Mint one with `POST /v1/projects/:id/keys`. Prefer that over the admin key — it is scoped to a single project and can be revoked on its own.
26
+
27
+ ### Claude Code
28
+
29
+ ```sh
30
+ claude mcp add notifkit \
31
+ --env NOTIFKIT_URL=http://localhost:3000 \
32
+ --env NOTIFKIT_API_KEY=nk_your_project_key \
33
+ -- npx -y @notifkit/mcp
34
+ ```
35
+
36
+ ### Claude Desktop
37
+
38
+ In `claude_desktop_config.json`:
39
+
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "notifkit": {
44
+ "command": "npx",
45
+ "args": ["-y", "@notifkit/mcp"],
46
+ "env": {
47
+ "NOTIFKIT_URL": "http://localhost:3000",
48
+ "NOTIFKIT_API_KEY": "nk_your_project_key"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## The two-sentence workflow
56
+
57
+ The thing this exists for:
58
+
59
+ > **You:** "Send the spring-sale template to these 200 addresses." _(paste)_
60
+ > **Agent:** → `send_campaign` → "Queued 200 as `spring-sale-aug-13`."
61
+ >
62
+ > _(next day)_ **You:** "How did the spring sale do?"
63
+ > **Agent:** → `list_campaigns` → `get_campaign_stats` → "194 delivered, 4 bounced, 2 suppressed. 71 opened (37%), 12 clicked (6%)."
64
+
65
+ `send_campaign` takes raw email addresses — no user records needed up front. It creates one per address, keyed off the address itself, so re-sending to the same list updates those people rather than duplicating them. Duplicates and case differences within a list are collapsed before sending.
66
+
67
+ ## Tools
68
+
69
+ **Campaigns**
70
+
71
+ | Tool | What it does |
72
+ | -------------------- | -------------------------------------------------------------------------------------------- |
73
+ | `send_campaign` | Send a template to a list of email addresses, tagged with a label you can report on later |
74
+ | `list_campaigns` | Recent campaign labels with size and last activity — how "the one from yesterday" gets found |
75
+ | `get_campaign_stats` | Sent, delivered, failed, opened, clicked, bounced, complained, unsubscribed, with rates |
76
+
77
+ **Sending**
78
+
79
+ | Tool | What it does |
80
+ | ------------------- | --------------------------------------------------------------------------------------------------------------- |
81
+ | `send_notification` | Send to existing users, a segment, or a topic. Takes `sendAt` to schedule and `campaign` to make it reportable. |
82
+ | `list_segments` | Every segment tag in use — the valid audiences to broadcast to |
83
+ | `list_scheduled` | Sends queued for the future, including quiet-hours deferrals |
84
+ | `get_delivery_logs` | Per-message detail, when the campaign totals are not enough |
85
+
86
+ **Suppressions** — `list_suppressions`, `suppress_address`, `unsuppress_address`
87
+
88
+ **Templates** — `list_templates`, `get_template`, `upsert_template`
89
+
90
+ **Users** — `list_users`, `get_user`, `upsert_user`, `add_user_contact`
91
+
92
+ **Workflows** — `create_workflow`, `list_workflows`, `trigger_workflow`, `get_workflow_run`, `cancel_workflow_run`, `ingest_event`
93
+
94
+ **Operations** — `get_system_health`, `get_dead_letters`, `replay_dead_letter`
95
+
96
+ Project and API-key management is deliberately not exposed: minting and revoking credentials is not something an agent should do on your behalf. Use the HTTP API for that.
97
+
98
+ ## Reading the numbers
99
+
100
+ **Audience size is not delivery count.** Every send passes the same gates as any other notification — suppressions, opt-outs, quiet hours, throttling — so a list of 200 delivers to fewer than 200, by design. `send_campaign` reports what was _queued_; `get_campaign_stats` reports what actually happened.
101
+
102
+ **An untracked open rate is not a zero open rate.** Opens and clicks arrive from provider webhooks. On SMS and push there is nothing to report; on email, nothing arrives unless the webhook is configured. `get_campaign_stats` returns a `warnings` array saying which of those applies, and the tool description tells the agent to pass it on rather than reporting a flat 0%.
103
+
104
+ **Watch the complaint rate.** Above roughly 0.3%, mailbox providers start throttling or junking your mail — and that hits your transactional email too, since it is the same sending domain.
105
+
106
+ ## Sequences
107
+
108
+ Multi-step sends — onboarding, drips, reminders — are workflows rather than campaigns: `create_workflow` defines the steps, `trigger_workflow` enrols each user.
109
+
110
+ > _"Make an onboarding drip: welcome email, wait 3 days, then the tips email unless they've already sent an `activated` event."_
111
+
112
+ ## Safety
113
+
114
+ `send_campaign`, `send_notification`, `trigger_workflow`, and `replay_dead_letter` reach real people and cannot be recalled. Read-only tools are annotated as such so clients can auto-approve them and prompt on the rest; `cancel_workflow_run` and `unsuppress_address` are marked destructive.
115
+
116
+ Suppressions deserve particular care. A suppressed address is usually someone who asked not to be contacted, or an address that no longer exists. Removing a suppression to improve a delivery figure is how a sending domain gets blocked — the tool description tells the agent to confirm first, and you should treat an unprompted suggestion to do it as a red flag.
117
+
118
+ Point the server at a staging deployment while you get a feel for it.
119
+
120
+ ## Development
121
+
122
+ ```sh
123
+ npm run build # tsc
124
+ npm run typecheck
125
+ ```
126
+
127
+ The server holds no state and imports nothing from the notifkit core package — it is a thin, self-contained HTTP client, so running it costs you a Node process and nothing else.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A minimal HTTP client for the notifkit API.
3
+ *
4
+ * Deliberately self-contained rather than importing `NotifkitClient` from the
5
+ * root package: that entrypoint re-exports the db, redis, and config modules,
6
+ * which would pull Postgres and Redis drivers into a process whose only job is
7
+ * to speak JSON-RPC over stdio.
8
+ */
9
+ export interface NotifkitApiOptions {
10
+ baseUrl: string;
11
+ apiKey: string;
12
+ /** Required when `apiKey` is the admin key; project-scoped keys carry their own project. */
13
+ projectId?: string;
14
+ }
15
+ export declare class NotifkitApiError extends Error {
16
+ readonly status: number;
17
+ readonly body: unknown;
18
+ constructor(message: string, status: number, body: unknown);
19
+ }
20
+ export declare class NotifkitApi {
21
+ private readonly baseUrl;
22
+ private readonly headers;
23
+ constructor(options: NotifkitApiOptions);
24
+ request<T>(method: string, path: string, options?: {
25
+ body?: unknown;
26
+ query?: Record<string, string | number | undefined>;
27
+ }): Promise<T>;
28
+ get<T>(path: string, query?: Record<string, string | number | undefined>): Promise<T>;
29
+ post<T>(path: string, body?: unknown): Promise<T>;
30
+ put<T>(path: string, body?: unknown): Promise<T>;
31
+ }
32
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAGvC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO;gBAFtB,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO;CAKzB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,OAAO,EAAE,kBAAkB;IASjC,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE,GAChF,OAAO,CAAC,CAAC,CAAC;IA6Cb,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrF,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAGjD"}
package/dist/client.js ADDED
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A minimal HTTP client for the notifkit API.
3
+ *
4
+ * Deliberately self-contained rather than importing `NotifkitClient` from the
5
+ * root package: that entrypoint re-exports the db, redis, and config modules,
6
+ * which would pull Postgres and Redis drivers into a process whose only job is
7
+ * to speak JSON-RPC over stdio.
8
+ */
9
+ export class NotifkitApiError extends Error {
10
+ status;
11
+ body;
12
+ constructor(message, status, body) {
13
+ super(message);
14
+ this.status = status;
15
+ this.body = body;
16
+ this.name = "NotifkitApiError";
17
+ }
18
+ }
19
+ export class NotifkitApi {
20
+ baseUrl;
21
+ headers;
22
+ constructor(options) {
23
+ this.baseUrl = options.baseUrl.replace(/\/$/, "");
24
+ this.headers = {
25
+ "Content-Type": "application/json",
26
+ Authorization: `Bearer ${options.apiKey}`,
27
+ ...(options.projectId ? { "x-project-id": options.projectId } : {}),
28
+ };
29
+ }
30
+ async request(method, path, options) {
31
+ let url = `${this.baseUrl}${path}`;
32
+ if (options?.query) {
33
+ const params = new URLSearchParams();
34
+ for (const [key, value] of Object.entries(options.query)) {
35
+ if (value !== undefined)
36
+ params.set(key, String(value));
37
+ }
38
+ const qs = params.toString();
39
+ if (qs)
40
+ url += `?${qs}`;
41
+ }
42
+ const res = await fetch(url, {
43
+ method,
44
+ headers: this.headers,
45
+ body: options?.body === undefined ? undefined : JSON.stringify(options.body),
46
+ });
47
+ if (res.status === 204)
48
+ return undefined;
49
+ const text = await res.text();
50
+ let data = undefined;
51
+ if (text) {
52
+ try {
53
+ data = JSON.parse(text);
54
+ }
55
+ catch {
56
+ data = text;
57
+ }
58
+ }
59
+ if (!res.ok) {
60
+ const record = typeof data === "object" && data !== null ? data : {};
61
+ const message = typeof record["message"] === "string"
62
+ ? record["message"]
63
+ : typeof record["error"] === "string"
64
+ ? record["error"]
65
+ : `Request failed with status ${res.status}`;
66
+ throw new NotifkitApiError(message, res.status, data);
67
+ }
68
+ return data;
69
+ }
70
+ get(path, query) {
71
+ return this.request("GET", path, { query });
72
+ }
73
+ post(path, body) {
74
+ return this.request("POST", path, { body });
75
+ }
76
+ put(path, body) {
77
+ return this.request("PUT", path, { body });
78
+ }
79
+ }
80
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAG9B;IACA;IAHX,YACE,OAAe,EACN,MAAc,EACd,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,WAAW;IACL,OAAO,CAAS;IAChB,OAAO,CAAyB;IAEjD,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,OAAO,CAAC,MAAM,EAAE;YACzC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAc,EACd,IAAY,EACZ,OAAiF;QAEjF,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QAEnC,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;YACrC,KAAK,MAAM,CAAC,GAAG,E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AC;gBACnB,CAAC,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,QAAQ;oBACnC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;oBACjB,CAAC,CAAC,8BAA8B,GAAG,CAAC,MAAM,EAAE,CAAC;YACnD,MAAM,IAAI,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,IAAS,CAAC;IACnB,CAAC;IAED,GAAG,CAAI,IAAY,EAAE,KAAmD;QACtE,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAI,IAAY,EAAE,IAAc;QAClC,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,GAAG,CAAI,IAAY,EAAE,IAAc;QACjC,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * notifkit MCP server (stdio).
4
+ *
5
+ * Exposes the notifkit HTTP API as MCP tools so a terminal agent can send
6
+ * notifications, manage templates and users, and drive workflows.
7
+ *
8
+ * stdout is the JSON-RPC transport — never write to it. Diagnostics go to stderr.
9
+ */
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ export declare function createServer(options: {
12
+ baseUrl: string;
13
+ apiKey: string;
14
+ projectId?: string;
15
+ }): McpServer;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,SAAS,CAwBZ"}
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * notifkit MCP server (stdio).
4
+ *
5
+ * Exposes the notifkit HTTP API as MCP tools so a terminal agent can send
6
+ * notifications, manage templates and users, and drive workflows.
7
+ *
8
+ * stdout is the JSON-RPC transport — never write to it. Diagnostics go to stderr.
9
+ */
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ import { NotifkitApi } from "./client.js";
13
+ import { registerTools } from "./tools.js";
14
+ const DEFAULT_URL = "http://localhost:3000";
15
+ export function createServer(options) {
16
+ const server = new McpServer({ name: "notifkit", version: "0.0.1" }, {
17
+ instructions: "Tools for notifkit, a self-hosted notification service.\n\n" +
18
+ "Sending: send_campaign takes a list of email addresses directly and is the right tool when the " +
19
+ "user supplies recipients themselves. send_notification targets existing users, a segment, or a " +
20
+ "topic. Both accept a `campaign` label — set one on any send whose results might be asked about " +
21
+ "later, and tell the user the label, because without it the send cannot be reported on " +
22
+ "afterwards. Multi-step sequences (drips, onboarding, reminders) are workflows: create_workflow " +
23
+ "defines one, trigger_workflow runs it per user.\n\n" +
24
+ "Reporting: get_campaign_stats answers 'how did that send do?'. Pass on its `warnings` verbatim — " +
25
+ "an untracked open rate is not a zero open rate.\n\n" +
26
+ "Discover ids with list_campaigns, list_segments, list_templates, and list_workflows rather than " +
27
+ "guessing them.\n\n" +
28
+ "Every send reaches real people and cannot be recalled, so confirm the audience before " +
29
+ "broadcasting. Never remove a suppression to improve a delivery figure: suppressions record that " +
30
+ "somebody asked not to be contacted.",
31
+ });
32
+ registerTools(server, new NotifkitApi(options));
33
+ return server;
34
+ }
35
+ async function main() {
36
+ const baseUrl = process.env["NOTIFKIT_URL"] ?? DEFAULT_URL;
37
+ const apiKey = process.env["NOTIFKIT_API_KEY"];
38
+ const projectId = process.env["NOTIFKIT_PROJECT_ID"];
39
+ if (!apiKey) {
40
+ console.error("notifkit-mcp: NOTIFKIT_API_KEY is not set.\n" +
41
+ " Set it to a project API key, or to your ADMIN_API_KEY together with NOTIFKIT_PROJECT_ID.\n" +
42
+ ` NOTIFKIT_URL defaults to ${DEFAULT_URL}.`);
43
+ process.exit(1);
44
+ }
45
+ const server = createServer({ baseUrl, apiKey, projectId });
46
+ await server.connect(new StdioServerTransport());
47
+ console.error(`notifkit-mcp: connected, talking to ${baseUrl}`);
48
+ }
49
+ main().catch((error) => {
50
+ console.error("notifkit-mcp: fatal:", error instanceof Error ? error.message : error);
51
+ process.exit(1);
52
+ });
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,MAAM,UAAU,YAAY,CAAC,OAI5B;IACC,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EACtC;QACE,YAAY,EACV,6DAA6D;YAC7D,iGAAiG;YACjG,iGAAiG;YACjG,iGAAiG;YACjG,wFAAwF;YACxF,iGAAiG;YACjG,qDAAqD;YACrD,mGAAmG;YACnG,qDAAqD;YACrD,kGAAkG;YAClG,oBAAoB;YACpB,wFAAwF;YACxF,kGAAkG;YAClG,qCAAqC;KACxC,CACF,CAAC;IAEF,aAAa,CAAC,MAAM,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,WAAW,CAAC;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAErD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CACX,8CAA8C;YAC5C,8FAA8F;YAC9F,8BAA8B,WAAW,GAAG,CAC/C,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5D,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IAEjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { NotifkitApi } from "./client.js";
3
+ export declare function registerTools(server: McpServer, api: NotifkitApi): void;
4
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA+C/C,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAyrBvE"}
package/dist/tools.js ADDED
@@ -0,0 +1,543 @@
1
+ import { z } from "zod";
2
+ import { NotifkitApiError } from "./client.js";
3
+ const CHANNELS = ["email", "sms", "push", "webhook", "in-app"];
4
+ const CONTACT_CHANNELS = ["email", "sms", "push", "webhook"];
5
+ const PRIORITIES = ["low", "normal", "high", "critical"];
6
+ /** Render any handler return value as the text payload MCP clients expect. */
7
+ function ok(value) {
8
+ const text = value === undefined
9
+ ? "Done."
10
+ : typeof value === "string"
11
+ ? value
12
+ : JSON.stringify(value, null, 2);
13
+ return { content: [{ type: "text", text }] };
14
+ }
15
+ function fail(error) {
16
+ const text = error instanceof NotifkitApiError
17
+ ? `notifkit API error (HTTP ${error.status}): ${error.message}`
18
+ : error instanceof Error
19
+ ? error.message
20
+ : String(error);
21
+ return { content: [{ type: "text", text }], isError: true };
22
+ }
23
+ /** Wrap a handler so a failed request is reported to the model instead of killing the server. */
24
+ function handler(fn) {
25
+ return async (args) => {
26
+ try {
27
+ return ok(await fn(args));
28
+ }
29
+ catch (error) {
30
+ return fail(error);
31
+ }
32
+ };
33
+ }
34
+ export function registerTools(server, api) {
35
+ // ─── Sending ────────────────────────────────────────────────────────────────
36
+ server.registerTool("send_notification", {
37
+ title: "Send a notification",
38
+ description: "Queue a notification and return immediately with its message id. This is the primitive behind " +
39
+ "both one-off sends and broadcasts: target a single user by id, a list of user ids, a `segment` " +
40
+ "(every user tagged with it), or a `topic` (every user opted in to it). Exactly one of `user`, " +
41
+ "`segment`, or `topic` must be given. Set `sendAt` to schedule a future send, which can then be " +
42
+ "inspected with list_scheduled. Delivery is filtered by each recipient's preferences, consent, and " +
43
+ "quiet hours, so the number of messages actually delivered is usually lower than the audience size. " +
44
+ "Call list_segments first when the user names an audience you have not confirmed exists, and " +
45
+ "list_templates when you are unsure of the template id.",
46
+ inputSchema: {
47
+ template: z.string().min(1).describe("Template id to render, e.g. 'order-shipped'."),
48
+ user: z
49
+ .union([z.string().min(1), z.array(z.string().min(1)).nonempty()])
50
+ .optional()
51
+ .describe("A single user id or a list of user ids. Mutually exclusive with segment and topic."),
52
+ segment: z
53
+ .string()
54
+ .min(1)
55
+ .optional()
56
+ .describe("Send to every user tagged with this segment. Mutually exclusive with user and topic."),
57
+ topic: z
58
+ .string()
59
+ .min(1)
60
+ .optional()
61
+ .describe("Send to every user opted in to this topic. Mutually exclusive with user and segment."),
62
+ data: z
63
+ .record(z.unknown())
64
+ .optional()
65
+ .describe("Variables interpolated into the template's {{placeholders}}."),
66
+ channels: z
67
+ .array(z.enum(CHANNELS))
68
+ .nonempty()
69
+ .optional()
70
+ .describe("Channels to use. Defaults to whatever the template defines."),
71
+ fallback: z
72
+ .boolean()
73
+ .optional()
74
+ .describe("When true, channels are tried in order and only the first success counts. When false or " +
75
+ "omitted, every listed channel is delivered to."),
76
+ priority: z
77
+ .enum(PRIORITIES)
78
+ .optional()
79
+ .describe("Queue lane. 'critical' bypasses quiet hours and per-user rate limits."),
80
+ sendAt: z
81
+ .string()
82
+ .datetime()
83
+ .optional()
84
+ .describe("ISO 8601 timestamp to send at. Omit to send now."),
85
+ campaign: z
86
+ .string()
87
+ .min(1)
88
+ .max(128)
89
+ .optional()
90
+ .describe("Label grouping this send for later reporting via get_campaign_stats. Set it on any send " +
91
+ "whose results someone may ask about; without it the messages cannot be attributed."),
92
+ },
93
+ annotations: { title: "Send a notification", readOnlyHint: false, idempotentHint: false },
94
+ }, handler(async (args) => {
95
+ const targets = [args.user, args.segment, args.topic].filter((t) => t !== undefined);
96
+ if (targets.length !== 1) {
97
+ throw new Error("Provide exactly one of `user`, `segment`, or `topic`.");
98
+ }
99
+ return api.post("/v1/notify", args);
100
+ }));
101
+ server.registerTool("send_campaign", {
102
+ title: "Send a campaign to a list of addresses",
103
+ description: "Send one template to a list of email addresses given directly — the tool creates or updates a " +
104
+ "user record for each address, then sends, and tags every message with a campaign label so the " +
105
+ "results can be read back later with get_campaign_stats. Use this when the person supplies the " +
106
+ "recipients themselves (a pasted list, a spreadsheet column). Use send_notification instead when " +
107
+ "targeting existing users, a segment, or a topic. Always report the returned campaign label back " +
108
+ "to the user — it is how they ask about results later. Suppressed addresses (previous " +
109
+ "unsubscribes, complaints, hard bounces) are dropped automatically at send time, so the delivered " +
110
+ "count is normally lower than the list size.",
111
+ inputSchema: {
112
+ campaign: z
113
+ .string()
114
+ .min(1)
115
+ .max(128)
116
+ .describe("Label for this send, e.g. 'spring-sale-2026-08-13'. Must be unique per send — reusing a " +
117
+ "label merges the two into one set of statistics."),
118
+ template: z.string().min(1).describe("Template id to render."),
119
+ emails: z
120
+ .array(z.string().email())
121
+ .min(1)
122
+ .max(10000)
123
+ .describe("Recipient email addresses."),
124
+ data: z
125
+ .record(z.unknown())
126
+ .optional()
127
+ .describe("Variables interpolated into the template, shared by every recipient."),
128
+ priority: z
129
+ .enum(PRIORITIES)
130
+ .optional()
131
+ .describe("Queue lane. Leave unset for 'normal'; do not use 'critical' for marketing sends."),
132
+ sendAt: z
133
+ .string()
134
+ .datetime()
135
+ .optional()
136
+ .describe("ISO 8601 timestamp to send at. Omit to send now."),
137
+ },
138
+ annotations: { title: "Send a campaign", readOnlyHint: false, idempotentHint: false },
139
+ }, handler(async (args) => {
140
+ // The API needs a stable user id per address. Deriving it from the
141
+ // address itself means re-sending to the same list updates those people
142
+ // rather than creating a second copy of each.
143
+ const seen = new Set();
144
+ const recipients = [];
145
+ for (const raw of args.emails) {
146
+ const email = raw.trim().toLowerCase();
147
+ if (seen.has(email))
148
+ continue;
149
+ seen.add(email);
150
+ recipients.push({ id: `email:${email}`, email });
151
+ }
152
+ const result = await api.post("/v1/notify", {
153
+ user: recipients,
154
+ template: args.template,
155
+ campaign: args.campaign,
156
+ channels: ["email"],
157
+ ...(args.data ? { data: args.data } : {}),
158
+ ...(args.priority ? { priority: args.priority } : {}),
159
+ ...(args.sendAt ? { sendAt: args.sendAt } : {}),
160
+ });
161
+ const duplicates = args.emails.length - recipients.length;
162
+ return {
163
+ campaign: args.campaign,
164
+ queued: recipients.length,
165
+ ...(duplicates > 0 ? { duplicatesRemoved: duplicates } : {}),
166
+ note: "Queued, not yet delivered. Preferences, quiet hours, and suppressions are applied during " +
167
+ "delivery — call get_campaign_stats for what actually landed.",
168
+ result,
169
+ };
170
+ }));
171
+ server.registerTool("list_campaigns", {
172
+ title: "List campaigns",
173
+ description: "List recent campaign labels with their size and when they last saw activity, newest first. Call " +
174
+ "this when the user refers to a past send without naming its exact label ('the one I sent " +
175
+ "yesterday') to find the label to pass to get_campaign_stats.",
176
+ inputSchema: {
177
+ limit: z
178
+ .number()
179
+ .int()
180
+ .min(1)
181
+ .max(100)
182
+ .optional()
183
+ .describe("How many campaigns to return."),
184
+ },
185
+ annotations: { title: "List campaigns", readOnlyHint: true },
186
+ }, handler(async (args) => api.get("/v1/campaigns", args)));
187
+ server.registerTool("get_campaign_stats", {
188
+ title: "Get campaign performance",
189
+ description: "The delivery and engagement funnel for one campaign: sent, delivered, failed, opened, clicked, " +
190
+ "bounced, complained, unsubscribed, with rates and a per-channel breakdown. This is the tool for " +
191
+ "'how did that send perform?'. Every count is people, not events — opening an email twice counts " +
192
+ "once. Always surface the `warnings` field to the user: it says when opens and clicks are not " +
193
+ "tracked on a channel, which is different from them being zero. A high complaint rate (above " +
194
+ "~0.3%) is worth flagging unprompted, as it damages deliverability for all future sends.",
195
+ inputSchema: {
196
+ campaign: z.string().min(1).describe("Campaign label, as returned by list_campaigns."),
197
+ },
198
+ annotations: { title: "Get campaign performance", readOnlyHint: true },
199
+ }, handler(async (args) => api.get(`/v1/campaigns/${encodeURIComponent(args.campaign)}/stats`)));
200
+ server.registerTool("list_suppressions", {
201
+ title: "List suppressed addresses",
202
+ description: "List destinations that will not be contacted again, with the reason each was suppressed " +
203
+ "(unsubscribed, complained, bounced, or manual). Call this to explain why someone did not receive " +
204
+ "a message, or to review unsubscribes after a campaign.",
205
+ inputSchema: {
206
+ limit: z.number().int().min(1).max(500).optional().describe("How many rows to return."),
207
+ channel: z.enum(CONTACT_CHANNELS).optional().describe("Only this channel."),
208
+ reason: z
209
+ .enum(["unsubscribed", "complained", "bounced", "manual"])
210
+ .optional()
211
+ .describe("Only suppressions with this reason."),
212
+ },
213
+ annotations: { title: "List suppressed addresses", readOnlyHint: true },
214
+ }, handler(async (args) => api.get("/v1/suppressions", args)));
215
+ server.registerTool("suppress_address", {
216
+ title: "Suppress an address",
217
+ description: "Stop sending to a destination on a channel — use when someone asks to be removed by replying, " +
218
+ "over the phone, or any route the provider does not report automatically. Takes effect on the " +
219
+ "next send and outranks every other setting, including 'critical' priority.",
220
+ inputSchema: {
221
+ channel: z.enum(CONTACT_CHANNELS).describe("Channel to suppress on."),
222
+ target: z.string().min(1).describe("The address: email, phone number, or push token."),
223
+ reason: z
224
+ .enum(["unsubscribed", "complained", "bounced", "manual"])
225
+ .optional()
226
+ .describe("Why. Defaults to 'manual'."),
227
+ },
228
+ annotations: { title: "Suppress an address", readOnlyHint: false, idempotentHint: true },
229
+ }, handler(async (args) => api.post("/v1/suppressions", args)));
230
+ server.registerTool("unsuppress_address", {
231
+ title: "Remove a suppression",
232
+ description: "Re-enable sending to a previously suppressed destination. Only do this on an explicit request " +
233
+ "from the user — a suppression usually records that the person asked not to be contacted, and " +
234
+ "removing it to fix a low delivery count is how a sending domain gets blocked. Confirm before " +
235
+ "calling.",
236
+ inputSchema: {
237
+ channel: z.enum(CONTACT_CHANNELS).describe("Channel the suppression is on."),
238
+ target: z.string().min(1).describe("The suppressed address."),
239
+ },
240
+ annotations: {
241
+ title: "Remove a suppression",
242
+ readOnlyHint: false,
243
+ destructiveHint: true,
244
+ idempotentHint: true,
245
+ },
246
+ }, handler(async (args) => {
247
+ await api.request("DELETE", `/v1/suppressions/${encodeURIComponent(args.channel)}/${encodeURIComponent(args.target)}`);
248
+ return `Removed the suppression on ${args.target} for ${args.channel}.`;
249
+ }));
250
+ server.registerTool("list_segments", {
251
+ title: "List segments",
252
+ description: "List every segment tag currently in use across the project's users. Call this to discover the " +
253
+ "valid audiences for send_notification's `segment` argument before broadcasting.",
254
+ annotations: { title: "List segments", readOnlyHint: true },
255
+ }, handler(async () => api.get("/v1/segments")));
256
+ server.registerTool("list_scheduled", {
257
+ title: "List scheduled sends",
258
+ description: "List notifications queued for future delivery — those given a `sendAt`, plus any deferred by a " +
259
+ "recipient's quiet hours. Use this to confirm a scheduled send landed, or to review what is " +
260
+ "pending before scheduling more.",
261
+ annotations: { title: "List scheduled sends", readOnlyHint: true },
262
+ }, handler(async () => api.get("/v1/notifications/scheduled")));
263
+ server.registerTool("get_delivery_logs", {
264
+ title: "Get delivery logs",
265
+ description: "Query the durable delivery log: what was sent, on which channel, and whether it succeeded. Call " +
266
+ "this to answer 'did it go out?' after a send, or to investigate failures. Filter by template, " +
267
+ "channel, status, or workflow instance. Results are paginated — pass the returned `nextCursor` " +
268
+ "back as `cursor` for the next page.",
269
+ inputSchema: {
270
+ limit: z
271
+ .number()
272
+ .int()
273
+ .min(1)
274
+ .max(200)
275
+ .optional()
276
+ .describe("Rows per page. Defaults to the server's page size."),
277
+ cursor: z
278
+ .string()
279
+ .optional()
280
+ .describe("Pagination cursor from a previous call's `nextCursor`."),
281
+ templateId: z.string().optional().describe("Only log entries rendered from this template."),
282
+ workflowInstanceId: z
283
+ .string()
284
+ .optional()
285
+ .describe("Only entries emitted by this workflow instance."),
286
+ channel: z.enum(CHANNELS).optional().describe("Only entries delivered on this channel."),
287
+ status: z
288
+ .string()
289
+ .optional()
290
+ .describe("Delivery status to filter on, e.g. 'sent' or 'failed'."),
291
+ },
292
+ annotations: { title: "Get delivery logs", readOnlyHint: true },
293
+ }, handler(async (args) => api.get("/v1/notifications/logs", args)));
294
+ // ─── Templates ──────────────────────────────────────────────────────────────
295
+ server.registerTool("list_templates", {
296
+ title: "List templates",
297
+ description: "List every registered template with its channel and content. Call this to find the template id " +
298
+ "for send_notification, or to check what a template renders before sending with it.",
299
+ annotations: { title: "List templates", readOnlyHint: true },
300
+ }, handler(async () => api.get("/v1/templates")));
301
+ server.registerTool("get_template", {
302
+ title: "Get a template",
303
+ description: "Fetch one template by id, including its full per-channel content and any AI prompts.",
304
+ inputSchema: { id: z.string().min(1).describe("Template id.") },
305
+ annotations: { title: "Get a template", readOnlyHint: true },
306
+ }, handler(async (args) => api.get(`/v1/templates/${encodeURIComponent(args.id)}`)));
307
+ server.registerTool("upsert_template", {
308
+ title: "Create or update a template",
309
+ description: "Create a template, or overwrite an existing one with the same id. Content is a per-channel object " +
310
+ "whose values may contain {{variable}} placeholders filled by send_notification's `data`; escaping " +
311
+ "is decided by the destination field. Because this overwrites, call get_template first when " +
312
+ "editing one that already exists.",
313
+ inputSchema: {
314
+ id: z.string().min(1).describe("Template id, e.g. 'order-shipped'."),
315
+ channel: z.enum(CHANNELS).describe("Channel this template renders for."),
316
+ topic: z
317
+ .union([z.string().min(1), z.array(z.string().min(1))])
318
+ .optional()
319
+ .describe("Topic(s) this template belongs to, used for per-user topic opt-outs."),
320
+ content: z
321
+ .record(z.unknown())
322
+ .describe("Channel-specific fields, e.g. { subject, body } for email."),
323
+ aiPrompts: z
324
+ .record(z.string())
325
+ .optional()
326
+ .describe("Optional per-field LLM prompts applied before rendering."),
327
+ },
328
+ annotations: {
329
+ title: "Create or update a template",
330
+ readOnlyHint: false,
331
+ idempotentHint: true,
332
+ },
333
+ }, handler(async (args) => api.put("/v1/templates", { templates: [args] })));
334
+ // ─── Users ──────────────────────────────────────────────────────────────────
335
+ server.registerTool("list_users", {
336
+ title: "List users",
337
+ description: "Page through the project's users. Results are paginated — pass the returned `nextCursor` back as " +
338
+ "`cursor`. For one known user prefer get_user, which also returns contacts and preferences.",
339
+ inputSchema: {
340
+ limit: z.number().int().min(1).max(200).optional().describe("Users per page."),
341
+ cursor: z
342
+ .string()
343
+ .optional()
344
+ .describe("Pagination cursor from a previous call's `nextCursor`."),
345
+ },
346
+ annotations: { title: "List users", readOnlyHint: true },
347
+ }, handler(async (args) => api.get("/v1/users", args)));
348
+ server.registerTool("get_user", {
349
+ title: "Get a user",
350
+ description: "Fetch one user with their contacts, segments, and notification preferences. Call this before " +
351
+ "sending to a single user when you need to know which channels they can actually be reached on.",
352
+ inputSchema: { id: z.string().min(1).describe("User id.") },
353
+ annotations: { title: "Get a user", readOnlyHint: true },
354
+ }, handler(async (args) => api.get(`/v1/users/${encodeURIComponent(args.id)}/details`)));
355
+ server.registerTool("upsert_user", {
356
+ title: "Create or update a user",
357
+ description: "Create a user profile, or update an existing one with the same id. Sets contact targets, segment " +
358
+ "tags, timezone, and preferences in one call. Segments assigned here are what send_notification's " +
359
+ "`segment` targeting matches on. Timezone drives quiet-hours maths, so set it when known.",
360
+ inputSchema: {
361
+ id: z.string().min(1).describe("Your own stable user id, e.g. 'usr_123'."),
362
+ email: z
363
+ .union([z.string().min(1), z.array(z.string().min(1))])
364
+ .optional()
365
+ .describe("One email address or several."),
366
+ phone: z
367
+ .union([z.string().min(1), z.array(z.string().min(1))])
368
+ .optional()
369
+ .describe("One phone number or several, in E.164 form."),
370
+ pushToken: z
371
+ .union([z.string().min(1), z.array(z.string().min(1))])
372
+ .optional()
373
+ .describe("One device push token or several."),
374
+ segments: z
375
+ .array(z.string().min(1))
376
+ .optional()
377
+ .describe("Segment tags to assign to this user."),
378
+ language: z
379
+ .string()
380
+ .optional()
381
+ .describe("BCP 47 language tag used to pick localised content."),
382
+ timezone: z
383
+ .string()
384
+ .optional()
385
+ .describe("IANA timezone, e.g. 'Europe/London'. Drives quiet hours."),
386
+ preferences: z
387
+ .object({
388
+ channels: z
389
+ .record(z.boolean())
390
+ .optional()
391
+ .describe("Per-channel opt-in map, e.g. { email: true, sms: false }."),
392
+ topics: z.record(z.boolean()).optional().describe("Per-topic opt-in map."),
393
+ quietHours: z
394
+ .array(z.object({
395
+ start: z.string().describe("HH:MM, 24h, UTC."),
396
+ end: z.string().describe("HH:MM, 24h, UTC."),
397
+ }))
398
+ .optional()
399
+ .describe("Windows during which non-critical sends are deferred."),
400
+ })
401
+ .optional()
402
+ .describe("Consent and quiet-hours settings."),
403
+ },
404
+ annotations: { title: "Create or update a user", readOnlyHint: false, idempotentHint: true },
405
+ }, handler(async (args) => api.post("/v1/users", args)));
406
+ server.registerTool("add_user_contact", {
407
+ title: "Add a contact to a user",
408
+ description: "Add one addressable target (email address, phone number, push token, or webhook URL) to an " +
409
+ "existing user without replacing their other contacts. Prefer this over upsert_user when adding a " +
410
+ "second device or address to someone who already exists.",
411
+ inputSchema: {
412
+ userId: z.string().min(1).describe("Id of the user to add the contact to."),
413
+ channel: z.enum(CONTACT_CHANNELS).describe("Channel this target belongs to."),
414
+ target: z.string().min(1).describe("The address itself: email, phone, push token, or URL."),
415
+ },
416
+ annotations: { title: "Add a contact to a user", readOnlyHint: false },
417
+ }, handler(async ({ userId, ...body }) => api.post(`/v1/users/${encodeURIComponent(userId)}/contacts`, body)));
418
+ // ─── Workflows ──────────────────────────────────────────────────────────────
419
+ server.registerTool("create_workflow", {
420
+ title: "Create a workflow",
421
+ description: "Define a named multi-step sequence — the way to build a drip, an onboarding series, or a reminder " +
422
+ "chain rather than a single send. Steps run in order and are one of: `notify` (send, using the " +
423
+ "same fields as send_notification), `wait` (pause for a duration like '1h' or '3d'), or " +
424
+ "`waitForEvent` (block until ingest_event reports a named event, with an optional timeout). A " +
425
+ "notify step with no target inherits the user the instance was triggered for. Creating a workflow " +
426
+ "does not run it — call trigger_workflow per user.",
427
+ inputSchema: {
428
+ name: z.string().min(1).describe("Workflow name, used later by trigger_workflow."),
429
+ steps: z
430
+ .array(z.union([
431
+ z.object({
432
+ action: z.literal("notify"),
433
+ payload: z
434
+ .record(z.unknown())
435
+ .describe("Same shape as send_notification's arguments. Omit the target to use the instance's own user."),
436
+ }),
437
+ z.object({
438
+ action: z.literal("wait"),
439
+ duration: z.string().describe("Duration string, e.g. '5m', '1h', '3d'."),
440
+ }),
441
+ z.object({
442
+ action: z.literal("waitForEvent"),
443
+ event: z.string().describe("Event name to wait for, as passed to ingest_event."),
444
+ options: z
445
+ .object({ timeout: z.string().optional().describe("e.g. '24h'.") })
446
+ .optional()
447
+ .describe("Give a timeout so the instance cannot wait forever."),
448
+ }),
449
+ ]))
450
+ .min(1)
451
+ .describe("Ordered steps."),
452
+ },
453
+ annotations: { title: "Create a workflow", readOnlyHint: false, idempotentHint: true },
454
+ }, handler(async (args) => api.post("/v1/workflows", args)));
455
+ server.registerTool("list_workflows", {
456
+ title: "List workflows",
457
+ description: "List registered workflow definitions and their steps. Call this to find the name to pass to " +
458
+ "trigger_workflow, or to check a sequence before triggering it.",
459
+ annotations: { title: "List workflows", readOnlyHint: true },
460
+ }, handler(async () => api.get("/v1/workflows")));
461
+ server.registerTool("trigger_workflow", {
462
+ title: "Trigger a workflow",
463
+ description: "Start one run of a registered workflow, optionally for a specific user, and return the instance " +
464
+ "id. Each call starts an independent instance, so triggering the same workflow twice for one user " +
465
+ "enrols them twice. Track the returned instance with get_workflow_run.",
466
+ inputSchema: {
467
+ name: z.string().min(1).describe("Name of the workflow to run."),
468
+ user: z
469
+ .string()
470
+ .min(1)
471
+ .optional()
472
+ .describe("User id this run is for. Notify steps default to them."),
473
+ input: z.record(z.unknown()).optional().describe("Data made available to the run's steps."),
474
+ },
475
+ annotations: { title: "Trigger a workflow", readOnlyHint: false, idempotentHint: false },
476
+ }, handler(async (args) => api.post("/v1/workflows/trigger", args)));
477
+ server.registerTool("get_workflow_run", {
478
+ title: "Get a workflow run",
479
+ description: "Fetch one workflow instance by id: which step it is on, its status, and what it is waiting for. " +
480
+ "Use this to check on a run started by trigger_workflow.",
481
+ inputSchema: { instanceId: z.string().min(1).describe("Workflow instance id.") },
482
+ annotations: { title: "Get a workflow run", readOnlyHint: true },
483
+ }, handler(async (args) => api.get(`/v1/workflows/instances/${encodeURIComponent(args.instanceId)}`)));
484
+ server.registerTool("cancel_workflow_run", {
485
+ title: "Cancel a workflow run",
486
+ description: "Stop a running or suspended workflow instance so its remaining steps never fire. This does not " +
487
+ "recall notifications already sent, and it cannot be undone — confirm with the user before " +
488
+ "cancelling a run you did not start in this session.",
489
+ inputSchema: { instanceId: z.string().min(1).describe("Workflow instance id to cancel.") },
490
+ annotations: {
491
+ title: "Cancel a workflow run",
492
+ readOnlyHint: false,
493
+ destructiveHint: true,
494
+ idempotentHint: true,
495
+ },
496
+ }, handler(async (args) => {
497
+ await api.request("DELETE", `/v1/workflows/instances/${encodeURIComponent(args.instanceId)}`);
498
+ return `Cancelled workflow instance ${args.instanceId}.`;
499
+ }));
500
+ server.registerTool("ingest_event", {
501
+ title: "Ingest an event",
502
+ description: "Report that something happened in your product. Workflow instances parked on a matching " +
503
+ "`waitForEvent` step resume. Call this to unblock a waiting sequence, e.g. emitting 'order.paid' " +
504
+ "so an abandoned-cart workflow stops before its reminder fires.",
505
+ inputSchema: {
506
+ name: z.string().min(1).describe("Event name, matching a workflow's waitForEvent step."),
507
+ properties: z
508
+ .record(z.unknown())
509
+ .describe("Event payload. Include the user id the event is about."),
510
+ },
511
+ annotations: { title: "Ingest an event", readOnlyHint: false, idempotentHint: false },
512
+ }, handler(async (args) => api.post("/v1/events", args)));
513
+ // ─── Operations ─────────────────────────────────────────────────────────────
514
+ server.registerTool("get_system_health", {
515
+ title: "Get system health",
516
+ description: "Report the health of the notifkit deployment: queue depth, worker state, and dependency status. " +
517
+ "Call this first when sends appear queued but never delivered, to tell an outage apart from a " +
518
+ "preference or quiet-hours filter.",
519
+ annotations: { title: "Get system health", readOnlyHint: true },
520
+ }, handler(async () => api.get("/v1/system/health")));
521
+ server.registerTool("get_dead_letters", {
522
+ title: "Get dead-lettered messages",
523
+ description: "List messages that exhausted their retries and landed in the dead-letter queue, with the error " +
524
+ "that put them there. Use this to investigate deliveries that failed permanently; " +
525
+ "replay_dead_letter puts one back on the queue.",
526
+ annotations: { title: "Get dead-lettered messages", readOnlyHint: true },
527
+ }, handler(async () => api.get("/v1/dlq")));
528
+ server.registerTool("replay_dead_letter", {
529
+ title: "Replay a dead-lettered message",
530
+ description: "Re-queue one dead-lettered message for delivery. Only replay after the cause of the original " +
531
+ "failure is fixed, or it will simply fail again — check get_dead_letters for the recorded error " +
532
+ "first. Replaying sends a real notification to a real person.",
533
+ inputSchema: {
534
+ id: z.string().min(1).describe("Dead-letter entry id from get_dead_letters."),
535
+ },
536
+ annotations: {
537
+ title: "Replay a dead-lettered message",
538
+ readOnlyHint: false,
539
+ idempotentHint: false,
540
+ },
541
+ }, handler(async (args) => api.post("/v1/dlq/replay", { id: args.id })));
542
+ }
543
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AACxE,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AACtE,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAUlE,8EAA8E;AAC9E,SAAS,EAAE,CAAC,KAAc;IACxB,MAAM,IAAI,GACR,KAAK,KAAK,SAAS;QACjB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,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C/F,mCAAmC;QACrC,WAAW,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,IAAI,EAAE;KAChE,EACD,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAClD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,4BAA4B;QACnC,WAAW,EACT,iGAAiG;YACjG,mFAAmF;YACnF,gDAAgD;QAClD,WAAW,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,YAAY,EAAE,IAAI,EAAE;KACzE,EACD,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CACxC,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,+FAA+F;YAC/F,iGAAiG;YACjG,8DAA8D;QAChE,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6CAA6C,CAAC;SAC9E;QACD,WAAW,EAAE;YACX,KAAK,EAAE,gCAAgC;YACvC,YAAY,EAAE,KAAK;YACnB,cAAc,EAAE,KAAK;SACtB;KACF,EACD,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CACrE,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@notifkit/mcp",
3
+ "version": "0.1.0",
4
+ "description": "Model Context Protocol server for notifkit — drive sends, templates, users, and workflows from a terminal agent.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "notifkit-mcp": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "dev": "tsc --watch",
19
+ "typecheck": "tsc --noEmit"
20
+ },
21
+ "dependencies": {
22
+ "@cfworker/json-schema": "^4.1.1",
23
+ "@modelcontextprotocol/sdk": "^1.30.0",
24
+ "zod": "^3.25.76"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^22.0.0",
28
+ "typescript": "^5.8.3"
29
+ },
30
+ "engines": {
31
+ "node": ">=22.0.0"
32
+ },
33
+ "license": "MIT",
34
+ "author": "devkitshq",
35
+ "homepage": "https://notifkit.dev",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/devkitshq/notifkit.git",
39
+ "directory": "packages/mcp"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/devkitshq/notifkit/issues"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }