← 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.
Category
Other
Stars
★ 1.8k Very popular
Transport
stdio (local process) · SSE · Streamable HTTP
Runtime
Python 3.10+ · Docker · Node.js
Credentials
API key / credential required
License
Apache-2.0
Last commit
Tools
76
70FMRS · B

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.

Strongest · Documentation 17/20 Weakest · Reliability 9/20

Reliability
9/20
Security and permissions
16/20
Maintenance
14/20
Documentation
17/20
Setup experience
14/20
Why each score
Reliability 9/20
The README describes a coherent modular architecture (main.py, runtime.py, runner.py, tools/, sanitize.py, tests/) and unusually detailed error behavior (structured telegram_premium_required results, guided unknown-contact returns, fail-fast proxy validation, AuthKeyDuplicatedError retries). However, this static review received only the README's self-description — no source code, test files, or CI workflow files to execute or inspect. The README is untrusted evidence; its CI badges and 80% coverage gate cannot be verified. Under the static calibration, missing verifiable execution evidence caps this dimension at 12 and missing evidence is a deduction; it cannot be confirmed that the declared tools match real behavior. Therefore below the 10 anchor: 9 — the happy path looks plausible but is not reproducible or diagnosable from the supplied material.
Security and permissions 16/20
No red-line issue found: install examples use only placeholders; the documented design includes read-only tool gating (TELEGRAM_EXPOSED_TOOLS=read-only), mandatory allowed roots for file tools with traversal/wildcard/null-byte rejection, sanitized structured JSON with MCP audience annotations, owner-only (0600) state files, HTTP defaulting to 127.0.0.1, DNS-rebinding protection, an honest PyPI name-collision warning with an install guard, and confirm-before-send for fuzzy contact matches. Credentials are env-based with explicit 'never commit .env' warnings. Yet the server inherently wields full Telegram account authority, and the README itself discloses that read-only mode is an MCP-surface restriction, not a session sandbox; none of the safeguards could be verified in actual code. Per 'unverified means deduction', 16/20.
Maintenance 14/20
Factual metadata shows the repo is not archived, uses Apache-2.0, names two maintainers (@chigwell, @l1v0n1), and includes a contributing guide with pre-commit hooks; README badges reference lint/format and Docker-build workflows, indicating an actively maintained project. However, this review contains no direct evidence of commit cadence, release tags, dependency updates, issue-response timeliness, or a security-response channel; the 34 open issues cannot be assessed for response quality. Deduction for missing update-path evidence: 14/20 rather than full marks.
Documentation 17/20
The README is layered and exceptionally thorough: prerequisites, session-string generation (QR/phone), single/multi-account config, session pooling, proxy, device identity, file-path security policy, Docker, three transports, development/testing, security notes, and a troubleshooting table. Limitations are explicitly disclosed (rich formatting requires Telegram Premium re-checked per call, PyPI name collision, stdio-vs-HTTP trade-offs, unauthenticated HTTP endpoint), with complete client configuration JSON for Claude/Cursor. Deductions: per-tool parameter reference is only claimed to live inside server tool descriptions and cannot be verified; no documentation layer beyond the README is available; claims like '80+ tools' and the coverage gate lack source evidence. Hence 17/20.
Setup experience 14/20
Setup is a clear multi-path flow: git clone + uv sync, run session_string_generator.py (--qr/--phone), cp .env.example and fill credentials, run main.py; ready-made stdio configuration JSON for Claude/Cursor, Docker run/compose commands, a git-installed console-script option, and mcp-remote bridging are all provided, including allowed-roots CLI examples. Static calibration caps setup at 15 without verifiable CI/test files in the evidence, and only the README describes the process; the manual session-generation step and the PyPI name-collision workaround (clone-based install only) add real friction. Score: 14/20.

Static review · not runListed 2026-08-07

Read the FMRS scoring method →

Fit and risk

What it can accessReads local filesWrites / deletes local filesUses the networkChanges third-party account data

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

Setup

Before you start

Runtime:Python 3.10+ · Docker · Node.js

