bn-telegram-mcp-server 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.
Files changed (99) hide show
  1. package/README.md +1031 -0
  2. package/dist/debug-middleware.d.ts +12 -0
  3. package/dist/debug-middleware.d.ts.map +1 -0
  4. package/dist/debug-middleware.js +36 -0
  5. package/dist/debug-middleware.js.map +1 -0
  6. package/dist/encryption.d.ts +11 -0
  7. package/dist/encryption.d.ts.map +1 -0
  8. package/dist/encryption.js +26 -0
  9. package/dist/encryption.js.map +1 -0
  10. package/dist/helpers.d.ts +27 -0
  11. package/dist/helpers.d.ts.map +1 -0
  12. package/dist/helpers.js +103 -0
  13. package/dist/helpers.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +176 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/logger.d.ts +29 -0
  19. package/dist/logger.d.ts.map +1 -0
  20. package/dist/logger.js +114 -0
  21. package/dist/logger.js.map +1 -0
  22. package/dist/request-context.d.ts +24 -0
  23. package/dist/request-context.d.ts.map +1 -0
  24. package/dist/request-context.js +32 -0
  25. package/dist/request-context.js.map +1 -0
  26. package/dist/resolvers.d.ts +36 -0
  27. package/dist/resolvers.d.ts.map +1 -0
  28. package/dist/resolvers.js +252 -0
  29. package/dist/resolvers.js.map +1 -0
  30. package/dist/schemas.d.ts +150 -0
  31. package/dist/schemas.d.ts.map +1 -0
  32. package/dist/schemas.js +216 -0
  33. package/dist/schemas.js.map +1 -0
  34. package/dist/telegram-client.d.ts +19 -0
  35. package/dist/telegram-client.d.ts.map +1 -0
  36. package/dist/telegram-client.js +112 -0
  37. package/dist/telegram-client.js.map +1 -0
  38. package/dist/tool-loader.d.ts +31 -0
  39. package/dist/tool-loader.d.ts.map +1 -0
  40. package/dist/tool-loader.js +121 -0
  41. package/dist/tool-loader.js.map +1 -0
  42. package/dist/tool-registry.d.ts +47 -0
  43. package/dist/tool-registry.d.ts.map +1 -0
  44. package/dist/tool-registry.js +58 -0
  45. package/dist/tool-registry.js.map +1 -0
  46. package/dist/tools/getChat.d.ts +28 -0
  47. package/dist/tools/getChat.d.ts.map +1 -0
  48. package/dist/tools/getChat.js +69 -0
  49. package/dist/tools/getChat.js.map +1 -0
  50. package/dist/tools/getChatMembers.d.ts +34 -0
  51. package/dist/tools/getChatMembers.d.ts.map +1 -0
  52. package/dist/tools/getChatMembers.js +150 -0
  53. package/dist/tools/getChatMembers.js.map +1 -0
  54. package/dist/tools/getContacts.d.ts +28 -0
  55. package/dist/tools/getContacts.d.ts.map +1 -0
  56. package/dist/tools/getContacts.js +73 -0
  57. package/dist/tools/getContacts.js.map +1 -0
  58. package/dist/tools/getFile.d.ts +21 -0
  59. package/dist/tools/getFile.d.ts.map +1 -0
  60. package/dist/tools/getFile.js +33 -0
  61. package/dist/tools/getFile.js.map +1 -0
  62. package/dist/tools/getGroup.d.ts +27 -0
  63. package/dist/tools/getGroup.d.ts.map +1 -0
  64. package/dist/tools/getGroup.js +100 -0
  65. package/dist/tools/getGroup.js.map +1 -0
  66. package/dist/tools/getMe.d.ts +17 -0
  67. package/dist/tools/getMe.d.ts.map +1 -0
  68. package/dist/tools/getMe.js +20 -0
  69. package/dist/tools/getMe.js.map +1 -0
  70. package/dist/tools/getMessageContext.d.ts +21 -0
  71. package/dist/tools/getMessageContext.d.ts.map +1 -0
  72. package/dist/tools/getMessageContext.js +164 -0
  73. package/dist/tools/getMessageContext.js.map +1 -0
  74. package/dist/tools/getMessages.d.ts +38 -0
  75. package/dist/tools/getMessages.d.ts.map +1 -0
  76. package/dist/tools/getMessages.js +123 -0
  77. package/dist/tools/getMessages.js.map +1 -0
  78. package/dist/tools/getUser.d.ts +22 -0
  79. package/dist/tools/getUser.d.ts.map +1 -0
  80. package/dist/tools/getUser.js +38 -0
  81. package/dist/tools/getUser.js.map +1 -0
  82. package/dist/tools/index.d.ts +11 -0
  83. package/dist/tools/index.d.ts.map +1 -0
  84. package/dist/tools/index.js +12 -0
  85. package/dist/tools/index.js.map +1 -0
  86. package/dist/tools/sendMessage.d.ts +39 -0
  87. package/dist/tools/sendMessage.d.ts.map +1 -0
  88. package/dist/tools/sendMessage.js +116 -0
  89. package/dist/tools/sendMessage.js.map +1 -0
  90. package/dist/transformers.d.ts +133 -0
  91. package/dist/transformers.d.ts.map +1 -0
  92. package/dist/transformers.js +335 -0
  93. package/dist/transformers.js.map +1 -0
  94. package/dist/types.d.ts +55 -0
  95. package/dist/types.d.ts.map +1 -0
  96. package/dist/types.js +2 -0
  97. package/dist/types.js.map +1 -0
  98. package/package.json +45 -0
  99. package/tools.json +252 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAGD;;;;;;GAMG;AAGH,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,CAAC,EAAE,SAAS,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,CAAC,EAAE,OAAO,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,CAAC,EAAE,OAAO,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "bn-telegram-mcp-server",
