Labsco
MCP SERVER

Telegram MCP Server

by kfastov

Search, read and send Telegram messages from your own account through a background sync service.

Team Chat Platforms
Summary
It syncs your history to a local database first, so search runs over an archive rather than a live scroll.

Because it uses your personal account over MTProto, it reaches everything you can see — DMs, channels, forum topics — not just what a bot is invited to. The background sync is what makes messagesSearch useful: it is querying a local full-text index of backfilled history, with a source flag to choose archive, live, or both.

What it is

Tgcli — a Telegram CLI with background sync and an optional MCP server, working through your personal account over MTProto rather than the bot API.

What you get
  • messagesList and messagesSearch read and full-text-search messages across archive, live, or both, with date and channel filters
  • messagesContext pulls the messages around one; messagesGet fetches a single message
  • messagesSend and messagesSendFile send text and files, optionally into a forum topic or as a reply
  • channelsList, channelsSearch and channelsGet cover your channels; topicsList and topicsSearch handle forum topics
  • contactsSearch, groupsList and groupsInfo reach contacts and groups; mediaDownload saves attachments
  • Background sync backfills the archive and keeps a local messages.db in step with live
Requirements

Telegram API credentials — an api_id and api_hash created at my.telegram.org/apps — then tgcli auth to log in with your phone number. Install globally with npm and the @kfastov/tgcli package, or via Homebrew. The MCP server is off by default: enable it with tgcli config set mcp.enabled true, and it binds to http://127.0.0.1:8080/mcp.

Setup effort

One command plus a key — npm install -g @kfastov/tgcli, then supply credentials