TELEGRAM_API_ID required Telegram API ID from my.telegram.org/apps; required.
TELEGRAM_API_HASH requiredsecret Telegram API hash obtained together with the API ID at my.telegram.org/apps; secret credential.
TELEGRAM_SESSION_STRING requiredsecret Authorized session string generated with the repo's session_string_generator.py; grants account access, keep secret.
TELEGRAM_SESSION_STRING_WORK optionalsecret Optional; session string for the 'work' account in multi-account mode.
TELEGRAM_SESSION_STRING_PERSONAL optionalsecret Optional; session string for the 'personal' account in multi-account mode.
TELEGRAM_SESSION_STRINGS optionalsecret Optional; multiple session strings (session pool) so several clients can share one account.
TELEGRAM_PROXY_PASSWORD optionalsecret Optional; proxy authentication password; secret credential.
TELEGRAM_PROXY_SECRET optionalsecret Optional; MTProxy secret required for mtproxy proxies; secret credential.
Other optional settings (20)
TELEGRAM_EXPOSED_TOOLS optional Optional; set to read-only to expose only read-only tools, or read-only+tool names to add specific write tools.
TELEGRAM_CONTACT_FUZZY optional Optional; set to 0 to disable fuzzy suggestions for contact aliases.
TELEGRAM_ALIASES_FILE optional Optional; overrides the path of the contact aliases storage file.
TELEGRAM_EVENT_FEED optional Optional; set to 1 to auto-enable the incoming event feed (callback mode).
TELEGRAM_EVENT_FEED_FILE optional Optional; overrides the path of the incoming feed JSONL file.
TELEGRAM_SESSION_NAME optional Optional; fallback session identifier (file session name).
TELEGRAM_DEVICE_MODEL optional Optional; device model name shown under Telegram Settings > Devices.
TELEGRAM_SYSTEM_VERSION optional Optional; system version shown in the devices list.
TELEGRAM_APP_VERSION optional Optional; app version shown in the devices list.
TELEGRAM_PROXY_TYPE optional Optional; proxy type: socks5, socks4, http, or mtproxy.
TELEGRAM_PROXY_HOST optional Optional; proxy server host.
TELEGRAM_PROXY_PORT optional Optional; proxy server port.
TELEGRAM_PROXY_USERNAME optional Optional; proxy authentication username.
TELEGRAM_PROXY_RDNS optional
MCP_TRANSPORT optional Optional; MCP transport: stdio (default), http, or sse.
MCP_HOST optional Optional; bind address for http/sse transports, default 127.0.0.1.
MCP_PORT optional Optional; port for http/sse transports, default 8765.
MCP_ALLOWED_HOSTS optional Optional; allowed Host headers to enable DNS-rebinding protection.
MCP_ALLOWED_ORIGINS optional Optional; allowed Origin list.
TELEGRAM_ALLOW_SERVER_ROOTS_FALLBACK optional Optional; set to 1 to fall back to server CLI roots when client Roots are empty or fail.
  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"
      }
    }
  }
}

Shown for Claude Desktop. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.

.vscode/mcp.json
{
  "servers": {
    "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"
      }
    }
  }
}

Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).

Terminal
claude mcp add telegram-mcp -e TELEGRAM_API_ID=your_api_id_here -e TELEGRAM_API_HASH=your_api_hash_here -e TELEGRAM_SESSION_STRING=your_session_string_here -- uv --directory /full/path/to/telegram-mcp run main.py

Run it in a terminal; replace any <…> placeholders with your own values first.

Check that it works

After configuring the server in your MCP client and restarting, tools such as list_accounts and get_me should appear in the client's tool list; calling get_me and getting your Telegram account info back confirms the connection works.

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

Things to try

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

  • List all my Telegram accounts and show unread messages on each
  • Search my chats for messages mentioning the project deadline and summarize the discussion
  • Send a message to @example saying tomorrow's meeting moved to 3 PM
  • Create a new invite link for my work group and promote a member to admin

Tools 76

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

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 Desktop
Cursor
Claude Code
Codex

Listed from the project's documentation, not tested by this site.

Overview

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.

Similar servers

Source revision 091017028552 Data synced 2026-10-11 Read the FMRS scoring method