telegram-mcp-local-server 1.0.2 → 1.0.3

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
@@ -23,17 +23,12 @@ This server runs **entirely on your local machine** and acts as a bridge between
23
23
 
24
24
  ## Getting Credentials
25
25
 
26
- ### Step 1: Get Telegram API Keys
27
-
28
- 1. Go to https://my.telegram.org/
29
- 2. Log in with your Telegram account
30
- 3. Navigate to "API development tools"
31
- 4. Create a new application to get your `api_id` and `api_hash`
32
-
33
- ### Step 2: Generate Session String
26
+ ### Option 1: Use configuration tool
34
27
 
35
28
  Use the built-in session helper without downloading the repository:
36
29
 
30
+ Type in console:
31
+
37
32
  ```bash
38
33
  npx telegram-mcp-local-server --session
39
34
  ```
@@ -43,11 +38,9 @@ Follow the prompts:
43
38
  2. Enter your phone number
44
39
  3. Enter the verification code from SMS
45
40
  4. Enter your 2FA password if enabled
46
- 5. Copy the generated session string
47
-
48
- ## Configuration for Cursor
41
+ 5. Copy the generated JSON to your configs
49
42
 
50
- Add this to your Cursor MCP configuration:
43
+ #### Generated configuration example:
51
44
 
52
45
  ```json
53
46
  {
@@ -66,27 +59,22 @@ Add this to your Cursor MCP configuration:
66
59
  }
67
60
  ```
68
61
 
62
+ ### Option 2: Generate Session String manually and fill configuration
63
+
64
+ 1. Go to https://my.telegram.org/
65
+ 2. Log in with your Telegram account
66
+ 3. Navigate to "API development tools"
67
+ 4. Create a new application to get your `api_id` and `api_hash`
68
+
69
69
  **Note:** Keep `TELEGRAM_READONLY_MODE=true` for safe operation. This allows reading chats and message history but prevents sending messages.
70
70
 
71
71
  ## Available Tools
72
72
 
73
73
  - `telegram_connect` - Connect to Telegram
74
- - `telegram_get_chats` - Get list of your chats
74
+ - `telegram_get_chats` - Get a list of your chats
75
75
  - `telegram_get_chat_history` - Read message history from specific chats
76
76
  - `telegram_send_message` - Send messages (disabled in readonly mode)
77
77
 
78
- ## Quick Test
79
-
80
- Test your setup:
81
-
82
- ```bash
83
- # Test connection and basic functionality
84
- npx telegram-mcp-local-server --help
85
-
86
- # Generate new session if needed
87
- npx telegram-mcp-local-server --session
88
- ```
89
-
90
78
  ## License
91
79
 
92
80
  MIT - Your data, your control.
