telegram-claude-mcp 1.0.0 → 1.0.2

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/bin/run.js CHANGED
@@ -2,12 +2,24 @@
2
2
  import { spawn } from 'node:child_process';
3
3
  import { dirname, join } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
+ import { createRequire } from 'node:module';
5
6
 
6
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const require = createRequire(import.meta.url);
9
+
10
+ // Find tsx executable - works both locally and when installed via npx
11
+ let tsxPath;
12
+ try {
13
+ const tsxPkg = require.resolve('tsx/package.json');
14
+ tsxPath = join(dirname(tsxPkg), 'dist', 'cli.mjs');
15
+ } catch {
16
+ // Fallback to node_modules/.bin
17
+ tsxPath = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
18
+ }
19
+
7
20
  const srcPath = join(__dirname, '..', 'src', 'index.ts');
8
- const tsxPath = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
9
21
 
10
- const child = spawn(tsxPath, [srcPath], {
22
+ const child = spawn('node', [tsxPath, srcPath], {
11
23
  stdio: 'inherit',
12
24
  env: process.env,
13
25
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-claude-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server that lets Claude message you on Telegram",
5
5
  "author": "Geravant",
6
6
  "license": "MIT",
package/src/telegram.ts CHANGED
@@ -167,10 +167,12 @@ export class TelegramManager {
167
167
  }
168
168
 
169
169
  const text = msg.text || '';
170
+ console.error(`[${this.config.sessionName}] Received message: "${text}" (pending: ${this.pendingResponses.size})`);
170
171
 
171
172
  // Check if this is a reply to one of our messages
172
173
  if (msg.reply_to_message) {
173
174
  const replyToId = msg.reply_to_message.message_id;
175
+ console.error(`[${this.config.sessionName}] Is reply to message ${replyToId}, isOurs: ${this.isOurMessage(replyToId)}`);
174
176
  if (this.isOurMessage(replyToId)) {
175
177
  this.resolveResponse(text);
176
178
  return;
@@ -181,13 +183,17 @@ export class TelegramManager {
181
183
  const sessionPrefix = `@${this.config.sessionName}`;
182
184
  if (text.toLowerCase().startsWith(sessionPrefix.toLowerCase())) {
183
185
  const response = text.slice(sessionPrefix.length).trim();
186
+ console.error(`[${this.config.sessionName}] Matched session prefix, resolving with: "${response}"`);
184
187
  this.resolveResponse(response);
185
188
  return;
186
189
  }
187
190
 
188
191
  // Check if we're the most recent waiting session
189
192
  if (this.isWaitingAndMostRecent()) {
193
+ console.error(`[${this.config.sessionName}] Is most recent waiting, resolving with: "${text}"`);
190
194
  this.resolveResponse(text);
195
+ } else {
196
+ console.error(`[${this.config.sessionName}] Not the most recent waiting session, ignoring`);
191
197
  }
192
198
  });
193
199