@mirid-dev/sendkit-mcp-tools 0.0.0-stage → 0.0.1
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 +21 -0
- package/README.md +32 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -4
- package/src/index.ts +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ky-Ling
|
|
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
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mirid-dev/sendkit-mcp-tools
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[MCP](https://modelcontextprotocol.io) tool definitions for SendKit, shared by its local and remote MCP servers.
|
|
4
|
+
|
|
5
|
+
Requires Node.js 20 or later. ESM only.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @mirid-dev/sendkit-mcp-tools @modelcontextprotocol/server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { McpServer } from '@modelcontextprotocol/server'
|
|
17
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio'
|
|
18
|
+
import { registerTelegramTool } from '@mirid-dev/sendkit-mcp-tools'
|
|
19
|
+
|
|
20
|
+
const server = new McpServer({ name: 'my-server', version: '1.0.0' })
|
|
21
|
+
|
|
22
|
+
registerTelegramTool(server, () => process.env.TELEGRAM_BOT_TOKEN ?? '')
|
|
23
|
+
|
|
24
|
+
await server.connect(new StdioServerTransport())
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`registerTelegramTool(server, getBotToken)` registers a `telegram` tool that takes `chatId` and `message` and returns `messageId`, `chatId`, and `sentAt`. `getBotToken` is called on every tool call, so a missing token fails that call instead of server startup.
|
|
28
|
+
|
|
29
|
+
For a ready-to-run server, use [`@mirid-dev/sendkit-local-mcp`](https://www.npmjs.com/package/@mirid-dev/sendkit-local-mcp).
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";wBAegB,qBAAqB,QAAQ,WAAW"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { sendTelegramMessage, telegramMessageInputSchema, telegramMessageOutputSchema } from "@mirid-dev/sendkit-core";
|
|
3
|
+
// src/index.ts
|
|
4
|
+
const telegramToolOutputSchema = telegramMessageOutputSchema.extend({ sentAt: z.iso.datetime() });
|
|
5
|
+
function registerTelegramTool(server, getBotToken) {
|
|
6
|
+
server.registerTool("telegram", {
|
|
7
|
+
title: "Telegram",
|
|
8
|
+
description: "Send a Telegram message",
|
|
9
|
+
inputSchema: telegramMessageInputSchema,
|
|
10
|
+
outputSchema: telegramToolOutputSchema
|
|
11
|
+
}, async (input) => {
|
|
12
|
+
const result = await sendTelegramMessage({
|
|
13
|
+
...input,
|
|
14
|
+
botToken: getBotToken()
|
|
15
|
+
});
|
|
16
|
+
const output = {
|
|
17
|
+
...result,
|
|
18
|
+
sentAt: result.sentAt.toISOString()
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
content: [{
|
|
22
|
+
type: "text",
|
|
23
|
+
text: `Sent Telegram message ${output.messageId} to chat ${output.chatId}`
|
|
24
|
+
}],
|
|
25
|
+
structuredContent: output
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { registerTelegramTool };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { McpServer } from '@modelcontextprotocol/server'\nimport { z } from 'zod'\n\nimport {\n sendTelegramMessage,\n telegramMessageInputSchema,\n telegramMessageOutputSchema,\n} from '@mirid-dev/sendkit-core'\n\n// Structured content travels as JSON, so the Date becomes an ISO string\nconst telegramToolOutputSchema = telegramMessageOutputSchema.extend({\n sentAt: z.iso.datetime(),\n})\n\n// getBotToken runs per call, so a missing token fails the call rather than server startup\nexport function registerTelegramTool(server: McpServer, getBotToken: () => string) {\n server.registerTool(\n 'telegram',\n {\n title: 'Telegram',\n description: 'Send a Telegram message',\n inputSchema: telegramMessageInputSchema,\n outputSchema: telegramToolOutputSchema,\n },\n async (input) => {\n const result = await sendTelegramMessage({\n ...input,\n botToken: getBotToken(),\n })\n\n const output = { ...result, sentAt: result.sentAt.toISOString() }\n\n return {\n content: [\n {\n type: 'text',\n text: `Sent Telegram message ${output.messageId} to chat ${output.chatId}`,\n },\n ],\n structuredContent: output,\n }\n },\n )\n}\n"],"mappings":";;;AAUA,MAAM,2BAA2B,4BAA4B,OAAO,EAClE,QAAQ,EAAE,IAAI,SAAS,EACzB,CAAC;AAGD,SAAgB,qBAAqB,QAAmB,aAA2B;CACjF,OAAO,aACL,YACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;EACb,cAAc;CAChB,GACA,OAAO,UAAU;EACf,MAAM,SAAS,MAAM,oBAAoB;GACvC,GAAG;GACH,UAAU,YAAY;EACxB,CAAC;EAED,MAAM,SAAS;GAAE,GAAG;GAAQ,QAAQ,OAAO,OAAO,YAAY;EAAE;EAEhE,OAAO;GACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,yBAAyB,OAAO,UAAU,WAAW,OAAO;GACpE,CACF;GACA,mBAAmB;EACrB;CACF,CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirid-dev/sendkit-mcp-tools",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "MCP tool definitions for SendKit, shared by its local and remote MCP servers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Ky-Ling/sendkit.git",
|
|
9
|
+
"directory": "packages/mcp-tools"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"source": "./src/index.ts",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsdown",
|
|
31
|
+
"pack:dry": "bun run build && bun pm pack --dry-run",
|
|
32
|
+
"prepublishOnly": "bun run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@mirid-dev/sendkit-core": "0.0.1",
|
|
36
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
37
|
+
"zod": "^4.6.7"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
sendTelegramMessage,
|
|
6
|
+
telegramMessageInputSchema,
|
|
7
|
+
telegramMessageOutputSchema,
|
|
8
|
+
} from '@mirid-dev/sendkit-core'
|
|
9
|
+
|
|
10
|
+
// Structured content travels as JSON, so the Date becomes an ISO string
|
|
11
|
+
const telegramToolOutputSchema = telegramMessageOutputSchema.extend({
|
|
12
|
+
sentAt: z.iso.datetime(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
// getBotToken runs per call, so a missing token fails the call rather than server startup
|
|
16
|
+
export function registerTelegramTool(server: McpServer, getBotToken: () => string) {
|
|
17
|
+
server.registerTool(
|
|
18
|
+
'telegram',
|
|
19
|
+
{
|
|
20
|
+
title: 'Telegram',
|
|
21
|
+
description: 'Send a Telegram message',
|
|
22
|
+
inputSchema: telegramMessageInputSchema,
|
|
23
|
+
outputSchema: telegramToolOutputSchema,
|
|
24
|
+
},
|
|
25
|
+
async (input) => {
|
|
26
|
+
const result = await sendTelegramMessage({
|
|
27
|
+
...input,
|
|
28
|
+
botToken: getBotToken(),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const output = { ...result, sentAt: result.sentAt.toISOString() }
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: `Sent Telegram message ${output.messageId} to chat ${output.chatId}`,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
structuredContent: output,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
}
|