Telegram MCP — Watcher, Parser & Analysis
Full-featured Telegram MTProto MCP server. Connects to Telegram as a userbot and exposes message reading, sending, and parsing as MCP tools.
Features
- Userbot watcher — monitors all messages, triggers AI agent on keyword
- Chat/DM parser — paginated parsing of any chat or DM via
parse_chat.py - Context builders — stats, top words, LLM summaries, people profiles
- Criminal analysis — detects CSAM, fraud, NCA violations, hate speech
- Personality profiling — psychological portrait from message history
Setup
cp .env.example .env
# Fill in API_ID, API_HASH, SESSION_NAME, OWNER_ID from https://my.telegram.org/apps
pip install -r requirements.txt
python3 session_string_generator.py # authorize session onceRun watcher as systemd service
sudo cp tg-watcher.service /etc/systemd/system/
sudo systemctl enable --now tg-watcherMCP Tools (via mcporter)
send_message— send message to chatreply_to_message— reply to specific messageiter_all_messages— paginated message fetchiter_messages_by_user— messages from specific user- and 90+ more Telegram API methods
Important notes
See CLAUDE.md for full list of gotchas. Key ones:
- Use
\nnot<br>in HTML messages iter_all_messagesfor DMs, notlist_messages- Semaphore required for parallel agent calls
Source
GitHub: https://github.com/SkrudjReal/telegram-mcp