# mcp-telegram [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/beautyfree/mcp-telegram  
**GitHub Stars:** 34  
**npm Downloads (last month):** 1109  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-telegram

## Description
Telegram MCP server (MTProto). Connect Claude, Codex, Cursor, Claude Code, VS Code, Cline, Windsurf, and other MCP clients to a real Telegram user account: read dialogs, search messages globally, send/edit/forward, react/poll, moderate channels, tag Saved

## Tools
Capabilities this server exposes over MCP:

- **login** — Open the browser-based sign-in flow. Adds an account.
- **list_accounts** — List signed-in accounts.
- **list_dialogs** — List dialogs/chats/channels. Filters: `unread`, `archived`, `ignorePinned`, `folder`, `limit`.
- **list_messages** — List messages in a dialog. Newest first.
- **search_messages** — Search inside one dialog: `query`, `filter` (photos/videos/url/voice/...), `fromUser`, date range.
- **search_global** — Search across every chat you have.
- **search_dialogs** — Find dialogs by name/title/username substring.
- **send_message** — Send text. Supports `replyTo`, `topMsgId`, `parseMode`, `schedule`, `silent`.
- **send_file** — Send a file (local path or `https://` URL). Pass an array for an album.
- **download_media** — Save the media on a message to disk.
- **transcribe_message** — Transcribe a voice/video note (Premium).
- **invoke_mtproto** — Call any raw MTProto method by name. Auto-resolves `peer`/`channel`/`user` strings.
- **logout** — Drop a local session and revoke it on Telegram.
- **open_settings** — Open the local settings page (tool surface + read-only).
- **get_me** — Return the profile of the authenticated user.
- **update_profile** — Change own first/last name and bio.
- **update_my_username** — Set or clear own `@username`.
- **set_birthday** — Set the account birthday.
- **set_profile_photo** — Upload a new avatar (local path or URL).
- **resolve_username** — Resolve `@username` to a user/channel/chat entity.
- **list_folders** — List custom dialog folders (chat filters).
- **list_contacts** — List contacts.
- **get_message** — Fetch one or more messages by id.
- **get_message_reactions** — Get reactions on messages.
- **mark_as_read** — Mark messages read up to an id.
- **edit_message** — Edit a previously sent message.
- **delete_messages** — Delete by id (optionally revoke for all).
- **forward_messages** — Forward messages between dialogs.
- **pin_message** — Pin / unpin in a dialog.
- **send_reaction** — Set reactions on a message.
- **send_message_to_phone** — Send to a phone number, auto-creates a temporary contact.
- **download_profile_photo** — Save a peer's avatar to disk.
- **send_poll** — Send a poll. Supports quiz, multiple-choice, anonymous, close period.
- **vote_poll** — Cast a vote.
- **close_poll** — Finalize a poll.
- **get_poll_results** — Fetch tally.
- **set_default_reaction** — Set account-wide default.
- **list_stories** — Feed of contacts' stories.
- **get_peer_stories** — One peer's stories.
- **send_story** — Post a story (photo or video).
- **delete_story** — Delete own stories.
- **view_story** — Mark stories viewed.
- **get_story_viewers** — List who viewed your story.
- **ban_user** — Full ban (optional `untilDate`).
- **unban_user** — Lift restrictions.
- **restrict_user** — Apply a custom rights mask.
- **promote_admin** — Grant admin rights (with rank).
- **demote_admin** — Strip admin rights.
- **invite_user** — Add users to a channel/supergroup.
- **kick_participant** — Kick from chat/channel.
- **get_participant** — Single participant info.
- **list_participants** — Members with filter (admins/banned/bots/...) and substring search.
- **delete_user_history** — Remove every message by a user.
- **get_admin_log** — Recent admin events with event-type filter.
- **edit_title** — Change title (works for channels, supergroups, and basic groups).
- **edit_about** — Change description.
- **edit_photo** — Change avatar (path or URL).
- **update_username** — Set/clear public `@username`.
- **check_username** — Check availability.
- **set_slow_mode** — Set slow-mode seconds.
- **toggle_signatures** — Author signatures on channel posts.
- **toggle_pre_history_hidden** — Hide history from new members.
- **toggle_join_request** — Require admin approval to join.
- **leave_channel** — Leave a channel/supergroup.
- **get_channel_info** — Extended info (about, counts, linked chat, slow-mode).
- **get_user_info** — Extended user info (bio, common chats).
- **create_channel** — New broadcast channel or supergroup (optional forum mode).
- **delete_channel** — Permanently delete.
- **migrate_chat** — Basic group → supergroup.
- **transfer_ownership** — Hand over creator rights (requires 2FA password).
- **create_invite_link** — New link with optional expiry, usage cap, join-request gate.
- **list_invite_links** — List active or revoked links.
- **revoke_invite_link** — Revoke a specific link.
- **list_invite_joiners** — List users that joined via a link.
- **list_topics** — List forum topics.
- **create_topic** — Create a new topic.
- **edit_topic** — Rename, re-icon, close, hide.
- **save_draft** — Save a draft for a dialog.
- **clear_draft** — Drop the draft for a dialog.
- **list_drafts** — List all dialog drafts.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-telegram": {
    "command": "npx",
    "args": ["-y","mcp-telegram"],
    "env": {
      "TELEGRAM_API_ID": "",
      "TELEGRAM_API_HASH": ""
    }
  }
}
```

**Requires environment variables:** `TELEGRAM_API_ID`, `TELEGRAM_API_HASH` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What mcp-telegram does

mcp-telegram exposes a Telegram user account to MCP-compatible clients through the Model Context Protocol and Telegram’s MTProto API. The account can be used to inspect conversations, search across chats, send and modify messages, exchange files, manage channels, and perform account-level actions.

The package includes 102 tools. Its surface covers ordinary messaging tasks as well as less common Telegram operations, including stories, contacts, drafts, notifications, folders, privacy settings, forum topics, invite links, slow mode, administrator logs, and channel membership controls. The `invoke_mtproto` tool provides a route to raw MTProto methods when a higher-level tool is not sufficient.

Unlike a bot integration, the server operates with a signed-in Telegram user account. The `peer` parameter can identify a destination with a numeric chat ID, an `@username`, or `me` for Saved Messages. Tools also accept an optional `accountId` when multiple accounts are configured.

## How it works

The server runs as a local stdio MCP process, normally launched with `npx -y mcp-telegram`. MCP clients call its tools, while the server communicates with Telegram over MTProto. A first sign-in is initiated through the `login` tool: a browser tab opens for the phone number, verification code, and optional two-factor authentication password.

After authentication, the session is saved in `~/.telegram-agent/`. The same local session store can be used by the companion `telegram-agent` package. Running `list_accounts` shows available signed-in accounts; `logout` removes a local session and revokes it on Telegram.

The complete tool schema is approximately 12,700 tokens, so the full MCP surface remains in the agent context on each turn. The server is intended for clients and hosted runtimes that can run a standard MCP process. The companion skill-based package is an alternative for selected agent environments that need lower idle context usage.

## Setup and configuration

Node.js 20 or newer and Telegram API credentials are required. Create an application at `my.telegram.org/apps`, then provide its `api_id` and `api_hash` as environment variables:

- `TELEGRAM_API_ID`
- `TELEGRAM_API_HASH`

Installation can be automated with `npx add-mcp mcp-telegram`, which writes client configuration for supported MCP applications. Manual stdio configuration uses `npx` as the command, `-y mcp-telegram` as its arguments, and the two Telegram credentials in the process environment.

For example, a client configuration supplies the package through `command: "npx"`, with `args: ["-y", "mcp-telegram"]`. After adding it, ask the connected agent to sign in to Telegram. Additional accounts can be added by invoking `login` again.

Protect `~/.telegram-agent/` as a credential store. It contains the local sessions for the signed-in accounts.

## Tools and capabilities

Core tools include:

- `list_dialogs`, `search_dialogs`, and `list_folders` for finding chats and organizing dialog discovery.
- `list_messages`, `get_message`, `search_messages`, and `search_global` for reading and searching messages, including filters such as sender, content type, and date range.
- `send_message`, `edit_message`, `delete_messages`, `forward_messages`, and reactions for message operations.
- `send_file`, `download_media`, and `transcribe_message` for media exchange and voice or video-note transcription when Telegram Premium supports it.
- `pin_message`, `mark_as_read`, and channel administration tools for conversation and moderation workflows.
- `get_me`, profile tools, contact management, drafts, notifications, privacy, stories, and other account features.
- `invoke_mtproto` for direct access to MTProto methods, with automatic resolution of common peer, channel, and user strings.

The server can moderate channels through actions such as banning, restricting, promoting, managing invite links, configuring slow mode, reviewing administrator logs, and working with forum topics. It can also tag Saved Messages by using `me` as the peer.

## Limitations and notes

This integration uses a real Telegram user account rather than a bot, so actions and access reflect that account’s permissions. The server requires Telegram API credentials and an interactive first-time sign-in. Voice and video-note transcription requires Telegram Premium.

All tool schemas are loaded by the MCP server, which adds roughly 12,700 tokens to the agent context on every turn. For Claude Code, Codex CLI, Cursor, Gemini CLI, Cline, or Windsurf, the separate `telegram-agent` package offers the same Telegram surface as a skill that loads only when Telegram is mentioned; it is not an MCP server but shares the session directory.

_Full upstream README: https://allmcps.com/mcp/mcp-telegram/readme_

