← Back to directory
T

Telegram MCP Server

Community
Telegram MCP server powered by Telethon to let MCP clients read chats, manage groups, and send/modify messages, media, contacts, and settings.
GitHub source repository ↗
★ 1.5k Stars Category · Other Very popular Source revision 52cca204d945
70FMRS · B
Reliability
9/20
Security and permissions
16/20
Maintenance
14/20
Documentation
17/20
Setup experience
14/20

This MCP server is feature-rich, offering 80+ tools covering Telegram messaging, groups, media, contacts, and admin functions. It requires a user-level session string, so permissions are broad; users should store credentials carefully. The project includes security measures (e.g., read-only mode, path restrictions, prompt injection protections), but risks remain. Installation must be done via cloning or Git install to avoid the PyPI package of the same name.

Read the FMRS scoring method →

telegram-mcp is a Model Context Protocol (MCP) server built on Telethon that provides full Telegram integration for MCP-compatible clients like Claude, Cursor, and Codex. It exposes 80+ tools for managing Telegram accounts, chats, messages, contacts, media, folders, and admin operations. Supports stdio, HTTP, and SSE transports, multi-account setups, proxy support, contact alias memory, read-only mode, file path security, Docker deployment, and prompt injection protections.

Tools

list_accounts
List configured Telegram accounts.
get_me
Get the current account's information.
update_profile
set_profile_photo
delete_profile_photo
list_chats
List chats for the account.
get_chat
Get chat metadata.
create_group
Create a new group.
create_channel
Create a new channel.
join_chat
Join a chat.
leave_chat
Leave a chat.
invite_users
Invite users to a chat.
get_participants
Get chat participants.
promote_admin
Promote a user to admin.
demote_admin
Demote an admin to regular user.
ban_user
Ban a user from a chat.
unban_user
Unban a user from a chat.
set_default_permissions
Set default chat permissions.
set_slow_mode
Set slow mode for a chat.
manage_topics
Manage forum topics.
create_invite_link
Create an invite link for a chat.
revoke_invite_link
Revoke an invite link.
get_common_chats
Get chats shared with a user.
get_read_receipts
Get read receipts for a message.
get_message_link
Get a link to a message.
send_message
Send a message, supporting Markdown/HTML formatting.
reply_to_message
edit_message
Edit a previously sent message.
delete_message
Delete a message.
forward_message
Forward a message to another chat.
pin_message
Pin a message in a chat.
unpin_message
Unpin a message.
mark_read
Mark a chat as read.
search_messages
Search messages within a chat.
get_message_context
create_poll
Create a poll.
manage_reactions
Manage message reactions.
get_inline_buttons
press_inline_button
set_contact_alias
Set a custom alias for a contact.
list_contact_aliases
List all aliases for contacts.
delete_contact_alias
Delete a contact alias.
list_contacts
List contacts.
search_contacts
add_contact
Add a contact.
delete_contact
block_contact
Block a contact.
unblock_contact
Unblock a contact.
import_contacts
export_contacts
get_direct_chats
recent_contact_interactions
send_file
Send a file to a chat.
download_media
Download media from a message.
upload_file
Upload a file to Telegram.
send_voice
Send a voice message.
send_sticker
Send a sticker.
send_gif
Send a GIF.
get_message_media
get_user_info
get_user_photos
get_user_status
manage_bot_commands
list_folders
create_folder
update_folder
reorder_folders
delete_folder
save_draft
list_drafts
clear_drafts
wait_for_new_message
Wait for a new incoming message with debounce.
wait_for_settled_message
Wait for a message burst to settle.
enable_incoming_feed
Enable the incoming event feed (callback mode).
disable_incoming_feed
Disable the incoming event feed.
incoming_feed_status
Check the status of the incoming event feed.

Setup

  1. Clone the repository and install dependencies: git clone https://github.com/chigwell/telegram-mcp.git && cd telegram-mcp && uv sync.
  2. Generate a session string: uv run session_string_generator.py --qr (recommended) or --phone.
  3. Copy .env.example to .env and fill in TELEGRAM_API_ID, TELEGRAM_API_HASH, and TELEGRAM_SESSION_STRING.
  4. Run the server: uv run main.py, or configure your MCP client with uv --directory /path/to/telegram-mcp run main.py and the environment variables.
  5. Optionally set TELEGRAM_EXPOSED_TOOLS=read-only to expose only read-only tools.
claude_desktop_config.json
{
  "mcpServers": {
    "telegram-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/full/path/to/telegram-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "TELEGRAM_API_ID": "your_api_id_here",
        "TELEGRAM_API_HASH": "your_api_hash_here",
        "TELEGRAM_SESSION_STRING": "your_session_string_here"
      }
    }
  }
}

Fit and risk

Best for

  • Developers who want to integrate Telegram into MCP clients like Claude
  • Automation scenarios that need to manage multiple Telegram accounts
  • Building custom Telegram bots or workflows
  • Scenarios that require secure file operation path restrictions

Not for

  • Use cases requiring official Bot API features (this server uses a user client)
  • Non-technical users who want a fully managed solution
  • Multiple processes using the same session without lock management

Required permissions

  • Requires Telegram API ID and API Hash
  • Requires the user's Telegram session string (equivalent to account access)
  • Can send messages, media, contacts, and settings to any allowed chat
  • Can create or modify groups, channels, and chat settings
  • Can access and operate on the user's media files and contacts

Risks and side effects

  • Session string leakage could lead to account compromise
  • Sending messages may raise privacy or security concerns
  • Prompt injection: Telegram content may be maliciously crafted, so precautions are needed
  • Risk of using unofficial PyPI package name; avoid pip install telegram-mcp
  • Concurrent clients using the same session may cause AuthKeyDuplicatedError

Troubleshooting

  1. No session: set TELEGRAM_SESSION_STRING or run session_string_generator.py
  2. Session not authorized: regenerate the session string
  3. Invalid API credentials: check API ID and Hash from my.telegram.org
  4. Database locked: use string sessions or avoid multiple processes on the same file
  5. File tools disabled: configure allowed roots or MCP Roots
  6. Path rejected: ensure path is within an allowed root and has no wildcards
  7. Auth errors: regenerate session string
  8. Check mcp_errors.log and client logs for details

Use cases

Let an AI assistant read and analyze Telegram chat history
Send, forward, and edit messages via natural language commands
Automate group management, such as adding/removing members or setting permissions
Download media files or upload files to chats
Manage contact lists and custom aliases

Supported clients

Claude DesktopFull support
CursorFull support
Claude CodeFull support
CodexFull support