
Telegram MCP Server
A Model Context Protocol server that enables Claude to interact with Telegram channels and groups through both direct API access and web scraping methods.
README
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
📋 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-server
- Install dependencies:
npm install
- Copy the example environment file:
cp .env.example .env
-
Edit
.env
and add your configuration:- For API mode: Add your
TELEGRAM_API_ID
andTELEGRAM_API_HASH
- For web scraping: Default settings work out of the box
- For API mode: Add your
-
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_id
andapi_hash
to the.env
file
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 Telegram
-
api_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=50
-
api_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-data
- macOS:
~/Library/Application Support/telegram-mcp-data
- Linux:
~/.config/telegram-mcp-data
You can override this with the TELEGRAM_DATA_PATH
environment variable.
🛡️ Security Notes
- Never commit your
.env
file - it contains sensitive API credentials - API credentials are personal - each user needs their own
- Session files contain authentication data - keep them secure
- Use the
.gitignore
file 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:
- Model Context Protocol SDK
- GramJS - Telegram client library
- Puppeteer - Browser automation
⚠️ 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_login
first - Phone 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_TIMEOUT
in.env
📞 Support
- Create an issue on GitHub for bugs
- Check existing issues before creating new ones
- Include error messages and logs when reporting issues
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。