@notifkit/mcp 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAepE,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;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB/C"}
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,13 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
11
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
12
|
import { NotifkitApi } from "./client.js";
|
|
13
13
|
import { registerTools } from "./tools.js";
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
14
15
|
import { fileURLToPath } from "node:url";
|
|
15
16
|
const DEFAULT_URL = "http://localhost:3000";
|
|
17
|
+
// Read rather than hard-coded, so releases can't leave the reported version behind.
|
|
18
|
+
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
16
19
|
export function createServer(options) {
|
|
17
|
-
const server = new McpServer({ name: "notifkit", version:
|
|
20
|
+
const server = new McpServer({ name: "notifkit", version: VERSION }, {
|
|
18
21
|
instructions: "Tools for notifkit, a self-hosted notification service.\n\n" +
|
|
19
22
|
"Sending: send_campaign takes a list of email addresses directly and is the right tool when the " +
|
|
20
23
|
"user supplies recipients themselves. send_notification targets existing users, a segment, or a " +
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,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,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,WAAW,CAAC;IAC3D,MAAM,MAAM,GAAG,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["#!/usr/bin/env node\n/**\n * notifkit MCP server (stdio).\n *\n * Exposes the notifkit HTTP API as MCP tools so a terminal agent can send\n * notifications, manage templates and users, and drive workflows.\n *\n * stdout is the JSON-RPC transport — never write to it. Diagnostics go to stderr.\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { NotifkitApi } from \"./client.js\";\nimport { registerTools } from \"./tools.js\";\n\nimport { fileURLToPath } from \"node:url\";\n\nconst DEFAULT_URL = \"http://localhost:3000\";\n\nexport function createServer(options: {\n baseUrl: string;\n apiKey: string;\n projectId?: string;\n}): McpServer {\n const server = new McpServer(\n { name: \"notifkit\", version:
|
|
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,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,oFAAoF;AACpF,MAAM,OAAO,GAAW,IAAI,CAAC,KAAK,CAChC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAClE,CAAC,OAAO,CAAC;AAEV,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;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SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC;QACnC,SAAS,EAAE,QAAQ,CAAC,eAAe,CAAC;QACpC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;AAEzC,IAAI,WAAW,EAAE,CAAC;IAChB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * notifkit MCP server (stdio).\n *\n * Exposes the notifkit HTTP API as MCP tools so a terminal agent can send\n * notifications, manage templates and users, and drive workflows.\n *\n * stdout is the JSON-RPC transport — never write to it. Diagnostics go to stderr.\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { NotifkitApi } from \"./client.js\";\nimport { registerTools } from \"./tools.js\";\n\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nconst DEFAULT_URL = \"http://localhost:3000\";\n\n// Read rather than hard-coded, so releases can't leave the reported version behind.\nconst VERSION: string = JSON.parse(\n readFileSync(new URL(\"../package.json\", import.meta.url), \"utf8\"),\n).version;\n\nexport function createServer(options: {\n baseUrl: string;\n apiKey: string;\n projectId?: string;\n}): McpServer {\n const server = new McpServer(\n { name: \"notifkit\", version: VERSION },\n {\n instructions:\n \"Tools for notifkit, a self-hosted notification service.\\n\\n\" +\n \"Sending: send_campaign takes a list of email addresses directly and is the right tool when the \" +\n \"user supplies recipients themselves. send_notification targets existing users, a segment, or a \" +\n \"topic. Both accept a `campaign` label — set one on any send whose results might be asked about \" +\n \"later, and tell the user the label, because without it the send cannot be reported on \" +\n \"afterwards. Multi-step sequences (drips, onboarding, reminders) are workflows: create_workflow \" +\n \"defines one, trigger_workflow runs it per user.\\n\\n\" +\n \"Reporting: get_campaign_stats answers 'how did that send do?'. Pass on its `warnings` verbatim — \" +\n \"an untracked open rate is not a zero open rate.\\n\\n\" +\n \"Discover ids with list_campaigns, list_segments, list_templates, and list_workflows rather than \" +\n \"guessing them.\\n\\n\" +\n \"Every send reaches real people and cannot be recalled, so confirm the audience before \" +\n \"broadcasting. Never remove a suppression to improve a delivery figure: suppressions record that \" +\n \"somebody asked not to be contacted.\",\n },\n );\n\n registerTools(server, new NotifkitApi(options));\n return server;\n}\n\nexport async function runServer(): Promise<void> {\n const baseUrl = process.env[\"NOTIFKIT_URL\"] ?? DEFAULT_URL;\n const apiKey = process.env[\"NOTIFKIT_API_KEY\"];\n const projectId = process.env[\"NOTIFKIT_PROJECT_ID\"];\n\n if (!apiKey) {\n console.error(\n \"notifkit-mcp: NOTIFKIT_API_KEY is not set.\\n\" +\n \" Set it to a project API key, or to your ADMIN_API_KEY together with NOTIFKIT_PROJECT_ID.\\n\" +\n ` NOTIFKIT_URL defaults to ${DEFAULT_URL}.`,\n );\n process.exit(1);\n }\n\n const server = createServer({ baseUrl, apiKey, projectId });\n await server.connect(new StdioServerTransport());\n\n console.error(`notifkit-mcp: connected, talking to ${baseUrl}`);\n}\n\nconst entryFile = process.argv[1];\nconst isDirectRun =\n Boolean(entryFile) &&\n !process.env[\"VITEST\"] &&\n (fileURLToPath(import.meta.url) === entryFile ||\n entryFile?.endsWith(\"notifkit-mcp\") ||\n entryFile?.endsWith(\"dist/index.js\") ||\n entryFile?.endsWith(\"src/index.ts\"));\n\nif (isDirectRun) {\n runServer().catch((error: unknown) => {\n console.error(\"notifkit-mcp: fatal:\", error instanceof Error ? error.message : error);\n process.exit(1);\n });\n}\n"]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,17 +13,23 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
13
13
|
import { NotifkitApi } from "./client.js";
|
|
14
14
|
import { registerTools } from "./tools.js";
|
|
15
15
|
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
16
17
|
import { fileURLToPath } from "node:url";
|
|
17
18
|
|
|
18
19
|
const DEFAULT_URL = "http://localhost:3000";
|
|
19
20
|
|
|
21
|
+
// Read rather than hard-coded, so releases can't leave the reported version behind.
|
|
22
|
+
const VERSION: string = JSON.parse(
|
|
23
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
|
|
24
|
+
).version;
|
|
25
|
+
|
|
20
26
|
export function createServer(options: {
|
|
21
27
|
baseUrl: string;
|
|
22
28
|
apiKey: string;
|
|
23
29
|
projectId?: string;
|
|
24
30
|
}): McpServer {
|
|
25
31
|
const server = new McpServer(
|
|
26
|
-
{ name: "notifkit", version:
|
|
32
|
+
{ name: "notifkit", version: VERSION },
|
|
27
33
|
{
|
|
28
34
|
instructions:
|
|
29
35
|
"Tools for notifkit, a self-hosted notification service.\n\n" +
|