mcp-telegram
About
Telegram MCP server using User API (MTProto) with default-deny ACL, granular per-chat permissions, file sending, media downloads, and rate limiting
Details
- Author
- prgebish
- Categories
- Communication, Other, File Management, Security
Jump to
Setup
Install mcp-telegram in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/prgebish/mcp-telegram
Follow the installation instructions in the repository README, then restart your MCP client.
Built withgotd/tdand the officialMCP Go SDK.
Telegram API Terms of Service: This project uses the Telegram User API. You must obtain your ownapi_idandapi_hashfrommy.telegram.organd comply with theTelegram 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.
- Features
- What you can do with it
- How it compares to chaindead/telegram-mcp
- Quick start
- Client configuration
- Configuration reference
- Security
- 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 — avoidsFLOOD_WAITerrors at startup
- Global rate limiting at the RPC level
Once connected, you can ask your AI assistant things like:
- "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"
- "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"
- "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"
- "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
- Go 1.26+
- A Telegram account
- API credentials frommy.telegram.org(api_idandapi_hash)
npx @prgebish/mcp-telegram serve --config config.yaml
Pre-built binaries (macOS / Linux / Windows):
go install github.com/Prgebish/mcp-telegram/cmd/mcp-telegram@latest
git clone https://github.com/Prgebish/mcp-telegram.git cd mcp-telegram go build ./cmd/mcp-telegram
This producesmcp-telegram(ormcp-telegram.exeon Windows) in the current directory.
Run the auth command once to create a session file. You will be prompted for your phone number, the login code, and (if enabled) your 2FA password.
export TG_APP_ID=12345 export TG_API_HASH="your_api_hash" mcp-telegram auth --config config.yaml
$env:TG_APP_ID = "12345" $env:TG_API_HASH = "your_api_hash" mcp-telegram.exe auth --config config.yaml
set TG_APP_ID=12345 set TG_API_HASH=your_api_hash mcp-telegram.exe auth --config config.yaml
telegram: app_id: ${TG_APP_ID} api_hash: ${TG_API_HASH} session_path: ~/.config/mcp-telegram/session.json acl: chats: - match: "@username" permissions: [read, draft, mark_read] - match: "user:123456789" permissions: [read, send] - match: "channel:2225853048" permissions: [read, mark_read] limits: max_messages_per_request: 50 max_dialogs_per_request: 100 rate: requests_per_second: 2.0 burst: 3 logging: level: info
Environment variables in${...}syntax are expanded at load time.
The server communicates over stdio — your MCP client starts and manages the process.
claude mcp add telegram -- /path/to/mcp-telegram serve --config /path/to/config.yaml
Claude Desktop / Claude Code(~/.claude.jsonorclaude_desktop_config.json):
{ "mcpServers": { "telegram": { "command": "/path/to/mcp-telegram", "args": ["serve", "--config", "/path/to/config.yaml"], "env": { "TG_APP_ID": "12345", "TG_API_HASH": "your_api_hash" } } } }
Cursor(Settings > MCP Servers > Add):
{ "telegram": { "command": "/path/to/mcp-telegram", "args": ["serve", "--config", "/path/to/config.yaml"], "env": { "TG_APP_ID": "12345", "TG_API_HASH": "your_api_hash" } } }
The ACL isdefault-deny. Only chats explicitly listed inacl.chatsare accessible, and only with the permissions you specify.
Permission types:read,send,draft,mark_read.
If the same peer matches multiple rules (e.g. via@usernameanduser:ID), permissions are merged — they never shadow each other.
Thelimits.ratesection configures a global token bucket that wraps all Telegram RPC calls:
- requests_per_second— sustained rate (default: 2.0)
- burst— maximum burst size (default: 3)
media: download: [photo, document, video, voice, audio] directory: ~/telegram-media allowed_upload_dirs: - ~/Documents - ~/Downloads
When configured,tg_historywill automatically download media files to the specified directory. Thedownload_toparameter can override the path, but only tomedia.directoryor its subdirectories.
allowed_upload_dirsrestricts which directoriestg_sendcan read files from. File sending is disabled unless this is configured.
- Default-deny ACL— no chat is accessible unless explicitly whitelisted
- Filesystem boundary—tg_sendcan only read files fromallowed_upload_dirs;download_tois restricted to subdirectories ofmedia.directory
- Session file permissions— enforced to0600(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
If you find this project useful, please give it a star — it helps others discover it.
Encrypted file transfer and communication between AI agents - send and receive files securely with E2E encryption, agent identity, and trust scoring.
Create, edit, and delete email aliases and manage encrypted file shares with anon.li MCP.
Send and receive emails, SMS, and voice calls via Pingram.
Platfone - Receive SMS & Virtual Numbers MCP
Virtual phone number platform for AI agents — rent numbers across 200+ countries, receive SMS, and manage the full activation lifecycle
3 tools for global censorship intelligence (119 countries) + E2E encrypted agent-to-agent messaging with Double Ratchet and post-quantum crypto
Agent-native forum for the x402/A2A ecosystem. The hosted MCP server exposes the whole forum as tools — threads, comments, votes, USDC bounties (Coinbase x402 on Base), provider reviews, and search. Endpoint: https://api.achivx.com/mcp/ (HTTP, OAuth 2.1).
Real SIM-backed mobile numbers for AI agents. Provision phone numbers, receive SMS, and capture OTP codes — bypasses VoIP blocks that reject Twilio/Vonage. 5 tools: provision_number, wait_for_otp, get_messages, release_number, list_numbers.
MCP server for Telegram bots built with aiogram. 30 tools, 7 resources, 3 prompts — messaging, rich media, moderation, interactive keyboards, real-time event streaming, rate limiting, permissions, and audit logging.
Production-grade MCP server for Telegram with dual-mode Bot API + MTProto, 6 composite tools
Local-first MCP server that puts your own LINE and Telegram chats behind one data layer — a daemon on your machine logs in with your own account, stores messages to JSONL + SQLite/FTS5, and exposes them to MCP clients like Claude Code. Not an npx one-liner: you clone the repo and run the daemon yourself.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




