{"id":51090168,"url":"https://github.com/beautyfree/mcp-telegram","last_synced_at":"2026-06-24T01:02:16.489Z","repository":{"id":285421132,"uuid":"957683265","full_name":"beautyfree/mcp-telegram","owner":"beautyfree","description":"Telegram MCP server (MTProto). Connect Claude, Cursor, Claude Code, VS Code, Codex, Cline, Windsurf to a real Telegram account — read/search/send messages, moderate channels, manage stories/contacts/folders, transcribe voice, and call any raw MTProto method. Browser-based sign-in. 100+ tools.","archived":false,"fork":false,"pushed_at":"2026-05-17T04:58:07.000Z","size":936,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T05:23:00.767Z","etag":null,"topics":["ai-agent","ai-tools","claude","claude-code","claude-desktop","cursor","gramjs","llm-tools","mcp","mcp-server","mcp-telegram","model-context-protocol","mtproto","telegram","telegram-api","telegram-automation","telegram-client","telegram-mcp","telegram-userbot","vscode"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mcp-telegram","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beautyfree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-30T23:53:15.000Z","updated_at":"2026-05-17T04:58:11.000Z","dependencies_parsed_at":"2025-03-31T17:38:14.117Z","dependency_job_id":null,"html_url":"https://github.com/beautyfree/mcp-telegram","commit_stats":null,"previous_names":["tacticlaunch/mcp-telegram","beautyfree/mcp-telegram"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/beautyfree/mcp-telegram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautyfree%2Fmcp-telegram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautyfree%2Fmcp-telegram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautyfree%2Fmcp-telegram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautyfree%2Fmcp-telegram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beautyfree","download_url":"https://codeload.github.com/beautyfree/mcp-telegram/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautyfree%2Fmcp-telegram/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34712578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","ai-tools","claude","claude-code","claude-desktop","cursor","gramjs","llm-tools","mcp","mcp-server","mcp-telegram","model-context-protocol","mtproto","telegram","telegram-api","telegram-automation","telegram-client","telegram-mcp","telegram-userbot","vscode"],"created_at":"2026-06-24T01:02:03.463Z","updated_at":"2026-06-24T01:02:16.482Z","avatar_url":"https://github.com/beautyfree.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"20%\" src=\"assets/logo.png\" alt=\"mcp-telegram\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003emcp-telegram\u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eTelegram MCP server\u003c/b\u003e for Claude, Codex, Cursor, Claude Code, VS Code, Cline, Windsurf, and other MCP clients. Real Telegram user account via MTProto, browser-based local sign-in, 100+ tools. Need lazy-loading + lower context cost? See \u003ca href=\"https://github.com/beautyfree/telegram-agent\"\u003e\u003cb\u003etelegram-agent\u003c/b\u003e\u003c/a\u003e, the skill-based companion.\n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![npm version](https://badgen.net/npm/v/mcp-telegram)](https://www.npmjs.com/package/mcp-telegram)\n[![License](https://img.shields.io/npm/l/mcp-telegram)](https://github.com/beautyfree/mcp-telegram/blob/main/LICENSE)\n[![Node](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](package.json)\n\n\u003c/div\u003e\n\nA [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that connects [Claude Desktop](https://claude.ai), [Codex CLI](https://github.com/openai/codex), [Cursor](https://cursor.com), [Claude Code](https://claude.ai/code), VS Code, Cline, Windsurf, Goose, and any other MCP-compatible client to a real Telegram user account via [MTProto](https://core.telegram.org/mtproto)—so your agent can read, search, send, moderate, and manage Telegram chats from chat or automated tool calls instead of clicking through the Telegram UI.\n\n**Use it to:** read dialogs and search messages globally · send/edit/forward/react/poll · download media and transcribe voice notes · moderate channels (ban/restrict/promote, invite links, slow-mode, admin log, forum topics) · manage stories, contacts, drafts, notifications, folders, privacy · or fall through to the raw MTProto bridge for anything else. All against a single signed-in user account—no bot required.\n\n\u003e [!WARNING]\n\u003e This server signs in as a real Telegram user (not a bot). Sessions live in `~/.telegram-agent/`. Treat that directory like a password.\n\n## Prerequisites\n\n1. Node.js `\u003e=20`\n2. Telegram API credentials from [my.telegram.org/apps](https://my.telegram.org/apps) — `api_id` and `api_hash`\n\n## Want a lighter transport?\n\nThis package is the **MCP server** — every tool schema (~12,700 tokens) sits in your agent's context on every turn. Good for any MCP client and for hosted runtimes that can't shell out.\n\nIf your agent is **Claude Code / Codex CLI / Cursor / Gemini CLI / Cline / Windsurf**, there's a [companion package — `telegram-agent`](https://github.com/beautyfree/telegram-agent) — that ships the same Telegram surface as a [universal agent skill](https://code.claude.com/docs/en/skills). The agent only loads the skill instructions when your prompt mentions Telegram — **~50× lower context cost** in idle. Standalone (no MCP server in the loop), but uses the same `~/.telegram-agent/` session store as this package — sign in once, use either or both.\n\n```bash\nnpm i -g telegram-agent\ntelegram-agent login\nnpx skills add beautyfree/telegram-agent -a claude-code -g\n```\n\nContinue below for the MCP install path.\n\n## Install\n\n**Option A — automatic, all clients:**\n\n```bash\nnpx add-mcp mcp-telegram \\\n  --env TELEGRAM_API_ID=123456 \\\n  --env TELEGRAM_API_HASH=abc...\n```\n\n`add-mcp` (from Neon) writes the correct config for Claude Desktop, Claude Code, Cursor, VS Code, Codex, Gemini CLI, Cline, Zed, Goose, OpenCode, and others. Pick the client in the interactive prompt.\n\n\u003e [!IMPORTANT]\n\u003e Both env vars are required. Get them from [my.telegram.org/apps](https://my.telegram.org/apps).\n\n**Option B — manual config:**\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClaude Desktop\u003c/b\u003e (\u003ccode\u003eclaude_desktop_config.json\u003c/code\u003e)\u003c/summary\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"telegram\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-telegram\"],\n      \"env\": {\n        \"TELEGRAM_API_ID\": \"123456\",\n        \"TELEGRAM_API_HASH\": \"abc...\"\n      }\n    }\n  }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCursor\u003c/b\u003e (\u003ccode\u003e~/.cursor/mcp.json\u003c/code\u003e)\u003c/summary\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"telegram\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-telegram\"],\n      \"env\": {\n        \"TELEGRAM_API_ID\": \"123456\",\n        \"TELEGRAM_API_HASH\": \"abc...\"\n      }\n    }\n  }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eVS Code\u003c/b\u003e (\u003ccode\u003e.vscode/mcp.json\u003c/code\u003e)\u003c/summary\u003e\n\n```json\n{\n  \"servers\": {\n    \"telegram\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-telegram\"],\n      \"env\": {\n        \"TELEGRAM_API_ID\": \"123456\",\n        \"TELEGRAM_API_HASH\": \"abc...\"\n      }\n    }\n  }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClaude Code\u003c/b\u003e\u003c/summary\u003e\n\n```bash\nclaude mcp add telegram \\\n  -e TELEGRAM_API_ID=123456 \\\n  -e TELEGRAM_API_HASH=abc... \\\n  -- npx -y mcp-telegram\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCodex CLI\u003c/b\u003e (\u003ccode\u003e~/.codex/config.toml\u003c/code\u003e) — \u003ca href=\"https://github.com/openai/codex\"\u003einstall\u003c/a\u003e\u003c/summary\u003e\n\n```toml\n[mcp_servers.telegram]\ncommand = \"npx\"\nargs = [\"-y\", \"mcp-telegram\"]\nenv = { TELEGRAM_API_ID = \"123456\", TELEGRAM_API_HASH = \"abc...\" }\n```\n\u003c/details\u003e\n\n## First-time sign in\n\nAsk your agent:\n\n\u003e Sign in to my Telegram.\n\nThe agent calls the `login` tool. A browser tab opens. Enter your phone number, the SMS code, and 2FA password if you have one. The tab shows a green checkmark — you can close it. The session is now stored locally and the agent can read your Telegram.\n\nTo add another account, ask the agent to call `login` again.\n\n## Tools\n\n102 tools covering the full Telegram user-account surface. Common ones below; the rest are grouped under collapsibles. Every tool accepts an optional `accountId` (omit when only one account is signed in). `peer` accepts a numeric chat id, an `@username`, or the literal `\"me\"` (Saved Messages).\n\n**Top of the menu:**\n\n| Tool | What it does |\n| --- | --- |\n| `login` | Open the browser-based sign-in flow. Adds an account. |\n| `list_accounts` | List signed-in accounts. |\n| `list_dialogs` | List dialogs/chats/channels. Filters: `unread`, `archived`, `ignorePinned`, `folder`, `limit`. |\n| `list_messages` | List messages in a dialog. Newest first. |\n| `search_messages` | Search inside one dialog: `query`, `filter` (photos/videos/url/voice/...), `fromUser`, date range. |\n| `search_global` | Search across every chat you have. |\n| `search_dialogs` | Find dialogs by name/title/username substring. |\n| `send_message` | Send text. Supports `replyTo`, `topMsgId`, `parseMode`, `schedule`, `silent`. |\n| `send_file` | Send a file (local path or `https://` URL). Pass an array for an album. |\n| `download_media` | Save the media on a message to disk. |\n| `transcribe_message` | Transcribe a voice/video note (Premium). |\n| `invoke_mtproto` | Call any raw MTProto method by name. Auto-resolves `peer`/`channel`/`user` strings. |\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSessions (local)\u003c/b\u003e (4)\u003c/summary\u003e\n\nThese are local-only: they manage which Telegram sessions live in `~/.telegram-agent/` and the settings UI. No Telegram API call beyond the sign-in flow itself.\n\n| Tool | What it does |\n| --- | --- |\n| `list_accounts` | List signed-in accounts. |\n| `login` | Browser-based sign-in. Adds an account. |\n| `logout` | Drop a local session and revoke it on Telegram. |\n| `open_settings` | Open the local settings page (tool surface + read-only). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eProfile\u003c/b\u003e (5)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `get_me` | Return the profile of the authenticated user. |\n| `update_profile` | Change own first/last name and bio. |\n| `update_my_username` | Set or clear own `@username`. |\n| `set_birthday` | Set the account birthday. |\n| `set_profile_photo` | Upload a new avatar (local path or URL). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDialog discovery\u003c/b\u003e (5)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `list_dialogs` | List dialogs. Filters: `unread`, `archived`, `ignorePinned`, `folder`, `limit`. |\n| `search_dialogs` | Find dialogs by name/title/username substring. |\n| `resolve_username` | Resolve `@username` to a user/channel/chat entity. |\n| `list_folders` | List custom dialog folders (chat filters). |\n| `list_contacts` | List contacts. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMessages — read \u0026 search\u003c/b\u003e (6)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `list_messages` | List messages in a dialog. |\n| `search_messages` | Search inside one dialog (text, type filter, sender, date range). |\n| `search_global` | Search across every chat. |\n| `get_message` | Fetch one or more messages by id. |\n| `get_message_reactions` | Get reactions on messages. |\n| `mark_as_read` | Mark messages read up to an id. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMessages — write\u003c/b\u003e (8)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `send_message` | Send text. |\n| `edit_message` | Edit a previously sent message. |\n| `delete_messages` | Delete by id (optionally revoke for all). |\n| `forward_messages` | Forward messages between dialogs. |\n| `pin_message` / `unpin_message` | Pin / unpin in a dialog. |\n| `send_reaction` | Set reactions on a message. |\n| `send_message_to_phone` | Send to a phone number, auto-creates a temporary contact. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMedia\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `send_file` | Send a file (path or URL). Albums via array. |\n| `download_media` | Save a message's media to disk. |\n| `download_profile_photo` | Save a peer's avatar to disk. |\n| `transcribe_message` | Transcribe voice/video (Premium). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003ePolls\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `send_poll` | Send a poll. Supports quiz, multiple-choice, anonymous, close period. |\n| `vote_poll` | Cast a vote. |\n| `close_poll` | Finalize a poll. |\n| `get_poll_results` | Fetch tally. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eReactions\u003c/b\u003e (3)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `send_reaction` | Set emoji reactions on a message. |\n| `get_message_reactions` | Read reactions. |\n| `set_default_reaction` | Set account-wide default. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eStories\u003c/b\u003e (6)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `list_stories` | Feed of contacts' stories. |\n| `get_peer_stories` | One peer's stories. |\n| `send_story` | Post a story (photo or video). |\n| `delete_story` | Delete own stories. |\n| `view_story` | Mark stories viewed. |\n| `get_story_viewers` | List who viewed your story. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eChannel / group moderation\u003c/b\u003e (11)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `ban_user` | Full ban (optional `untilDate`). |\n| `unban_user` | Lift restrictions. |\n| `restrict_user` | Apply a custom rights mask. |\n| `promote_admin` | Grant admin rights (with rank). |\n| `demote_admin` | Strip admin rights. |\n| `invite_user` | Add users to a channel/supergroup. |\n| `kick_participant` | Kick from chat/channel. |\n| `get_participant` | Single participant info. |\n| `list_participants` | Members with filter (admins/banned/bots/...) and substring search. |\n| `delete_user_history` | Remove every message by a user. |\n| `get_admin_log` | Recent admin events with event-type filter. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eChannel / group settings\u003c/b\u003e (12)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `edit_title` | Change title (works for channels, supergroups, and basic groups). |\n| `edit_about` | Change description. |\n| `edit_photo` | Change avatar (path or URL). |\n| `update_username` | Set/clear public `@username`. |\n| `check_username` | Check availability. |\n| `set_slow_mode` | Set slow-mode seconds. |\n| `toggle_signatures` | Author signatures on channel posts. |\n| `toggle_pre_history_hidden` | Hide history from new members. |\n| `toggle_join_request` | Require admin approval to join. |\n| `leave_channel` | Leave a channel/supergroup. |\n| `get_channel_info` | Extended info (about, counts, linked chat, slow-mode). |\n| `get_user_info` | Extended user info (bio, common chats). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eChannel / group lifecycle\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `create_channel` | New broadcast channel or supergroup (optional forum mode). |\n| `delete_channel` | Permanently delete. |\n| `migrate_chat` | Basic group → supergroup. |\n| `transfer_ownership` | Hand over creator rights (requires 2FA password). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eInvite links\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `create_invite_link` | New link with optional expiry, usage cap, join-request gate. |\n| `list_invite_links` | List active or revoked links. |\n| `revoke_invite_link` | Revoke a specific link. |\n| `list_invite_joiners` | List users that joined via a link. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eForum topics\u003c/b\u003e (3)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `list_topics` | List forum topics. |\n| `create_topic` | Create a new topic. |\n| `edit_topic` | Rename, re-icon, close, hide. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDrafts\u003c/b\u003e (3)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `save_draft` | Save a draft for a dialog. |\n| `clear_draft` | Drop the draft for a dialog. |\n| `list_drafts` | List all dialog drafts. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eNotifications\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `mute_peer` | Mute a chat (optional `untilDate`). |\n| `unmute_peer` | Unmute. |\n| `get_notify_settings` | Read settings. |\n| `set_notify_settings` | Update mute, previews, sound, story-mute. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFolders (chat filters)\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `create_folder` | New folder with include/exclude rules. |\n| `edit_folder` | Replace folder rules. |\n| `delete_folder` | Remove a folder. |\n| `reorder_folders` | Set display order. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eContacts\u003c/b\u003e (4)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `list_contacts` | All contacts. |\n| `add_contact` | Add a user to contacts. |\n| `delete_contact` | Remove users from contacts. |\n| `search_contacts` | Search contacts + global directory. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003ePrivacy \u0026 blocking\u003c/b\u003e (5)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `block_user` / `unblock_user` | Block / unblock. |\n| `list_blocked` | Block list. |\n| `get_privacy` | Read a privacy key. |\n| `set_privacy` | Update a privacy key (mode + allow/disallow lists). |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eStickers\u003c/b\u003e (3)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `get_my_stickers` | Installed sticker sets. |\n| `install_sticker_set` | Install by short name. |\n| `add_recent_sticker` | Pin a sticker to recent. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003ePremium boosts\u003c/b\u003e (2)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `get_my_boosts` | List your boost slots. |\n| `apply_boost` | Apply slots to a channel. |\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eBots \u0026 raw MTProto\u003c/b\u003e (2)\u003c/summary\u003e\n\n| Tool | What it does |\n| --- | --- |\n| `get_inline_bot_results` | Run an inline bot query. |\n| `invoke_mtproto` | Call any MTProto method by qualified name (e.g. `messages.SendMessage`, `stories.GetAllStories`). String values for `peer`/`channel`/`user`/`fromPeer`/`toPeer`/`bot`/`chat` are auto-resolved to InputPeer / InputUser. |\n\n\u003c/details\u003e\n\n### Gating which tools are exposed\n\nThree env vars, applied in order:\n\n| Variable | Effect |\n| --- | --- |\n| `MCP_TELEGRAM_READONLY=1` | Hide every destructive / mutating tool. |\n| `MCP_TELEGRAM_TOOLS=name1,name2,prefix*` | Strict allowlist — only these tools register. |\n| `MCP_TELEGRAM_DISABLE=name1,prefix*` | Blocklist applied after the allowlist. |\n\nExamples:\n\n```bash\nMCP_TELEGRAM_READONLY=1                                    # read-only agent\nMCP_TELEGRAM_TOOLS='login,list*,search*,get*'              # discovery-only\nMCP_TELEGRAM_DISABLE='delete*,ban*,kick*,create_channel,delete_channel,transfer_ownership,invokeMtproto'  # safer write set\n```\n\n## Environment\n\n| Variable | Required | Default | Notes |\n| --- | --- | --- | --- |\n| `TELEGRAM_API_ID` | yes | — | From my.telegram.org/apps. If unset, the auth page prompts for it and saves to `state.json`. |\n| `TELEGRAM_API_HASH` | yes | — | Same as above. |\n| `TELEGRAM_AGENT_HOME` | no | `~/.telegram-agent` | State + per-account session storage. Legacy `MCP_TELEGRAM_HOME` still accepted. If only `~/.mcp-telegram` exists from a previous install, it's used automatically. |\n| `TELEGRAM_AGENT_DOWNLOADS` | no | `$TELEGRAM_AGENT_HOME/downloads` | Where `download_media` / `download_profile_photo` save files. Legacy `MCP_TELEGRAM_DOWNLOADS` still accepted. |\n| `MCP_TELEGRAM_READONLY` | no | — | Set to `1`/`true`/`yes` to hide every destructive tool. |\n| `MCP_TELEGRAM_TOOLS` | no | — | Strict allowlist. Comma-separated tool names; supports `prefix*` wildcards. If set, anything not matched is hidden. |\n| `MCP_TELEGRAM_DISABLE` | no | — | Blocklist applied after the allowlist. Same syntax. |\n| `LOG_LEVEL` | no | `info` | `debug` for verbose stderr. |\n\n### Choosing which tools the agent sees\n\nThe three gating vars stack — `MCP_TELEGRAM_READONLY` → `MCP_TELEGRAM_TOOLS` → `MCP_TELEGRAM_DISABLE`.\n\n```bash\n# Read-only agent — every mutating tool is hidden\nMCP_TELEGRAM_READONLY=1\n\n# Discovery-only — only login + the list/search/get tools\nMCP_TELEGRAM_TOOLS='login,list*,search*,get*,resolveUsername'\n\n# Allow writes but keep destructive ones away from the agent\nMCP_TELEGRAM_DISABLE='delete*,ban*,kick*,create_channel,delete_channel,transfer_ownership,invokeMtproto'\n\n# Specific surface: read + send/edit only\nMCP_TELEGRAM_TOOLS='login,list_accounts,list_dialogs,list_messages,search_messages,search_global,send_message,editMessage'\n```\n\nIn an MCP client config, drop these into the same `env` block as `TELEGRAM_API_ID`/`TELEGRAM_API_HASH`. To verify, re-open your client — the tools the server advertises are exactly the ones registered after the gates run.\n\n## Data layout\n\n```\n~/.telegram-agent/\n├── state.json          known accounts (no secrets in here)\n└── sessions/\n    └── \u003caccount_id\u003e/   per-account MTProto session\n```\n\nIf a Telegram session is invalidated server-side (logged out from another device, password rotated, etc.), the next tool call returns an error telling the agent to call `login` to re-authorize.\n\n## Development\n\n```bash\ngit clone https://github.com/beautyfree/mcp-telegram\ncd mcp-telegram\nnpm install\necho \"TELEGRAM_API_ID=...\\nTELEGRAM_API_HASH=...\" \u003e .env\nnpm run dev\n```\n\nLayout:\n\n```\nsrc/\n├── index.ts           bin entry — stdio MCP server, tool registrations\n├── telegram.ts        MTProto client + login state machine\n├── auth-browser.ts    ephemeral HTTP server that drives the browser flow\n├── auth-page.ts       inline HTML for the auth page\n├── state.ts           persistent state in ~/.telegram-agent/\n└── logger.ts\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003eAlso known as\u003c/summary\u003e\n\nTelegram MCP · MCP Telegram · Telegram MCP server · Telegram for Claude · Telegram for Cursor · Telegram for Claude Code · Telegram for VS Code · Telegram for Codex · Telegram for Cline · Telegram for Windsurf · Telegram for AI agents · Telegram MTProto MCP · Telegram user-account MCP · Telegram automation MCP · Model Context Protocol Telegram · MCP server Telegram · gramjs MCP\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeautyfree%2Fmcp-telegram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeautyfree%2Fmcp-telegram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeautyfree%2Fmcp-telegram/lists"}