@overpod/mcp-telegram 1.13.0 → 1.14.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/README.md CHANGED
@@ -90,6 +90,32 @@ claude mcp add telegram-personal -s user \
90
90
 
91
91
  Each account gets its own session file — no conflicts.
92
92
 
93
+ ### Proxy Support
94
+
95
+ If Telegram is blocked or you're running in a containerized environment (Docker, K3s), use a SOCKS5 or MTProxy:
96
+
97
+ ```bash
98
+ # SOCKS5 proxy
99
+ TELEGRAM_PROXY_IP=127.0.0.1 \
100
+ TELEGRAM_PROXY_PORT=10808 \
101
+ npx @overpod/mcp-telegram
102
+
103
+ # MTProxy
104
+ TELEGRAM_PROXY_IP=proxy.example.com \
105
+ TELEGRAM_PROXY_PORT=443 \
106
+ TELEGRAM_PROXY_SECRET=ee00000000000000000000000000000000 \
107
+ npx @overpod/mcp-telegram
108
+ ```
109
+
110
+ | Variable | Description |
111
+ |----------|-------------|
112
+ | `TELEGRAM_PROXY_IP` | Proxy server address |
113
+ | `TELEGRAM_PROXY_PORT` | Proxy server port |
114
+ | `TELEGRAM_PROXY_SOCKS_TYPE` | `4` or `5` (default: `5`) |
115
+ | `TELEGRAM_PROXY_SECRET` | MTProxy secret (enables MTProxy mode) |
116
+ | `TELEGRAM_PROXY_USERNAME` | Optional proxy auth |
117
+ | `TELEGRAM_PROXY_PASSWORD` | Optional proxy auth |
118
+
93
119
  ## Installation Options
94
120
 
95
121
  ### npx (recommended, zero install)
@@ -17,6 +17,24 @@ const MIN_SESSION_LENGTH = 100;
17
17
  function resolveSessionPath(sessionPath) {
18
18
  return sessionPath ?? process.env.TELEGRAM_SESSION_PATH ?? DEFAULT_SESSION_FILE;
19
19
  }
20
+ function resolveProxy() {
21
+ const ip = process.env.TELEGRAM_PROXY_IP;
22
+ const port = process.env.TELEGRAM_PROXY_PORT;
23
+ if (!ip || !port)
24
+ return undefined;
25
+ const secret = process.env.TELEGRAM_PROXY_SECRET;
26
+ if (secret) {
27
+ return { ip, port: Number(port), secret, MTProxy: true };
28
+ }
29
+ const socksType = Number(process.env.TELEGRAM_PROXY_SOCKS_TYPE || "5");
30
+ return {
31
+ ip,
32
+ port: Number(port),
33
+ socksType: socksType,
34
+ ...(process.env.TELEGRAM_PROXY_USERNAME && { username: process.env.TELEGRAM_PROXY_USERNAME }),
35
+ ...(process.env.TELEGRAM_PROXY_PASSWORD && { password: process.env.TELEGRAM_PROXY_PASSWORD }),
36
+ };
37
+ }
20
38
  function ensureSessionDir(filePath) {
21
39
  const dir = dirname(filePath);
22
40
  if (!existsSync(dir)) {
@@ -96,8 +114,10 @@ export class TelegramService {
96
114
  return false;
97
115
  }
98
116
  const session = new StringSession(this.sessionString);
117
+ const proxy = resolveProxy();
99
118
  this.client = new TelegramClient(session, this.apiId, this.apiHash, {
100
119
  connectionRetries: 5,
120
+ ...(proxy && { proxy }),
101
121
  });
102
122
  try {
103
123
  await this.client.connect();
@@ -183,8 +203,10 @@ export class TelegramService {
183
203
  }
184
204
  async startQrLogin(onQrDataUrl, onQrUrl) {
185
205
  const session = new StringSession("");
206
+ const proxy = resolveProxy();
186
207
  const client = new TelegramClient(session, this.apiId, this.apiHash, {
187
208
  connectionRetries: 5,
209
+ ...(proxy && { proxy }),
188
210
  });
189
211
  try {
190
212
  await client.connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overpod/mcp-telegram",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
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",