3
+ "version": "0.0.1",
4
+ "description": "Stateless MCP Server for Telegram via TDLib",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "bn-telegram-mcp-server": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "dev": "nodemon",
14
+ "dev:debug": "DEBUG=true nodemon",
15
+ "prepack": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "mcp",
19
+ "telegram",
20
+ "tdlib",
21
+ "stateless"
22
+ ],
23
+ "author": "BlueNexus AI",
24
+ "license": "PROPRIETARY",
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.0.4",
27
+ "express": "^4.21.2",
28
+ "tdl": "^8.0.0",
29
+ "prebuilt-tdlib": "^0.1008057.0",
30
+ "zod": "^3.24.1"
31
+ },
32
+ "devDependencies": {
33
+ "@types/express": "^5.0.0",
34
+ "@types/node": "^22.10.2",
35
+ "nodemon": "^3.1.10",
36
+ "typescript": "^5.8.3"
37
+ },
38
+ "files": [
39
+ "dist/**/*",
40
+ "README.md",
41
+ "LICENSE",
42
+ "tools.json"
43
+ ],
44
+ "packageManager": "pnpm@10.22.0"
45
+ }
package/tools.json ADDED
@@ -0,0 +1,252 @@
1
+ {
2
+ "getMe": {
3
+ "name": "getMe",
4
+ "description": "Get information about the current Telegram user (the authenticated user). Returns name, username, phone, status, and profile info.",
5
+ "inputSchema": {
6
+ "type": "object",
7
+ "properties": {}
8
+ }
9
+ },
10
+ "getChat": {
11
+ "name": "getChat",
12
+ "description": "Get chat information - either list all chats or get details for a specific chat. If 'chat' parameter is provided, returns single chat info. If omitted, returns list of all chats.",
13
+ "inputSchema": {
14
+ "type": "object",
15
+ "properties": {
16
+ "chat": {
17
+ "type": ["number", "string"],
18
+ "description": "Optional - Chat identifier (numeric ID or title/name to search). If not provided, lists all chats."
19
+ },
20
+ "chat_list": {
21
+ "type": "string",
22
+ "enum": ["main", "archive"],
23
+ "description": "Which chat list to retrieve (default: main)"
24
+ },
25
+ "limit": {
26
+ "type": "number",
27
+ "description": "Maximum number of chats to return when listing (default: 100, max: 4000)"
28
+ }
29
+ }
30
+ }
31
+ },
32
+ "getMessages": {
33
+ "name": "getMessages",
34
+ "description": "Get messages from a chat - supports history, specific IDs, or search. Use 'mode' parameter to choose: 'history' for paginated history, 'specific' for exact message IDs, 'search' for text search.",
35
+ "inputSchema": {
36
+ "type": "object",
37
+ "properties": {
38
+ "chat": {
39
+ "type": ["number", "string"],
40
+ "description": "Chat identifier (required for history and specific modes, optional for search)"
41
+ },
42
+ "mode": {
43
+ "type": "string",
44
+ "enum": ["history", "specific", "search"],
45
+ "description": "Mode: 'history' for paginated history, 'specific' for exact message IDs, 'search' for text search (default: history)"
46
+ },
47
+ "from_message_id": {
48
+ "type": "number",
49
+ "description": "(history/chat search mode) Message ID to start from (0 for latest)"
50
+ },
51
+ "offset": {
52
+ "type": "number",
53
+ "description": "(history mode) Numeric offset for pagination"
54
+ },
55
+ "limit": {
56
+ "type": "number",
57
+ "description": "Maximum messages to return (default: 50, max: 100)"
58
+ },
59
+ "only_local": {
60
+ "type": "boolean",
61
+ "description": "(history mode) Only return locally cached messages"
62
+ },
63
+ "message_ids": {
64
+ "type": "array",
65
+ "items": { "type": "number" },
66
+ "description": "(specific mode) Array of message IDs to retrieve"
67
+ },
68
+ "query": {
69
+ "type": "string",
70
+ "description": "(search mode) Search query text"
71
+ },
72
+ "next_offset": {
73
+ "type": "string",
74
+ "description": "(search mode) Cursor for pagination - pass the next_offset from previous response"
75
+ }
76
+ }
77
+ }
78
+ },
79
+ "sendMessage": {
80
+ "name": "sendMessage",
81
+ "description": "Send or forward messages to a chat. Use 'action' parameter: 'send' to compose new message, 'forward' to forward existing messages from another chat.",
82
+ "inputSchema": {
83
+ "type": "object",
84
+ "properties": {
85
+ "chat": {
86
+ "type": ["number", "string"],
87
+ "description": "Target chat to send/forward to (numeric ID or chat title/name)"
88
+ },
89
+ "action": {
90
+ "type": "string",
91
+ "enum": ["send", "forward"],
92
+ "description": "Action: 'send' to compose new message, 'forward' to forward existing messages (default: send)"
93
+ },
94
+ "text": {
95
+ "type": "string",
96
+ "description": "(send action) Text content of the message"
97
+ },
98
+ "reply_to_message_id": {
99
+ "type": "number",
100
+ "description": "(send action) ID of message to reply to"
101
+ },
102
+ "from_chat": {
103
+ "type": ["number", "string"],
104
+ "description": "(forward action) Source chat to forward from"
105
+ },
106
+ "message_ids": {
107
+ "type": "array",
108
+ "items": { "type": "number" },
109
+ "description": "(forward action) Array of message IDs to forward"
110
+ },
111
+ "send_copy": {
112
+ "type": "boolean",
113
+ "description": "(forward action) Send copies without forwarding header"
114
+ },
115
+ "remove_caption": {
116
+ "type": "boolean",
117
+ "description": "(forward action) Remove media captions when forwarding"
118
+ }
119
+ },
120
+ "required": ["chat"]
121
+ }
122
+ },
123
+ "getUser": {
124
+ "name": "getUser",
125
+ "description": "Get information about a Telegram user. You can use their name (e.g., 'Gong', 'John Doe') or numeric user ID.",
126
+ "inputSchema": {
127
+ "type": "object",
128
+ "properties": {
129
+ "user": {
130
+ "type": ["number", "string"],
131
+ "description": "User identifier: name (e.g., 'John Doe') or numeric user ID"
132
+ }
133
+ },
134
+ "required": ["user"]
135
+ }
136
+ },
137
+ "getContacts": {
138
+ "name": "getContacts",
139
+ "description": "Get contacts - list all or search by name/username. If 'query' is provided, searches contacts. If omitted, returns all contacts.",
140
+ "inputSchema": {
141
+ "type": "object",
142
+ "properties": {
143
+ "query": {
144
+ "type": "string",
145
+ "description": "Optional - Search query to filter contacts. If not provided, returns all contacts"
146
+ },
147
+ "limit": {
148
+ "type": "number",
149
+ "description": "Maximum results when searching (default: 50, max: 200)"
150
+ }
151
+ }
152
+ }
153
+ },
154
+ "getFile": {
155
+ "name": "getFile",
156
+ "description": "Get file metadata (size, remote ID). Note: Download is not supported in stateless mode.",
157
+ "inputSchema": {
158
+ "type": "object",
159
+ "properties": {
160
+ "file_id": {
161
+ "type": "number",
162
+ "description": "Identifier of the file to get metadata for"
163
+ }
164
+ },
165
+ "required": ["file_id"]
166
+ }
167
+ },
168
+ "getGroup": {
169
+ "name": "getGroup",
170
+ "description": "Get group information - supports basic groups, supergroups, and channels. Use 'type' parameter: 'auto' to detect automatically, 'supergroup' for supergroups/channels, 'basic_group' for basic groups.",
171
+ "inputSchema": {
172
+ "type": "object",
173
+ "properties": {
174
+ "group": {
175
+ "type": ["number", "string"],
176
+ "description": "Group identifier (numeric ID or group name)"
177
+ },
178
+ "type": {
179
+ "type": "string",
180
+ "enum": ["auto", "supergroup", "basic_group"],
181
+ "description": "Group type: 'auto' to detect, 'supergroup', or 'basic_group' (default: auto)"
182
+ }
183
+ },
184
+ "required": ["group"]
185
+ }
186
+ },
187
+ "getChatMembers": {
188
+ "name": "getChatMembers",
189
+ "description": "Get members of a chat - supports filtering by role or search. Use 'filter' parameter: 'recent', 'administrators', 'banned', 'bots', or 'search'.",
190
+ "inputSchema": {
191
+ "type": "object",
192
+ "properties": {
193
+ "chat": {
194
+ "type": ["number", "string"],
195
+ "description": "Chat identifier (numeric ID or chat title)"
196
+ },
197
+ "filter": {
198
+ "type": "string",
199
+ "enum": ["recent", "administrators", "banned", "bots", "search"],
200
+ "description": "Filter type: 'recent', 'administrators', 'banned', 'bots', or 'search' (default: recent)"
201
+ },
202
+ "query": {
203
+ "type": "string",
204
+ "description": "Search query (only used with 'search' and 'banned' filters)"
205
+ },
206
+ "offset": {
207
+ "type": "number",
208
+ "description": "Pagination offset (default: 0)"
209
+ },
210
+ "limit": {
211
+ "type": "number",
212
+ "description": "Maximum members to return (default: 200, max: 200)"
213
+ }
214
+ },
215
+ "required": ["chat"]
216
+ }
217
+ },
218
+ "getMessageContext": {
219
+ "name": "getMessageContext",
220
+ "description": "Get surrounding messages for context around a specific message or search results. Returns messages before and after the target to understand the full conversation flow. Use 'mode' parameter: 'message_id' to get context around a known message, 'search' to find messages and get context around each match.",
221
+ "inputSchema": {
222
+ "type": "object",
223
+ "properties": {
224
+ "chat": {
225
+ "type": ["number", "string"],
226
+ "description": "Chat identifier (required for message_id mode, optional for search mode - global search if omitted)"
227
+ },
228
+ "mode": {
229
+ "type": "string",
230
+ "enum": ["message_id", "search"],
231
+ "description": "Mode: 'message_id' to get context around a specific message, 'search' to find messages and get context (default: message_id)"
232
+ },
233
+ "message_id": {
234
+ "type": "number",
235
+ "description": "(message_id mode) The message ID to get context around"
236
+ },
237
+ "query": {
238
+ "type": "string",
239
+ "description": "(search mode) Search query to find messages"
240
+ },
241
+ "search_limit": {
242
+ "type": "number",
243
+ "description": "(search mode) Maximum search results to get context for (default: 5, max: 20)"
244
+ },
245
+ "context_count": {
246
+ "type": "number",
247
+ "description": "Number of messages to fetch before AND after the target message (default: 5, max: 50)"
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }