@overpod/mcp-telegram 1.23.0 → 1.24.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/CHANGELOG.md +50 -25
- package/README.md +76 -9
- package/dist/telegram-client.d.ts +26 -0
- package/dist/telegram-client.js +112 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/stickers.d.ts +3 -0
- package/dist/tools/stickers.js +137 -0
- package/package.json +13 -9
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.24.1] - 2026-04-20
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Dependencies bumped to latest: `@modelcontextprotocol/sdk` 1.28.0 → 1.29.0, `dotenv` 17.3.1 → 17.4.2, `@biomejs/biome` 2.4.9 → 2.4.12, `typescript` 6.0.2 → 6.0.3, `@types/node` 25.5.0 → 25.6.0
|
|
14
|
+
- `biome.json` migrated to schema 2.4.12
|
|
15
|
+
|
|
16
|
+
## [1.24.0] - 2026-04-06
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Sticker tools** — 5 new tools (59 total): `telegram-get-sticker-set`, `telegram-search-sticker-sets`, `telegram-get-installed-stickers`, `telegram-send-sticker`, `telegram-get-recent-stickers`
|
|
20
|
+
- **Pre-built binaries** — zero-dependency standalone executables for Linux (x64/ARM64), macOS (x64/ARM64), Windows (x64)
|
|
21
|
+
- **Documentation site** — VitePress-based docs at overpod.github.io/mcp-telegram with i18n (English, Russian, Chinese)
|
|
22
|
+
|
|
23
|
+
## [1.23.0] - 2026-04-05
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- 11 new tools (22 total): `telegram-send-reaction`, `telegram-edit-message`, `telegram-delete-message`, `telegram-forward-message`, `telegram-mark-as-read`, `telegram-get-dialogs`, `telegram-get-chat-info`, `telegram-send-file`, `telegram-add-contact`, `telegram-create-poll`, `telegram-manage-topics`
|
|
27
|
+
- Account management tools: `telegram-get-sessions`, `telegram-terminate-session`, `telegram-set-privacy`, `telegram-set-auto-delete`, `telegram-update-profile`
|
|
28
|
+
- Better entity resolution for channels and supergroups
|
|
29
|
+
|
|
10
30
|
## [1.22.0] - 2026-04-01
|
|
11
31
|
|
|
12
32
|
### Added
|
|
@@ -257,28 +277,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
257
277
|
- Session persistence
|
|
258
278
|
- GramJS/MTProto integration
|
|
259
279
|
|
|
260
|
-
[Unreleased]: https://github.com/
|
|
261
|
-
[1.
|
|
262
|
-
[1.
|
|
263
|
-
[1.
|
|
264
|
-
[1.
|
|
265
|
-
[1.
|
|
266
|
-
[1.
|
|
267
|
-
[1.
|
|
268
|
-
[1.
|
|
269
|
-
[1.
|
|
270
|
-
[1.
|
|
271
|
-
[1.
|
|
272
|
-
[1.
|
|
273
|
-
[1.
|
|
274
|
-
[1.
|
|
275
|
-
[1.
|
|
276
|
-
[1.
|
|
277
|
-
[1.
|
|
278
|
-
[1.
|
|
279
|
-
[1.
|
|
280
|
-
[1.
|
|
281
|
-
[1.
|
|
282
|
-
[1.
|
|
283
|
-
[1.
|
|
284
|
-
[1.
|
|
280
|
+
[Unreleased]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.24.0...HEAD
|
|
281
|
+
[1.24.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.23.0...v1.24.0
|
|
282
|
+
[1.23.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.22.0...v1.23.0
|
|
283
|
+
[1.22.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.21.0...v1.22.0
|
|
284
|
+
[1.21.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.20.0...v1.21.0
|
|
285
|
+
[1.20.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.19.0...v1.20.0
|
|
286
|
+
[1.19.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.18.0...v1.19.0
|
|
287
|
+
[1.18.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.17.0...v1.18.0
|
|
288
|
+
[1.17.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.16.0...v1.17.0
|
|
289
|
+
[1.16.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.15.0...v1.16.0
|
|
290
|
+
[1.15.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.14.0...v1.15.0
|
|
291
|
+
[1.14.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.13.0...v1.14.0
|
|
292
|
+
[1.13.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.12.0...v1.13.0
|
|
293
|
+
[1.12.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.11.1...v1.12.0
|
|
294
|
+
[1.11.1]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.11.0...v1.11.1
|
|
295
|
+
[1.11.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.10.1...v1.11.0
|
|
296
|
+
[1.10.1]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.10.0...v1.10.1
|
|
297
|
+
[1.10.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.9.0...v1.10.0
|
|
298
|
+
[1.9.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.8.1...v1.9.0
|
|
299
|
+
[1.8.1]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.8.0...v1.8.1
|
|
300
|
+
[1.8.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.7.0...v1.8.0
|
|
301
|
+
[1.7.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.6.0...v1.7.0
|
|
302
|
+
[1.6.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.5.0...v1.6.0
|
|
303
|
+
[1.5.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.4.0...v1.5.0
|
|
304
|
+
[1.4.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.3.1...v1.4.0
|
|
305
|
+
[1.3.1]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.3.0...v1.3.1
|
|
306
|
+
[1.3.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.2.0...v1.3.0
|
|
307
|
+
[1.2.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.1.0...v1.2.0
|
|
308
|
+
[1.1.0]: https://github.com/mcp-telegram/mcp-telegram/compare/v1.0.0...v1.1.0
|
|
309
|
+
[1.0.0]: https://github.com/mcp-telegram/mcp-telegram/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](https://glama.ai/mcp/servers/overpod/mcp-telegram)
|
|
10
10
|
|
|
11
|
-
> **
|
|
11
|
+
> **[📖 Documentation](https://mcp-telegram.github.io/mcp-telegram/)** · **[☁️ Cloud version](https://mcp-telegram.com)** — connect Telegram to Claude.ai or ChatGPT in 30 seconds with QR code, no API keys needed.
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<img src="assets/demo.gif" alt="MCP Telegram demo — connect and summarize chats in Claude" width="700">
|
|
@@ -18,10 +18,14 @@ An MCP (Model Context Protocol) server that connects AI assistants like Claude t
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
+
- **59 tools** -- the most comprehensive Telegram MCP server available
|
|
21
22
|
- **MTProto protocol** -- direct Telegram API access, not the limited Bot API
|
|
22
23
|
- **Userbot** -- operates as your personal account, not a bot
|
|
23
|
-
- **Full-featured** -- messaging, reactions, polls, scheduled messages, media, contacts, and more
|
|
24
|
+
- **Full-featured** -- messaging, reactions, polls, scheduled messages, stickers, media, contacts, and more
|
|
24
25
|
- **Forum Topics** -- list topics, read per-topic messages, send to specific topics, per-topic unread counts
|
|
26
|
+
- **Stickers** -- search sticker sets, browse installed/recent stickers, send stickers to any chat
|
|
27
|
+
- **Account management** -- update profile, manage privacy settings, sessions, auto-delete timers
|
|
28
|
+
- **Global search** -- search messages across all chats at once
|
|
25
29
|
- **QR code login** -- authenticate by scanning a QR code in the Telegram app
|
|
26
30
|
- **Session persistence** -- login once, stay connected across restarts
|
|
27
31
|
- **Human-readable output** -- sender names are resolved, not just numeric IDs
|
|
@@ -130,10 +134,35 @@ mcp-telegram # run server
|
|
|
130
134
|
mcp-telegram login # QR login
|
|
131
135
|
```
|
|
132
136
|
|
|
137
|
+
### Pre-built binary (no runtime needed)
|
|
138
|
+
|
|
139
|
+
Download from [Releases](https://github.com/mcp-telegram/mcp-telegram/releases) — standalone single-file binaries, zero dependencies:
|
|
140
|
+
|
|
141
|
+
| Platform | Server | Login CLI |
|
|
142
|
+
|----------|--------|-----------|
|
|
143
|
+
| Linux x64 | `mcp-telegram-linux-x64` | `mcp-telegram-login-linux-x64` |
|
|
144
|
+
| Linux ARM64 | `mcp-telegram-linux-arm64` | `mcp-telegram-login-linux-arm64` |
|
|
145
|
+
| macOS x64 | `mcp-telegram-darwin-x64` | `mcp-telegram-login-darwin-x64` |
|
|
146
|
+
| macOS ARM64 | `mcp-telegram-darwin-arm64` | `mcp-telegram-login-darwin-arm64` |
|
|
147
|
+
| Windows x64 | `mcp-telegram-windows-x64.exe` | `mcp-telegram-login-windows-x64.exe` |
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Download (example for Linux x64)
|
|
151
|
+
curl -L -o mcp-telegram https://github.com/mcp-telegram/mcp-telegram/releases/latest/download/mcp-telegram-linux-x64
|
|
152
|
+
curl -L -o mcp-telegram-login https://github.com/mcp-telegram/mcp-telegram/releases/latest/download/mcp-telegram-login-linux-x64
|
|
153
|
+
chmod +x mcp-telegram mcp-telegram-login
|
|
154
|
+
|
|
155
|
+
# Login
|
|
156
|
+
TELEGRAM_API_ID=YOUR_ID TELEGRAM_API_HASH=YOUR_HASH ./mcp-telegram-login
|
|
157
|
+
|
|
158
|
+
# Run
|
|
159
|
+
./mcp-telegram
|
|
160
|
+
```
|
|
161
|
+
|
|
133
162
|
### From source
|
|
134
163
|
|
|
135
164
|
```bash
|
|
136
|
-
git clone https://github.com/
|
|
165
|
+
git clone https://github.com/mcp-telegram/mcp-telegram.git
|
|
137
166
|
cd mcp-telegram
|
|
138
167
|
npm install && npm run build
|
|
139
168
|
```
|
|
@@ -141,7 +170,7 @@ npm install && npm run build
|
|
|
141
170
|
### Docker
|
|
142
171
|
|
|
143
172
|
```bash
|
|
144
|
-
docker build -t mcp-telegram https://github.com/
|
|
173
|
+
docker build -t mcp-telegram https://github.com/mcp-telegram/mcp-telegram.git
|
|
145
174
|
```
|
|
146
175
|
|
|
147
176
|
Login (interactive terminal required):
|
|
@@ -208,6 +237,24 @@ claude mcp add telegram -s user \
|
|
|
208
237
|
|
|
209
238
|
> **Note**: No terminal required! Login works entirely through Claude Desktop.
|
|
210
239
|
|
|
240
|
+
### Claude Desktop (Binary)
|
|
241
|
+
|
|
242
|
+
Same setup, but using the pre-built binary instead of npx:
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"mcpServers": {
|
|
247
|
+
"telegram": {
|
|
248
|
+
"command": "/path/to/mcp-telegram",
|
|
249
|
+
"env": {
|
|
250
|
+
"TELEGRAM_API_ID": "YOUR_ID",
|
|
251
|
+
"TELEGRAM_API_HASH": "YOUR_HASH"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
211
258
|
### Claude Desktop (Docker)
|
|
212
259
|
|
|
213
260
|
1. Login via terminal first (see [Docker](#docker) section above).
|
|
@@ -257,13 +304,31 @@ const telegramMcp = new MCPClient({
|
|
|
257
304
|
});
|
|
258
305
|
```
|
|
259
306
|
|
|
260
|
-
## Tools
|
|
307
|
+
## Tools (59)
|
|
261
308
|
|
|
262
309
|
All tools are auto-discoverable via MCP — your AI client will see the full list with parameters and descriptions when connected.
|
|
263
310
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
311
|
+
| Category | Tools |
|
|
312
|
+
|----------|-------|
|
|
313
|
+
| **Auth** | `telegram-status`, `telegram-login` |
|
|
314
|
+
| **Messaging** | `telegram-send-message`, `telegram-edit-message`, `telegram-delete-message`, `telegram-forward-message`, `telegram-send-scheduled` |
|
|
315
|
+
| **Reading** | `telegram-list-chats`, `telegram-read-messages`, `telegram-search-messages`, `telegram-search-global`, `telegram-search-chats`, `telegram-get-unread`, `telegram-mark-as-read` |
|
|
316
|
+
| **Forum Topics** | `telegram-list-topics`, `telegram-read-topic-messages` |
|
|
317
|
+
| **Polls** | `telegram-create-poll` |
|
|
318
|
+
| **Reactions** | `telegram-send-reaction`, `telegram-get-reactions` |
|
|
319
|
+
| **Stickers** | `telegram-send-sticker`, `telegram-get-installed-stickers`, `telegram-get-recent-stickers`, `telegram-get-sticker-set`, `telegram-search-sticker-sets` |
|
|
320
|
+
| **Media** | `telegram-send-file`, `telegram-download-media`, `telegram-get-profile-photo` |
|
|
321
|
+
| **Groups** | `telegram-create-group`, `telegram-edit-group`, `telegram-invite-to-group`, `telegram-join-chat`, `telegram-leave-group`, `telegram-kick-user`, `telegram-ban-user`, `telegram-unban-user`, `telegram-set-admin`, `telegram-remove-admin`, `telegram-get-my-role` |
|
|
322
|
+
| **Chat Info** | `telegram-get-chat-info`, `telegram-get-chat-members`, `telegram-get-chat-folders` |
|
|
323
|
+
| **Invite Links** | `telegram-create-invite-link`, `telegram-get-invite-links`, `telegram-revoke-invite-link` |
|
|
324
|
+
| **Contacts** | `telegram-get-contacts`, `telegram-add-contact`, `telegram-get-contact-requests` |
|
|
325
|
+
| **Moderation** | `telegram-block-user`, `telegram-unblock-user`, `telegram-report-spam` |
|
|
326
|
+
| **Profiles** | `telegram-get-profile`, `telegram-update-profile` |
|
|
327
|
+
| **Account** | `telegram-get-sessions`, `telegram-terminate-session`, `telegram-set-privacy`, `telegram-set-auto-delete` |
|
|
328
|
+
| **Pinning** | `telegram-pin-message`, `telegram-unpin-message` |
|
|
329
|
+
| **Chat Settings** | `telegram-mute-chat` |
|
|
330
|
+
|
|
331
|
+
> **Tip**: Ask your AI assistant *"What Telegram tools are available?"* to get the full list with parameters and descriptions.
|
|
267
332
|
|
|
268
333
|
## Development
|
|
269
334
|
|
|
@@ -289,9 +354,11 @@ src/
|
|
|
289
354
|
messages.ts -- Send, read, search, edit, delete, forward
|
|
290
355
|
chats.ts -- Chat listing, group management, admin
|
|
291
356
|
contacts.ts -- Contacts, profiles, moderation
|
|
292
|
-
media.ts -- Files, photos
|
|
357
|
+
media.ts -- Files, photos, downloads
|
|
293
358
|
reactions.ts -- Reactions
|
|
294
359
|
extras.ts -- Pin, schedule, polls, topics
|
|
360
|
+
stickers.ts -- Sticker sets, send, search, browse
|
|
361
|
+
account.ts -- Sessions, privacy, auto-delete, profile, chat mute/folders, invite links
|
|
295
362
|
shared.ts -- Shared utilities
|
|
296
363
|
```
|
|
297
364
|
|
|
@@ -370,4 +370,30 @@ export declare class TelegramService {
|
|
|
370
370
|
bio?: string;
|
|
371
371
|
}): Promise<void>;
|
|
372
372
|
updateUsername(username: string): Promise<void>;
|
|
373
|
+
getStickerSet(shortName: string): Promise<{
|
|
374
|
+
title: string;
|
|
375
|
+
shortName: string;
|
|
376
|
+
count: number;
|
|
377
|
+
stickers: Array<{
|
|
378
|
+
id: string;
|
|
379
|
+
accessHash: string;
|
|
380
|
+
emoji: string;
|
|
381
|
+
}>;
|
|
382
|
+
}>;
|
|
383
|
+
searchStickerSets(query: string): Promise<Array<{
|
|
384
|
+
title: string;
|
|
385
|
+
shortName: string;
|
|
386
|
+
count: number;
|
|
387
|
+
}>>;
|
|
388
|
+
getInstalledStickerSets(): Promise<Array<{
|
|
389
|
+
title: string;
|
|
390
|
+
shortName: string;
|
|
391
|
+
count: number;
|
|
392
|
+
}>>;
|
|
393
|
+
sendSticker(chatId: string, stickerSetShortName: string, stickerIndex: number, replyTo?: number): Promise<Api.Message | Api.UpdateShortSentMessage | undefined>;
|
|
394
|
+
getRecentStickers(): Promise<Array<{
|
|
395
|
+
id: string;
|
|
396
|
+
accessHash: string;
|
|
397
|
+
emoji: string;
|
|
398
|
+
}>>;
|
|
373
399
|
}
|
package/dist/telegram-client.js
CHANGED
|
@@ -1832,4 +1832,116 @@ export class TelegramService {
|
|
|
1832
1832
|
throw new Error(NOT_CONNECTED_ERROR);
|
|
1833
1833
|
await this.client.invoke(new Api.account.UpdateUsername({ username }));
|
|
1834
1834
|
}
|
|
1835
|
+
// ─── Stickers ──────────────────────────────────────────────
|
|
1836
|
+
async getStickerSet(shortName) {
|
|
1837
|
+
if (!this.client || !this.connected)
|
|
1838
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
1839
|
+
const result = await this.client.invoke(new Api.messages.GetStickerSet({
|
|
1840
|
+
stickerset: new Api.InputStickerSetShortName({ shortName }),
|
|
1841
|
+
hash: 0,
|
|
1842
|
+
}));
|
|
1843
|
+
if (result instanceof Api.messages.StickerSetNotModified) {
|
|
1844
|
+
throw new Error("Sticker set was not modified");
|
|
1845
|
+
}
|
|
1846
|
+
const set = result.set;
|
|
1847
|
+
const packs = result.packs;
|
|
1848
|
+
// Build emoji map: document id -> emoji
|
|
1849
|
+
const emojiMap = new Map();
|
|
1850
|
+
for (const pack of packs) {
|
|
1851
|
+
for (const docId of pack.documents) {
|
|
1852
|
+
emojiMap.set(docId.toString(), pack.emoticon);
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return {
|
|
1856
|
+
title: set.title,
|
|
1857
|
+
shortName: set.shortName,
|
|
1858
|
+
count: set.count,
|
|
1859
|
+
stickers: result.documents.map((doc) => ({
|
|
1860
|
+
id: doc.id.toString(),
|
|
1861
|
+
accessHash: doc.accessHash.toString(),
|
|
1862
|
+
emoji: emojiMap.get(doc.id.toString()) || "",
|
|
1863
|
+
})),
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
async searchStickerSets(query) {
|
|
1867
|
+
if (!this.client || !this.connected)
|
|
1868
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
1869
|
+
const result = await this.client.invoke(new Api.messages.SearchStickerSets({
|
|
1870
|
+
q: query,
|
|
1871
|
+
hash: bigInt(0),
|
|
1872
|
+
}));
|
|
1873
|
+
if (result instanceof Api.messages.FoundStickerSetsNotModified) {
|
|
1874
|
+
return [];
|
|
1875
|
+
}
|
|
1876
|
+
return result.sets.map((covered) => {
|
|
1877
|
+
const set = covered.set;
|
|
1878
|
+
return {
|
|
1879
|
+
title: set.title,
|
|
1880
|
+
shortName: set.shortName,
|
|
1881
|
+
count: set.count,
|
|
1882
|
+
};
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
async getInstalledStickerSets() {
|
|
1886
|
+
if (!this.client || !this.connected)
|
|
1887
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
1888
|
+
const result = await this.client.invoke(new Api.messages.GetAllStickers({ hash: bigInt(0) }));
|
|
1889
|
+
if (result instanceof Api.messages.AllStickersNotModified) {
|
|
1890
|
+
return [];
|
|
1891
|
+
}
|
|
1892
|
+
return result.sets.map((set) => ({
|
|
1893
|
+
title: set.title,
|
|
1894
|
+
shortName: set.shortName,
|
|
1895
|
+
count: set.count,
|
|
1896
|
+
}));
|
|
1897
|
+
}
|
|
1898
|
+
async sendSticker(chatId, stickerSetShortName, stickerIndex, replyTo) {
|
|
1899
|
+
if (!this.client || !this.connected)
|
|
1900
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
1901
|
+
return await this.rateLimiter.execute(async () => {
|
|
1902
|
+
if (!Number.isInteger(stickerIndex)) {
|
|
1903
|
+
throw new Error(`Sticker index must be an integer, got ${stickerIndex}`);
|
|
1904
|
+
}
|
|
1905
|
+
// Fetch raw sticker set to get the actual Api.Document with valid fileReference
|
|
1906
|
+
const rawResult = await this.client?.invoke(new Api.messages.GetStickerSet({
|
|
1907
|
+
stickerset: new Api.InputStickerSetShortName({ shortName: stickerSetShortName }),
|
|
1908
|
+
hash: 0,
|
|
1909
|
+
}));
|
|
1910
|
+
if (!rawResult || rawResult instanceof Api.messages.StickerSetNotModified) {
|
|
1911
|
+
throw new Error("Sticker set not found");
|
|
1912
|
+
}
|
|
1913
|
+
const stickerSet = rawResult;
|
|
1914
|
+
if (stickerIndex < 0 || stickerIndex >= stickerSet.documents.length) {
|
|
1915
|
+
throw new Error(`Sticker index ${stickerIndex} out of range (0-${stickerSet.documents.length - 1})`);
|
|
1916
|
+
}
|
|
1917
|
+
const sticker = stickerSet.documents[stickerIndex];
|
|
1918
|
+
if (!(sticker instanceof Api.Document)) {
|
|
1919
|
+
throw new Error("Selected sticker is not a valid document");
|
|
1920
|
+
}
|
|
1921
|
+
const resolved = await this.resolvePeer(chatId);
|
|
1922
|
+
return await this.client?.sendFile(resolved, {
|
|
1923
|
+
file: sticker,
|
|
1924
|
+
...(replyTo ? { replyTo } : {}),
|
|
1925
|
+
});
|
|
1926
|
+
}, `sendSticker to ${chatId}`);
|
|
1927
|
+
}
|
|
1928
|
+
async getRecentStickers() {
|
|
1929
|
+
if (!this.client || !this.connected)
|
|
1930
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
1931
|
+
const result = await this.client.invoke(new Api.messages.GetRecentStickers({ hash: bigInt(0) }));
|
|
1932
|
+
if (result instanceof Api.messages.RecentStickersNotModified) {
|
|
1933
|
+
return [];
|
|
1934
|
+
}
|
|
1935
|
+
const emojiMap = new Map();
|
|
1936
|
+
for (const pack of result.packs) {
|
|
1937
|
+
for (const docId of pack.documents) {
|
|
1938
|
+
emojiMap.set(docId.toString(), pack.emoticon);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
return result.stickers.map((doc) => ({
|
|
1942
|
+
id: doc.id.toString(),
|
|
1943
|
+
accessHash: doc.accessHash.toString(),
|
|
1944
|
+
emoji: emojiMap.get(doc.id.toString()) || "",
|
|
1945
|
+
}));
|
|
1946
|
+
}
|
|
1835
1947
|
}
|
package/dist/tools/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerExtraTools } from "./extras.js";
|
|
|
6
6
|
import { registerMediaTools } from "./media.js";
|
|
7
7
|
import { registerMessageTools } from "./messages.js";
|
|
8
8
|
import { registerReactionTools } from "./reactions.js";
|
|
9
|
+
import { registerStickerTools } from "./stickers.js";
|
|
9
10
|
export function registerTools(server, telegram) {
|
|
10
11
|
registerAuthTools(server, telegram);
|
|
11
12
|
registerMessageTools(server, telegram);
|
|
@@ -15,4 +16,5 @@ export function registerTools(server, telegram) {
|
|
|
15
16
|
registerReactionTools(server, telegram);
|
|
16
17
|
registerExtraTools(server, telegram);
|
|
17
18
|
registerAccountTools(server, telegram);
|
|
19
|
+
registerStickerTools(server, telegram);
|
|
18
20
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { fail, ok, READ_ONLY, requireConnection, sanitize, WRITE } from "./shared.js";
|
|
3
|
+
export function registerStickerTools(server, telegram) {
|
|
4
|
+
server.registerTool("telegram-get-sticker-set", {
|
|
5
|
+
description: "Get all stickers from a sticker set by its short name. Returns each sticker with index and emoji. Use the index with telegram-send-sticker to send a specific sticker",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
shortName: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("Short name of the sticker set (e.g. 'AnimatedEmojis', 'HotCherry'). Find names via telegram-search-sticker-sets or from t.me/addstickers/<shortName> links"),
|
|
10
|
+
},
|
|
11
|
+
annotations: READ_ONLY,
|
|
12
|
+
}, async ({ shortName }) => {
|
|
13
|
+
const err = await requireConnection(telegram);
|
|
14
|
+
if (err)
|
|
15
|
+
return fail(new Error(err));
|
|
16
|
+
try {
|
|
17
|
+
const set = await telegram.getStickerSet(shortName);
|
|
18
|
+
const lines = [];
|
|
19
|
+
lines.push(`📦 ${set.title} (${set.shortName})`);
|
|
20
|
+
lines.push(`${set.count} stickers`);
|
|
21
|
+
lines.push("");
|
|
22
|
+
for (let i = 0; i < set.stickers.length; i++) {
|
|
23
|
+
const s = set.stickers[i];
|
|
24
|
+
lines.push(`[${i}] ${s.emoji}`);
|
|
25
|
+
}
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push(`Send a sticker: telegram-send-sticker(chatId, stickerSet="${set.shortName}", index=N)`);
|
|
28
|
+
return ok(sanitize(lines.join("\n")));
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return fail(e);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
server.registerTool("telegram-search-sticker-sets", {
|
|
35
|
+
description: "Search for sticker sets by name or keyword. Returns matching sticker pack names that can be used with telegram-get-sticker-set",
|
|
36
|
+
inputSchema: {
|
|
37
|
+
query: z.string().describe("Search query (e.g. 'cat', 'love', 'pepe', 'anime')"),
|
|
38
|
+
},
|
|
39
|
+
annotations: READ_ONLY,
|
|
40
|
+
}, async ({ query }) => {
|
|
41
|
+
const err = await requireConnection(telegram);
|
|
42
|
+
if (err)
|
|
43
|
+
return fail(new Error(err));
|
|
44
|
+
try {
|
|
45
|
+
const sets = await telegram.searchStickerSets(query);
|
|
46
|
+
if (sets.length === 0) {
|
|
47
|
+
return ok(`No sticker sets found for "${query}". Try different keywords.`);
|
|
48
|
+
}
|
|
49
|
+
const lines = [];
|
|
50
|
+
lines.push(`Found ${sets.length} sticker set(s) for "${query}":\n`);
|
|
51
|
+
for (const set of sets) {
|
|
52
|
+
lines.push(`• ${set.title} — ${set.count} stickers`);
|
|
53
|
+
lines.push(` Short name: ${set.shortName}`);
|
|
54
|
+
}
|
|
55
|
+
lines.push("");
|
|
56
|
+
lines.push("Use telegram-get-sticker-set(shortName) to see individual stickers.");
|
|
57
|
+
return ok(sanitize(lines.join("\n")));
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return fail(e);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.registerTool("telegram-get-installed-stickers", {
|
|
64
|
+
description: "List all sticker sets installed by the user. Returns pack names and short names for use with other sticker tools",
|
|
65
|
+
inputSchema: {},
|
|
66
|
+
annotations: READ_ONLY,
|
|
67
|
+
}, async () => {
|
|
68
|
+
const err = await requireConnection(telegram);
|
|
69
|
+
if (err)
|
|
70
|
+
return fail(new Error(err));
|
|
71
|
+
try {
|
|
72
|
+
const sets = await telegram.getInstalledStickerSets();
|
|
73
|
+
if (sets.length === 0) {
|
|
74
|
+
return ok("No sticker sets installed.");
|
|
75
|
+
}
|
|
76
|
+
const lines = [];
|
|
77
|
+
lines.push(`${sets.length} installed sticker set(s):\n`);
|
|
78
|
+
for (const set of sets) {
|
|
79
|
+
lines.push(`• ${set.title} — ${set.count} stickers`);
|
|
80
|
+
lines.push(` Short name: ${set.shortName}`);
|
|
81
|
+
}
|
|
82
|
+
return ok(sanitize(lines.join("\n")));
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return fail(e);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
server.registerTool("telegram-send-sticker", {
|
|
89
|
+
description: "Send a sticker from a sticker set to a chat. First use telegram-get-sticker-set to browse available stickers and find the index",
|
|
90
|
+
inputSchema: {
|
|
91
|
+
chatId: z.string().describe("Chat ID or username"),
|
|
92
|
+
stickerSet: z.string().describe("Short name of the sticker set (e.g. 'HotCherry')"),
|
|
93
|
+
index: z
|
|
94
|
+
.number()
|
|
95
|
+
.int()
|
|
96
|
+
.nonnegative()
|
|
97
|
+
.describe("Index of the sticker in the set (0-based, get from telegram-get-sticker-set)"),
|
|
98
|
+
replyTo: z.number().int().optional().describe("Message ID to reply to"),
|
|
99
|
+
},
|
|
100
|
+
annotations: WRITE,
|
|
101
|
+
}, async ({ chatId, stickerSet, index, replyTo }) => {
|
|
102
|
+
const err = await requireConnection(telegram);
|
|
103
|
+
if (err)
|
|
104
|
+
return fail(new Error(err));
|
|
105
|
+
try {
|
|
106
|
+
await telegram.sendSticker(chatId, stickerSet, index, replyTo);
|
|
107
|
+
return ok(`Sticker sent from "${stickerSet}" [${index}] to ${chatId}`);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
return fail(e);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
server.registerTool("telegram-get-recent-stickers", {
|
|
114
|
+
description: "Get recently used stickers. Returns each sticker with its list index and associated emoji",
|
|
115
|
+
inputSchema: {},
|
|
116
|
+
annotations: READ_ONLY,
|
|
117
|
+
}, async () => {
|
|
118
|
+
const err = await requireConnection(telegram);
|
|
119
|
+
if (err)
|
|
120
|
+
return fail(new Error(err));
|
|
121
|
+
try {
|
|
122
|
+
const stickers = await telegram.getRecentStickers();
|
|
123
|
+
if (stickers.length === 0) {
|
|
124
|
+
return ok("No recent stickers.");
|
|
125
|
+
}
|
|
126
|
+
const lines = [];
|
|
127
|
+
lines.push(`${stickers.length} recent sticker(s):\n`);
|
|
128
|
+
for (let i = 0; i < stickers.length; i++) {
|
|
129
|
+
lines.push(`[${i}] ${stickers[i].emoji}`);
|
|
130
|
+
}
|
|
131
|
+
return ok(sanitize(lines.join("\n")));
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
return fail(e);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overpod/mcp-telegram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.1",
|
|
4
4
|
"description": "MCP server for Telegram userbot — messages, media, reactions, polls & more. Built on GramJS/MTProto.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"lint:fix": "biome check --fix src/",
|
|
29
29
|
"format": "biome format --write src/",
|
|
30
30
|
"test": "tsx --test src/**/*.test.ts",
|
|
31
|
-
"test:watch": "tsx --test --watch src/**/*.test.ts"
|
|
31
|
+
"test:watch": "tsx --test --watch src/**/*.test.ts",
|
|
32
|
+
"docs:dev": "vitepress dev docs",
|
|
33
|
+
"docs:build": "vitepress build docs",
|
|
34
|
+
"docs:preview": "vitepress preview docs"
|
|
32
35
|
},
|
|
33
36
|
"keywords": [
|
|
34
37
|
"mcp",
|
|
@@ -45,24 +48,25 @@
|
|
|
45
48
|
"license": "MIT",
|
|
46
49
|
"repository": {
|
|
47
50
|
"type": "git",
|
|
48
|
-
"url": "https://github.com/
|
|
51
|
+
"url": "https://github.com/mcp-telegram/mcp-telegram.git"
|
|
49
52
|
},
|
|
50
|
-
"homepage": "https://github.com/
|
|
53
|
+
"homepage": "https://github.com/mcp-telegram/mcp-telegram#readme",
|
|
51
54
|
"bugs": {
|
|
52
|
-
"url": "https://github.com/
|
|
55
|
+
"url": "https://github.com/mcp-telegram/mcp-telegram/issues"
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
58
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
56
|
-
"dotenv": "^17.
|
|
59
|
+
"dotenv": "^17.4.2",
|
|
57
60
|
"qrcode": "^1.5.4",
|
|
58
61
|
"telegram": "^2.26.22",
|
|
59
62
|
"zod": "^4.3.6"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"@biomejs/biome": "^2.4.
|
|
63
|
-
"@types/node": "^25.
|
|
65
|
+
"@biomejs/biome": "^2.4.12",
|
|
66
|
+
"@types/node": "^25.6.0",
|
|
64
67
|
"@types/qrcode": "^1.5.6",
|
|
65
68
|
"tsx": "^4.21.0",
|
|
66
|
-
"typescript": "^6.0.
|
|
69
|
+
"typescript": "^6.0.3",
|
|
70
|
+
"vitepress": "^1.6.4"
|
|
67
71
|
}
|
|
68
72
|
}
|