telegram-mcp-server
Enables interaction with Telegram channels and groups, providing tools for scraping posts (with optional limits), searching channel content, and authenticating to access private channels via API or web scraping.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@telegram-mcp-server scrape the latest 10 posts from https://t.me/technews"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Telegram MCP Server
A powerful MCP (Model Context Protocol) server that enables Claude to interact with Telegram channels and groups. This server provides both web scraping and direct API access to Telegram content.
🚀 Features
Version 0.3.0 - Dual Mode Operation
API Mode (Recommended) ⚡
100x faster than web scraping
Direct access via Telegram's MTProto protocol
Search functionality within channels
Access to private channels you're a member of
Complete message metadata (views, reactions, forwards)
Persistent sessions - authenticate once
No browser automation needed
Unlimited post retrieval by default
Web Scraping Mode 🌐
No API credentials required
Browser-based scraping with Puppeteer
Authentication support for restricted content
Visual media extraction
Suitable for quick, anonymous access
Related MCP server: Telegram MCP Server
📋 Prerequisites
Node.js 18.0.0 or higher
Chrome/Chromium (for web scraping mode)
Telegram API credentials (for API mode) - Get them here
🛠️ Installation
Clone this repository:
git clone https://github.com/DLHellMe/telegram-mcp-server.git
cd telegram-mcp-serverInstall dependencies:
npm installCopy the example environment file:
cp .env.example .envEdit
.envand add your configuration:For API mode: Add your
TELEGRAM_API_IDandTELEGRAM_API_HASHFor web scraping: Default settings work out of the box
Build the project:
npm run build🔧 Configuration
Getting Telegram API Credentials
Go to https://my.telegram.org
Log in with your phone number
Click "API development tools"
Create a new application
Copy your
api_idandapi_hashto the.envfile
Claude Desktop Configuration
Add this to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"telegram-scraper": {
"command": "node",
"args": ["/absolute/path/to/telegram-mcp-server/dist/index.js"],
"env": {
"TELEGRAM_API_ID": "your_api_id",
"TELEGRAM_API_HASH": "your_api_hash"
}
}
}
}📖 Usage
After configuration, restart Claude Desktop. The Telegram tools will be available in Claude.
API Mode Tools
telegram_api_login - Authenticate with Telegram (first time only)
Use telegram_api_login to connect to Telegramapi_scrape_channel - Scrape channel posts (unlimited by default)
Use api_scrape_channel with url="https://t.me/channelname"Or with a limit:
Use api_scrape_channel with url="https://t.me/channelname" and max_posts=50api_search_channel - Search within a channel
Use api_search_channel with url="https://t.me/channelname" and query="keyword"
Web Scraping Tools
scrape_channel - Scrape public channels
Use scrape_channel with url="https://t.me/channelname"telegram_login - Login for restricted content
Use telegram_login with phone="+1234567890"
🔒 Data Storage
Session data and cookies are stored in platform-specific directories:
Windows:
%APPDATA%\telegram-mcp-datamacOS:
~/Library/Application Support/telegram-mcp-dataLinux:
~/.config/telegram-mcp-data
You can override this with the TELEGRAM_DATA_PATH environment variable.
🛡️ Security Notes
Never commit your
.envfile - it contains sensitive API credentialsAPI credentials are personal - each user needs their own
Session files contain authentication data - keep them secure
Use the
.gitignorefile to prevent accidental commits
📝 Development
# Run in development mode
npm run dev
# Build the project
npm run build
# Watch for changes
npm run watch🤝 Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Submit a pull request
📄 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
Built with:
⚠️ Disclaimer
This tool is for educational and research purposes. Please respect Telegram's Terms of Service and the privacy of channel members. Always obtain permission before scraping private channels.
🐛 Troubleshooting
API Mode Issues
"Not connected to Telegram API": Run
telegram_api_loginfirstPhone number format: Include country code (e.g., +1234567890)
2FA errors: Enter your 2FA password when prompted
Web Scraping Issues
"No Chrome binary found": Install Chrome or Chromium
Login issues: Ensure you're using the correct phone format
Timeout errors: Increase
BROWSER_TIMEOUTin.env
📞 Support
Create an issue on GitHub for bugs
Check existing issues before creating new ones
Include error messages and logs when reporting issues
Available Tools
15 toolsapi_get_channel_infoC
Get detailed information about a Telegram channel using the API
Inputs: url (required).
api_logoutB
Disconnect from Telegram API
Inputs: no named parameters.
api_scrape_channelC
Scrape a Telegram channel using the API (fast and efficient)
Inputs: url (required), date_to, date_from, max_posts.
api_search_channelC
Search for messages within a Telegram channel
Inputs: url (required), query (required), limit.
get_channel_infoA
Get only the channel/group information without scraping posts. Uses authenticated session if logged in.
Inputs: url (required).
scrape_channelB
Scrape a Telegram channel and return posts in markdown format. Uses authenticated session if logged in.
Inputs: url (required), max_posts, include_reactions.
scrape_channel_authenticatedB
Scrape a Telegram channel using authenticated session (can access restricted content)
Inputs: url (required), max_posts.
scrape_channel_fullA
Scrape ALL posts from a Telegram channel and save to file. Uses authenticated session if logged in. Returns file location.
Inputs: url (required), save_to_file.
scrape_date_rangeB
Scrape posts within a specific date range. Uses authenticated session if logged in.
Inputs: url (required), date_from (required), date_to.
scrape_groupB
Scrape a Telegram group and return posts in markdown format. Uses authenticated session if logged in.
Inputs: url (required), max_posts.
scrape_manualA
Manual scraping mode: Opens browser for you to login and navigate to any channel, then scrapes it
Inputs: limit, save_to_file.
telegram_api_loginC
Login to Telegram using API credentials for fast, efficient scraping
Inputs: api_id, api_hash.
telegram_auth_statusB
Check if authenticated with Telegram
Inputs: no named parameters.
telegram_loginC
Authenticate with Telegram Web to access restricted content
Inputs: phone_number.
telegram_logoutB
Clear Telegram authentication cookies
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Multiple tools overlap in purpose (scrape_channel, scrape_channel_authenticated, api_scrape_channel) but descriptions differentiate by authentication method. Still, an agent may struggle to choose the right one at a glance.
Naming is inconsistent: snake_case verbs (scrape_channel) mixed with prefixed styles (telegram_login, api_scrape_channel). No uniform verb_noun pattern across the suite.
15 tools is on the higher end but acceptable for the range of authentication methods and scraping modes. Each tool adds some functionality, though redundancy inflates the count.
Covers channel/group scraping, date ranges, full exports, search, info retrieval, and authentication. Minor gaps like batch operations or message sending are outside the core scraping purpose.
Maintenance
Related MCP Connectors
Your Telegram, WhatsApp, Instagram, mail and calendar in Claude or ChatGPT. Never sends messages.
Telegram for AI agents, no login: keyword search, channel posts, comments, username lookup.
Live Telegram data: trending topics, channel profiles & metrics, post history incl. edits/deletions.
Let AI assistants post to your Telegram chats, groups and channels. Not affiliated with Telegram.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables Claude to interact with Telegram channels and groups through both direct API access and web scraping methods.1538 npm31MIT
- FlicenseNot gradedqualityFmaintenanceEnables Claude to interact with your Telegram account, including reading messages, searching conversations, and sending messages.-
- AlicenseAqualityDmaintenanceEnables reading and searching Telegram channel/group/DM messages from Claude Code using MTProto for full message history access.538 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with Telegram, including listing chats, reading messages, sending messages, searching, and managing contacts.1-