@@ -1 +1 @@
1
- {"version":3,"file":"session-helper.d.ts","sourceRoot":"","sources":["../src/session-helper.ts"],"names":[],"mappings":";AAiBA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyCnC;AAMD,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"session-helper.d.ts","sourceRoot":"","sources":["../src/session-helper.ts"],"names":[],"mappings":";AAiBA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAsEnC;AAMD,eAAe,IAAI,CAAC"}
@@ -15,6 +15,8 @@ async function main() {
15
15
  console.log('=== Telegram Session Helper ===\n');
16
16
  console.log('This utility will help you generate a session string for the MCP server.');
17
17
  console.log('You will need API keys from https://my.telegram.org/\n');
18
+ console.log('Open https://my.telegram.org/\n');
19
+ console.log('Navigate "API development tools" section\n');
18
20
  try {
19
21
  const apiId = await question('Enter your API ID: ');
20
22
  const apiHash = await question('Enter your API Hash: ');
@@ -26,17 +28,40 @@ async function main() {
26
28
  await client.start({
27
29
  phoneNumber: async () => await question('Enter your phone number (with country code): '),
28
30
  password: async () => await question('Enter your 2FA password: '),
29
- phoneCode: async () => await question('Enter the verification code from SMS: '),
31
+ phoneCode: async () => await question('Enter the verification code from SMS or Telegram: '),
30
32
  onError: (err) => console.error('Error:', err),
31
33
  });
32
34
  console.log('\nāœ… Successfully connected to Telegram!');
33
35
  const sessionString = client.session.save();
34
- console.log('\nšŸ”‘ Your session string:');
35
- console.log(`"${sessionString}"`);
36
- console.log('\nšŸ“ Use this session string in the TELEGRAM_SESSION_STRING environment variable');
37
- console.log('āš ļø Keep this string secure and do not share it with others!');
38
- console.log('\nšŸ“‹ Example usage:');
39
- console.log('TELEGRAM_SESSION_STRING="' + sessionString + '" npx telegram-mcp-local-server');
36
+ console.log('\nšŸ”‘ Session string generated successfully!');
37
+ console.log('āš ļø Keep this configuration secure and do not share it with others!');
38
+ console.log('\nšŸ“ Alternative: Environment variables setup');
39
+ console.log(`TELEGRAM_API_ID="${apiId}"`);
40
+ console.log(`TELEGRAM_API_HASH="${apiHash}"`);
41
+ console.log(`TELEGRAM_SESSION_STRING="${sessionString}"`);
42
+ // Generate MCP configuration JSON
43
+ const mcpConfig = {
44
+ mcpServers: {
45
+ telegram: {
46
+ command: "npx",
47
+ args: ["telegram-mcp-local-server"],
48
+ env: {
49
+ TELEGRAM_API_ID: apiId,
50
+ TELEGRAM_API_HASH: apiHash,
51
+ TELEGRAM_SESSION_STRING: sessionString,
52
+ TELEGRAM_READONLY_MODE: true
53
+ }
54
+ }
55
+ }
56
+ };
57
+ console.log('\nšŸ“‹ Copy this JSON configuration for your MCP client:');
58
+ console.log('='.repeat(60));
59
+ console.log(JSON.stringify(mcpConfig, null, 2));
60
+ console.log('='.repeat(60));
61
+ console.log('\nšŸ’” Usage instructions:');
62
+ console.log('1. Copy the JSON configuration above to your MCP client settings');
63
+ console.log('2. Or set the environment variables and run: npx telegram-mcp-local-server');
64
+ console.log('3. The server supports readonly mode with: TELEGRAM_READONLY_MODE=true');
40
65
  await client.disconnect();
41
66
  }
42
67
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"session-helper.js","sourceRoot":"","sources":["../src/session-helper.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;IAClC,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC;AAEH,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,IAA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AC,UAAU,EAAE,CAAC;IAE5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,IAAI,EAAE,CAAC;AACT,CAAC;AAED,eAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-mcp-local-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Secure Model Context Protocol (MCP) server for Telegram integration. Runs locally, allows AI agents to read chats and message history, with built-in readonly mode for safety.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -21,11 +21,20 @@
21
21
  "session": "tsx src/session-helper.ts",
22
22
  "test-readonly": "TELEGRAM_READONLY_MODE=true npm test",
23
23
  "prepublishOnly": "npm run build",
24
- "version:patch": "node scripts/bump-version.js patch",
25
- "version:minor": "node scripts/bump-version.js minor",
26
- "version:major": "node scripts/bump-version.js major"
24
+ "version:patch": "tsx scripts/bump-version.ts patch",
25
+ "version:minor": "tsx scripts/bump-version.ts minor",
26
+ "version:major": "tsx scripts/bump-version.ts major"
27
27
  },
28
- "keywords": ["mcp", "telegram", "server", "model-context-protocol", "ai", "llm", "chat", "messaging"],
28
+ "keywords": [
29
+ "mcp",
30
+ "telegram",
31
+ "server",
32
+ "model-context-protocol",
33
+ "ai",
34
+ "llm",
35
+ "chat",
36
+ "messaging"
37
+ ],
29
38
  "author": "Your Name <your.email@example.com>",
30
39
  "license": "MIT",
31
40
  "repository": {
@@ -36,7 +45,6 @@
36
45
  "bugs": {
37
46
  "url": "https://github.com/yourusername/telegram-mcp-local-server/issues"
38
47
  },
39
-
40
48
  "dependencies": {
41
49
  "@modelcontextprotocol/sdk": "^0.5.0",
42
50
  "telegram": "^2.24.10",
@@ -50,4 +58,4 @@
50
58
  "@types/jest": "^29.5.8",
51
59
  "ts-jest": "^29.1.1"
52
60
  }
53
- }
61
+ }