get_chat_stats
Get statistics for a specific Telegram chat
Read an archived Telegram export chat by chat: paginated messages, one specific date in a chosen timezone, pinned messages, forum topics, keyword search and per-chat statistics.
LABSCO SUMMARY
Every tool takes a chat_id and returns what has already been archived — messages, pins, topics, statistics — with no write path and no live connection anywhere in the set. Search is scoped to one chat rather than across the archive, so finding a remark means knowing which conversation it was in, which is what list_chats and list_folders are for. That refresh_stats exists as its own tool tells you the global statistics are held rather than recomputed on every read.
A reader over an archived Telegram export: chats and folders, forum topics, messages by page or by date, keyword search and statistics.
A Telegram archive on the host for it to read, since every tool reads what was already archived rather than fetching from Telegram. A chat_id for everything except the listing tools — list_chats is where those come from. The project is licensed GPL-3.0, which constrains how anything built on it may be redistributed.
One command plus credentials — npx telegram-archive-mcp, then supply credentials
USE CASES
Search is scoped to one chat at a time, so the chat listing comes first — it returns the ids, names and types every other tool needs, with folders grouping them the way Telegram did.
Messages come back by date in a chosen timezone, which matters when the archive spans people in different ones, and forum topics separate the threads that ran in parallel that day.
Per-chat statistics answer the shape of a conversation, and the pinned messages usually carry what the group decided rather than what it discussed. Global statistics are held rather than recomputed, so they can be refreshed on demand.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
get_chat_statsGet statistics for a specific Telegram chat
get_messagesGet messages from a Telegram chat with pagination
get_messages_by_dateGet messages from a Telegram chat on a specific date
get_pinned_messagesGet pinned messages from a Telegram chat
get_topicsGet topics (forum threads) from a Telegram chat
list_chatsList all archived Telegram chats with their IDs, names, and types. Use this first to discover chat_id values needed by other tools.
list_foldersList all Telegram chat folders
refresh_statsForce recalculation of global telegram-archive statistics
search_messagesSearch messages in a Telegram chat by keyword
BEFORE YOU INSTALL
9 tools when we connected. list_chats and list_folders are callable tools, though the documentation presents chats and folders only as read-only resources.
TELEGRAM_ARCHIVE_PASS in your environment
CONTEXT COST
Rated by the size of the 9 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npx telegram-archive-mcpnpm install -g telegram-archive-mcp
telegram-archive-mcpPut your Telegram-Archive login into TELEGRAM_ARCHIVE_USER and TELEGRAM_ARCHIVE_PASS, save the compose file as docker-compose.yml next to your Telegram-Archive instance, and start it with docker compose up -d
The server then answers on 127.0.0.1:8080 at its single /mcp endpoint; point an MCP client that connects over HTTP at:
http://127.0.0.1:8080/mcpservices:
telegram-archive-mcp:
image: drumsergio/telegram-archive-mcp:latest
ports:
- "127.0.0.1:8080:8080"
environment:
- TELEGRAM_ARCHIVE_URL=http://telegram-archive:3000
- TELEGRAM_ARCHIVE_USER=<YOUR_TELEGRAM_ARCHIVE_USER>
- TELEGRAM_ARCHIVE_PASS=<YOUR_TELEGRAM_ARCHIVE_PASS>