@samueldenzil-org/sendkit-mcp 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -4
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
3
|
+
import { getErrorMessage, sendTelegramMessage, telegramMessageInputSchema } from "@samueldenzil-org/sendkit-core";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
// src/index.ts
|
|
6
|
+
const server = new McpServer({
|
|
7
|
+
name: "sendkit-mcp",
|
|
8
|
+
version: "0.0.0"
|
|
9
|
+
});
|
|
10
|
+
function getTelegramBotToken() {
|
|
11
|
+
const token = process.env.TELEGRAM_BOT_TOKEN;
|
|
12
|
+
if (!token) throw new Error("TELEGRAM_BOT_TOKEN environment variable is required. Please set it in your MCP client configuration.");
|
|
13
|
+
return token;
|
|
14
|
+
}
|
|
15
|
+
server.registerTool("send_telegram_message", {
|
|
16
|
+
title: "Send Telegram Message",
|
|
17
|
+
description: "Send a message to a Telegram chat, group, or channel using the Telegram Bot API.",
|
|
18
|
+
inputSchema: telegramMessageInputSchema
|
|
19
|
+
}, async (input) => {
|
|
20
|
+
try {
|
|
21
|
+
const result = await sendTelegramMessage({
|
|
22
|
+
...input,
|
|
23
|
+
botToken: getTelegramBotToken()
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
content: [{
|
|
27
|
+
type: "text",
|
|
28
|
+
text: `Sent Telegram message ${result.messageId} to chat ${result.chatId}`
|
|
29
|
+
}],
|
|
30
|
+
structuredContent: result
|
|
31
|
+
};
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: getErrorMessage(error)
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
async function main() {
|
|
43
|
+
const transport = new StdioServerTransport();
|
|
44
|
+
await server.connect(transport);
|
|
45
|
+
}
|
|
46
|
+
main().catch((error) => {
|
|
47
|
+
console.error("Failed to start MCP server:", error);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
});
|
|
50
|
+
export {};
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/server\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/server/stdio\";\nimport {\n getErrorMessage,\n sendTelegramMessage,\n telegramMessageInputSchema,\n} from \"@samueldenzil-org/sendkit-core\";\nimport process from \"node:process\";\n\nconst server = new McpServer({\n name: \"sendkit-mcp\",\n version: \"0.0.0\",\n});\n\nfunction getTelegramBotToken() {\n const token = process.env.TELEGRAM_BOT_TOKEN;\n\n if (!token) {\n throw new Error(\n \"TELEGRAM_BOT_TOKEN environment variable is required. Please set it in your MCP client configuration.\",\n );\n }\n\n return token;\n}\n\nserver.registerTool(\n \"send_telegram_message\",\n {\n title: \"Send Telegram Message\",\n description: \"Send a message to a Telegram chat, group, or channel using the Telegram Bot API.\",\n inputSchema: telegramMessageInputSchema,\n },\n async (input) => {\n try {\n const result = await sendTelegramMessage({\n ...input,\n botToken: getTelegramBotToken(),\n });\n\n return {\n content: [\n {\n type: \"text\",\n text: `Sent Telegram message ${result.messageId} to chat ${result.chatId}`,\n },\n ],\n structuredContent: result,\n };\n } catch (error) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: getErrorMessage(error),\n },\n ],\n };\n }\n },\n);\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((error) => {\n console.error(\"Failed to start MCP server:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;AASA,MAAM,SAAS,IAAI,UAAU;CAC3B,MAAM;CACN,SAAS;AACX,CAAC;AAED,SAAS,sBAAsB;CAC7B,MAAM,QAAQ,QAAQ,IAAI;CAE1B,IAAI,CAAC,OACH,MAAM,IAAI,MACR,sGACF;CAGF,OAAO;AACT;AAEA,OAAO,aACL,yBACA;CACE,OAAO;CACP,aAAa;CACb,aAAa;AACf,GACA,OAAO,UAAU;CACf,IAAI;EACF,MAAM,SAAS,MAAM,oBAAoB;GACvC,GAAG;GACH,UAAU,oBAAoB;EAChC,CAAC;EAED,OAAO;GACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,yBAAyB,OAAO,UAAU,WAAW,OAAO;GACpE,CACF;GACA,mBAAmB;EACrB;CACF,SAAS,OAAO;EACd,OAAO;GACL,SAAS;GACT,SAAS,CACP;IACE,MAAM;IACN,MAAM,gBAAgB,KAAK;GAC7B,CACF;EACF;CACF;AACF,CACF;AAEA,eAAe,OAAO;CACpB,MAAM,YAAY,IAAI,qBAAqB;CAC3C,MAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,QAAQ,MAAM,+BAA+B,KAAK;CAClD,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samueldenzil-org/sendkit-mcp",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"bin": {
|
|
5
|
+
"sendkit-mcp": "./dist/index.js"
|
|
6
|
+
},
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsdown",
|
|
26
|
+
"pack:dry": "bun run build && bun pm pack --dry-run",
|
|
27
|
+
"prepublishOnly": "bun run build",
|
|
28
|
+
"dev": "bun run src/index.ts",
|
|
29
|
+
"start": "node dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
33
|
+
"@samueldenzil-org/sendkit-core": "0.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/README.md
DELETED