ttm-telegram
Allows reading messages from Telegram groups using your own Telegram account, including listing allowed groups, retrieving group messages within a date range, and searching group messages by keyword. Access is restricted to groups configured in ALLOWED_GROUP_IDS.
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., "@ttm-telegram Search the product group for messages about the launch date"
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.
ttm-telegram
MCP server đọc tin nhắn nhóm Telegram bằng tài khoản Telegram của chính bạn. Chạy trên máy bạn. Dữ liệu đi thẳng từ máy bạn tới Telegram, không qua dịch vụ nào khác.
Công cụ (3 tool)
Tool | Làm gì |
| Liệt kê nhóm được phép đọc (theo |
| Đọc tin nhắn chữ của một nhóm trong khoảng ngày ( |
| Tìm tin nhắn trong nhóm theo từ khóa, tối đa 200 kết quả |
Related MCP server: Telegram OSINT
Trước khi cài
Lấy API id và API hash tại https://my.telegram.org, đăng nhập bằng số điện thoại Telegram của bạn, mục API development tools.
Cài nhanh (khuyến nghị, không cần Python)
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/toantranmei/ttm-telegram/main/install.sh | shWindows (PowerShell)
irm https://raw.githubusercontent.com/toantranmei/ttm-telegram/main/install.ps1 | iexBước 1 – Đăng nhập một lần để tạo session
Trên macOS/Linux:
TELEGRAM_API_ID=<id> TELEGRAM_API_HASH=<hash> "$HOME/.local/bin/ttm-telegram" loginTrên Windows:
$env:TELEGRAM_API_ID="<id>"; $env:TELEGRAM_API_HASH="<hash>"; & "$env:LOCALAPPDATA\ttm\bin\ttm-telegram.exe" loginLần đầu Telegram sẽ gửi mã xác nhận tới bạn. Sau khi đăng nhập, lệnh in ra danh sách nhóm kèm Group ID. Ghi lại ID các nhóm bạn muốn cho phép đọc.
Session lưu tại ~/.ttm-telegram/session.session (trên Windows là %USERPROFILE%\.ttm-telegram\). Đây là chìa khóa tài khoản của bạn: không chia sẻ, không commit.
Bước 2 – Đăng ký với Claude Code
claude mcp add ttm-telegram \
-e TELEGRAM_API_ID=<id> \
-e TELEGRAM_API_HASH=<hash> \
-e ALLOWED_GROUP_IDS=-1001234567890 \
-- "$HOME/.local/bin/ttm-telegram"Claude Desktop (không dùng terminal)
Tải file ttm-telegram-*.mcpb mới nhất ở trang Releases, nhấp đúp để cài, rồi điền API id, API hash và group_id được phép đọc trong giao diện. Bước đăng nhập một lần (Bước 1 ở trên) vẫn cần chạy trong terminal một lần.
Cài bằng Python (tùy chọn)
Nếu bạn đã có uv: uvx ttm-telegram (sau khi có gói PyPI). Bước đăng nhập: uvx --from ttm-telegram ttm-telegram login.
Biến môi trường
Biến | Bắt buộc | Mặc định | Mô tả |
| có | — | API id từ my.telegram.org |
| có | — | API hash từ my.telegram.org |
| không |
| Đường dẫn file session (không kèm |
| không | (trống) |
|
| không |
| Múi giờ để tính khoảng ngày và hiển thị thời gian |
Quyền riêng tư và trách nhiệm
Server chỉ đọc các nhóm nằm trong
ALLOWED_GROUP_IDS. Mặc định không đọc nhóm nào.Tin nhắn được trả về cho AI client bạn đang dùng. Cân nhắc trước khi cho AI đọc nhóm có thông tin nhạy cảm.
Tài khoản Telegram là của bạn. Bạn tự chịu trách nhiệm tuân thủ điều khoản của Telegram và quyền riêng tư của thành viên nhóm.
Không có chế độ http, không mở cổng mạng.
Phát triển
git clone https://github.com/toantranmei/ttm-telegram && cd ttm-telegram
uv run --with-editable . ttm-telegram # chạy stdio
packaging/build.sh ttm-telegram darwin-arm64 # dựng binary + archive trong dist/release/Phát hành: đẩy tag v* để GitHub Actions dựng binary cho 4 nền tảng, đóng gói .mcpb và tạo Release.
Giấy phép
MIT. Xem LICENSE.
Available Tools
3 toolsget_messagesGet MessagesB
Đọc tin nhắn chữ của một nhóm trong khoảng ngày.
start_date, end_date: YYYY-MM-DD, tính theo múi giờ TELEGRAM_TZ (mặc định Asia/Ho_Chi_Minh). limit: tối đa 1000.
Inputs: end_date (required), group_id (required), start_date (required), limit. Returns: object
list_groupsList GroupsA
Danh sách nhóm Telegram được phép đọc (theo ALLOWED_GROUP_IDS).
Inputs: no named parameters. Returns: result
search_messagesSearch MessagesC
Tìm tin nhắn trong nhóm theo từ khóa. limit tối đa 200.
Inputs: keyword (required), group_id (required), limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
list_groups is clearly separate from the two message readers, and get_messages (date range) vs search_messages (keyword) have documented boundaries. There is still some overlap since both message tools return messages from a group and could be confused when a search is meant to be limited by time.
All three names follow the same snake_case verb_noun pattern: list_groups, get_messages, search_messages. Verbs are distinct and semantically meaningful.
Three tools is tightly scoped for a read-only Telegram group reader and each one covers a necessary operation: enumerate access, fetch by window, and keyword lookup. Nothing appears redundant or missing at the count level.
Core read workflows (discover allowed groups, pull messages for a date range, search keywords) are covered with no dead ends for the stated read-only purpose. Minor gaps exist: text-only messages with no media or sender metadata retrieval, and no fetch-by-message-id, but these are workaroundable within the domain.
Maintenance
Related MCP Connectors
Your personal Telegram account for AI: read, search and sum up chats. QR login, no API key.
Search 1.7M+ Telegram channels, 250k+ chats, 228k+ bots, and what chats ask for. No key, no install.
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
I use your linked Telegram MTProto session (Integrations → Telegram) to list groups, members, and s…
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA read-only Telegram MCP server that only exposes a user-defined allowlist of chats, providing tools to list chats, fetch messages, search, and get context while stripping untrusted text and with no write capabilities.MIT
- AlicenseAqualityBmaintenanceEnables an AI assistant to read and search the user's own Telegram account chats through a local server with no write operations. It also runs a background watcher that pre-filters incoming messages with substring, word, or regex rules and, optionally, has Claude judge each hit against plain-language criteria to surface only the alerts that matter.20MIT
- AlicenseBqualityCmaintenanceLets coding agents browse a personal Telegram account locally, retrieving per-chat text history and conversations or outgoing messages by date via QR login, read-only unless message sending is explicitly enabled. API credentials from Telegram are required, and access can be restricted to specific numeric chat IDs.3MIT
- AlicenseAqualityBmaintenanceRead chats, search messages and check members on your own Telegram account over MTProto. Any change is a typed plan a person applies from the terminal; no tool sends by itself.2133 PyPIMIT