Labsco
Prgebish logo

mcp-telegram

โ˜… 1

from Prgebish

Telegram MCP server using User API (MTProto) with default-deny ACL, granular per-chat permissions, file sending, media downloads, and rate limiting

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

mcp-telegram

An MCP server that connects AI assistants like Claude to your real Telegram account via the User API (MTProto). Not a bot โ€” Claude reads and sends messages as you.

Built with gotd/td and the official MCP Go SDK.

Telegram API Terms of Service: This project uses the Telegram User API. You must obtain your own api_id and api_hash from my.telegram.org and comply with the Telegram API Terms of Service. Misuse of the User API (spam, bulk messaging, scraping) may result in your account being banned. You are solely responsible for how you use this tool.

Contents


Features

ToolWhat it doesRequired permission
tg_meReturns current account infoโ€”
tg_dialogsLists dialogs visible to the ACL whitelistโ€”
tg_historyFetches message history with pagination, date filtering, and media downloadread
tg_searchSearches messages in a chat by text query, with optional sender filterread
tg_sendSends a text message or file, with optional reply-tosend
tg_forwardForwards messages from one chat to anotherread + send
tg_draftSaves a draft message (does not send)draft
tg_mark_readMarks a chat as readmark_read

Additional capabilities:

  • File and photo sending
  • Forward messages between chats
  • Reply to specific messages
  • Download photos and documents from message history
  • Filter history by date range (since / until)
  • Typed peer references (user:ID, chat:ID, channel:ID) to prevent ID collisions
  • Lazy peer resolution โ€” avoids FLOOD_WAIT errors at startup
  • Global rate limiting at the RPC level

What you can do with it

Once connected, you can ask your AI assistant things like:

Catch up on messages

  • "Check my unread Telegram messages and give me a summary"
  • "What did @alice write in the last 24 hours?"
  • "Show me messages from the Dev Team chat since Monday"

Reply and communicate

  • "Draft a response to the last message from @bob โ€” don't send it yet"
  • "Send 'sounds good, let's meet at 3pm' to @alice"
  • "Reply to message 1234 in the project chat with my feedback"

Manage your inbox

  • "Mark all read in the news channel"
  • "Which of my whitelisted chats have unread messages?"
  • "Download the photos from today's messages in the design chat"

Research and analyze

  • "Find all messages mentioning the deployment in the last week"
  • "Summarize the discussion in the team chat from yesterday"
  • "What files were shared in the project channel this month?"

How it compares to chaindead/telegram-mcp

mcp-telegramchaindead/telegram-mcp
Access controlDefault-deny ACL whitelist with granular per-chat permissionsFull access to all chats
Peer addressingTyped references (user:ID, chat:ID, channel:ID)Numeric IDs only (collision-prone)
ConfigurationYAML config with environment variable expansionCLI flags
Startup safetyLazy peer resolution (no bulk API calls)Eager resolution (FLOOD_WAIT risk)
Rate limitingBuilt-in token bucket middlewareNone
File supportSend files, photos; download media from historyText only
Reply supportYesNo
Date filteringYesNo

Security

  • Default-deny ACL โ€” no chat is accessible unless explicitly whitelisted
  • Filesystem boundary โ€” tg_send can only read files from allowed_upload_dirs; download_to is restricted to subdirectories of media.directory
  • Session file permissions โ€” enforced to 0600 (owner-only read/write)
  • No secret logging โ€” API hashes, session tokens, and auth keys are never written to logs
  • No access hash exposure โ€” internal Telegram access hashes are stripped from all tool output
  • Rate limiting โ€” prevents accidental API abuse
  • Local timezone โ€” date filters use your system timezone, not UTC