MCP-TG
Provides a Telegram MCP server with tools for managing chats, messages, contacts, users, groups, channels, and a reactive inbox, allowing agents to interact with Telegram through MTProto.
Click on "Install 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., "@MCP-TGread my Telegram inbox and reply to the latest message"
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.
MCP-TG — Telegram MCP Server with Reactive Daemon
v0.9.4 · Standalone Telegram MCP server — daemon + proxy for multi-agent isolation.
Standalone MCP server for Telegram — 50+ tools over Model Context Protocol. One persistent MTProto connection (tgmcpd daemon, Telethon) serves N isolated agents via Unix-socket IPC proxies — each agent bound to its own Telegram topic.
Overview
tgmcpd daemon — one
Telethonclient, persistent MTProto session,InboxEnginewith per-topic buffers + disk persistence (~/.local/state/tgmcpd/inbox_store).tg-mcp-proxy — thin stateless stdio↔IPC bridge per agent (
TG_TOPIC_IDisolates topics).Reactive inbox v0.9.2 —
asyncio.Eventwake-up + JSONL store + priority envelope, no polling.
Related MCP server: telegram-mcp
Architecture
v0.9.2 — Reactive Inbox
Telegram push → Telethon event → InboxEngine.handle()
→ InboxStore.append(JSONL) → buffer[(chat,topic)].append()
→ asyncio.Event[(chat,topic)].set()
→ proxy inbox_wait() wakes → IPC → MCP inbox_read → envelope + ackInboxStore— per(chat_id, topic_id)JSONL in~/.local/state/tgmcpd/inbox_store(TGMCPD_STORE_DIR),ackviatmp→replace(atomic), survives restarts.InboxEngine—defaultdict(deque)buffers +defaultdict(asyncio.Event)per topic,restore_from_store()on daemon start.InboxBridge— push viatmux/tui/uds(TG_TOPIC_MAP),clear_ram_bufferafter push (agent drains viainbox_read).
See docs/tg-mcpd Architecture v0.9.2 — Reactive Inbox.md.
Tools — 50 total (MCP stdio, Telethon/MTProto)
Chats — GetAllChats, GetChats, GetChatInfo, GetChatMembers, GetChatAdmins, GetChatOnlineCount, SearchChats, GetChatInviteLink, CheckChatInvite, JoinChatByInvite, LeaveChat, GetFolders, GetChatsFromFolder, GetForumTopics, AddChatMember, BanChatMember, UnbanChatMember, KickChatMember, PromoteToAdmin
Messages — SendMessage, ReplyToMessage, EditMessage, DeleteMessage, ForwardMessage, GetChatHistory, SearchMessages, MarkAsRead, PinMessage, UnpinMessage, SendFile, DownloadMedia
Contacts — GetContacts, AddContact, DeleteContact, SearchContacts, BlockUser, UnblockUser, GetBlockedUsers, SearchGlobal
Users — GetMe, GetUserInfo, GetUserStatus, SearchUsers, ResolveUsername, UpdateProfile
Groups/Channels — CreateGroup, CreateChannel, EditChatTitle
Inbox — InboxPeek, InboxRead (via proxy inbox_read → inbox_peek/inbox_wait + inbox_ack)
Full table: TOOLS_RU.md.
Requirements
Python 3.9+
Telegram
api_id/api_hash(https://my.telegram.org)Linux/macOS (systemd for daemon), Windows via WSL
Quick Start
pip install -e .
cp .env.example .env # fill TELEGRAM_API_ID, TELEGRAM_API_HASH
python -m mcp_telegram.qr_auth # or: mcp-tg sign-inRun daemon (systemd)
sudo cp scripts/tgmcpd.user.service ~/.config/systemd/user/tgmcpd.service
systemctl --user daemon-reload
systemctl --user enable --now tgmcpd.socket
systemctl --user enable --now tgmcpd
systemctl --user status tgmcpdDaemon socket: /run/user/1000/tgmcpd.sock ($XDG_RUNTIME_DIR/tgmcpd.sock), store: ~/.local/state/tgmcpd/inbox_store ($TGMCPD_STORE_DIR).
Run proxy per topic (opencode)
TG_CHAT_ID=-1003998609906 TG_TOPIC_ID=205 tg-mcp-proxyopencode.json example:
{
"mcpServers": {
"tg-mcp-205": { "command": "tg-mcp-proxy", "env": { "TG_CHAT_ID": "-1003998609906", "TG_TOPIC_ID": "205" } }
}
}Add more proxies with different TG_TOPIC_ID for multi-agent isolation.
Docker (optional)
docker build -t mcp-tg .
docker-compose up -dConfiguration
Env / .env:
TELEGRAM_API_ID=
TELEGRAM_API_HASH=
TELEGRAM_SESSION_PATH=~/.config/mcp-tg/session.session
TGMCPD_SOCK=/run/tgmcpd/tgmcpd.sock
TGMCPD_STORE_DIR=~/tgmcpd/inbox_store
TG_CHAT_ID=-1003998609906
TG_TOPIC_ID=205Entry points (setup.py): mcp-tg, tgmcpd, tg-mcp-proxy.
Project Structure
src/mcp_telegram/
daemon.py # tgmcpd entry, Telethon + IPC
inbox.py # InboxEngine (buffers + Events)
inbox_store.py # JSONL persistence
inbox_bridge.py # InboxBridge push (tmux/tui/uds)
ipc_server.py # Unix socket JSON-line server
ipc_client.py # proxy side client
proxy.py # MCP stdio ↔ IPC
telegram.py # TelegramSettings, client helpers
tools.py # core 50 tools
server.py # legacy single-process server
docs/
tg-mcpd Architecture v0.9.2 — Reactive Inbox.md
scripts/
tgmcpd.user.service
tgmcp-proxy-wrapper.py / tgmcp-proxy-watchdog.pyDevelopment
pytest
pytest tests/unit/test_inbox_bridge.py
black src && ruff check src && mypy srcInbox protocol for agents: see AGENTS.md — on ⚡ INBOX ALERT call inbox_read, then send_message with ack.
Notes
Local project — no GitHub origin.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Unified inbox MCP for WhatsApp, Telegram, Email, voice — read/send messages, search, AI agents.
Messaging tools for AI agents: send messages, manage chats, groups and channels.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to send messages and interact with Telegram chats through MCP tools, with support for user management, conversation history, and bot command handling.1-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to read, send, and organize Telegram messages and chats. Supports tools for listing chats, fetching messages, sending/reply, archiving, muting, and folder management.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with Telegram accounts through MCP, supporting messaging, contacts, groups, media, and admin functions.4Apache 2.0
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to control a real Telegram user account via MTProto, allowing message sending, chat reading/searching, and message management through MCP tools.27-