Telegram MCP README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Telegram MCP listing page.

Telegram MCP

Use your own Telegram account from an MCP client.

CI status on main GPL-3.0-or-later license Latest release tag Core test coverage floor 85 percent Built with Rust 1.100.1 Runs on Windows and Linux 64-bit Install from GitHub releases or Cargo Command and migration documentation Repository size grammers 0.12 on Telegram layer 234 391 native MCP tools

MCP Badge M8ven Score M8ven Agent Verified M8ven Verified Support donations

Telegram MCP reads and searches chats, sends messages, handles media, and manages groups and channels within your account's Telegram permissions. It uses grammers for Telegram API layer 234, rmcp for MCP, and kiaro-secret-chat for native MTProto 2.0 secret chats. The tag badge tracks the published version; Cargo.lock records the exact dependency versions and Git revisions for this checkout. The server does not need Python or a virtual environment.

Releases and tags

The tag badge updates automatically from GitHub tags. GitHub Releases hosts the signed archives, each with a .sha256 checksum and a .sig signature. Each release also includes SHA256SUMS, SHA256SUMS.sig, publisher-cert.pem, and publisher-key.pem. GitHub records build provenance attestations for the archives and signed checksum files. See the installation guide for verification instructions.

Install

Choose an archive from GitHub Releases for Windows or Linux on x64 or arm64. After extraction, the server is at bin/telegram-mcp.exe on Windows and bin/telegram-mcp on Linux. If the Linux file is not executable, run chmod +x bin/telegram-mcp.

To build from source, install Rust 1.100.1 through rustup and a native linker. Windows needs the MSVC build tools and Windows SDK. Linux needs its C compiler, linker and system development libraries. In a checkout of the release source, run:

bash
cargo build --locked --release --bin telegram-mcp --bin emoji-studio --bin operator-plugin

Cargo puts the executables in target/release/. See installation for optional media dependencies, artifact verification and state configuration.

Authorize an account

Copy the source tree's .env.example to a private .env. Set TELEGRAM_API_ID and TELEGRAM_API_HASH using your application credentials from my.telegram.org/apps. From a terminal with telegram-mcp on PATH, run:

bash
telegram-mcp --config .env login --account default
telegram-mcp --config .env accounts --json

Enter login codes and two-factor passwords at the terminal prompt. Keep the .env and native session files private. If you already use a Python installation, read the migration notes before replacing it. The native importer validates supported legacy sessions without changing their source files and refuses conflicting or active authorization.

Windows launchers

Run these with PowerShell 7 from the extracted Windows archive or a source checkout with a release build. If the binary is stored elsewhere, set TELEGRAM_MCP_BINARY to its full path.

powershell
pwsh -NoProfile -File .\start-mcp.ps1
pwsh -NoProfile -File .\Manage-Accounts.ps1

start-mcp.ps1 launches the compiled server. Manage-Accounts.ps1 uses the native CLI to manage accounts.

Connect an MCP client

Choose one of these stdio configurations. Replace /path/to/Telegram-mcp with your installation's absolute path. For Cargo builds, use target/release/ instead of bin/. On Windows, use telegram-mcp.exe and double each backslash (\\) in JSON strings.

Standard configuration (default system temp and cache)

config.json
{
  "mcpServers": {
    "telegram-mcp": {
      "command": "/path/to/Telegram-mcp/bin/telegram-mcp",
      "args": ["--config", "/path/to/Telegram-mcp/.env", "serve"]
    }
  }
}

Isolated temp and cache configuration

Create tmp/ and .cache/ inside the installation folder. The server stores private state in .state/. Programs that honor the temp and cache variables use the paths below. On Linux, set TMPDIR to the same tmp/ path for programs that use it.

config.json
{
  "mcpServers": {
    "telegram-mcp": {
      "command": "/path/to/Telegram-mcp/bin/telegram-mcp",
      "args": ["--config", "/path/to/Telegram-mcp/.env", "serve"],
      "env": {
        "TELEGRAM_STATE_DIR": "/path/to/Telegram-mcp/.state",
        "TEMP": "/path/to/Telegram-mcp/tmp",
        "TMP": "/path/to/Telegram-mcp/tmp",
        "XDG_CACHE_HOME": "/path/to/Telegram-mcp/.cache"
      }
    }
  }
}

Shared HTTP service and stdio bridge

To share one service across clients, set TELEGRAM_HTTP_TOKEN in the private .env, then run:

bash
telegram-mcp --config .env serve --http 127.0.0.1:8765

Point HTTP clients at http://127.0.0.1:8765/mcp and set the bearer token in the client. To attach a stdio client to the local service, use bridge instead of serve in its arguments. A non-loopback listener requires TLS with TELEGRAM_HTTP_TLS_CERT and TELEGRAM_HTTP_TLS_KEY and a private token of at least 32 characters. Use HTTPS and keep certificate verification enabled. See shared HTTP setup for host allowlists and bridge behavior. After connecting, check tools/list and call list_accounts to verify the intended account.

Logs and private state

Run telegram-mcp state-path to locate the private state directory. Direct server launches write mcp.log there, and the logger rotates it to mcp.log.1 when it reaches its size limit. TELEGRAM_MCP_LOG_FILE=off sends diagnostics to stderr. The server reserves stdout for MCP traffic.

On Windows, the launchers write logs/start-mcp_YYYY-MM-DD_HH-mm-ss_UTC.log and logs/Manage-Accounts_YYYY-MM-DD_HH-mm-ss_UTC.log inside the private state directory. They use UTC timestamps and add a suffix if a name is taken. Each launcher keeps ten logs; start-mcp.ps1 also keeps ten rotated parts. Runtime diagnostics exclude raw tool arguments, Telegram message text, authorization keys and login codes. Review excerpts before sharing them. See service operation for logging and recovery limits.

Tools and access

The server has 391 native tools: 356 cloud tools, including standalone transcribe_audio, and 35 secret-chat tools. See the command catalogue and API coverage. Use exposure filters to choose which tools a client can call. Telegram permissions, Premium requirements and server limits still apply.

view_video returns sampled frames with an optional local Whisper transcript. The stdio bridge reconnects after owner restart or session expiry. If the owner may have executed a mutation but its reply was lost, inspect the result before retrying.

Fetching content and marking it read are separate operations. The server returns integers that JavaScript cannot represent exactly as decimal strings. Message entity offsets use UTF-16. File tools stay within configured roots.

Owner approvals

To approve from Telegram, create a dedicated bot with BotFather. Set TELEGRAM_APPROVAL_BOT_TOKEN and the comma-separated Telegram user IDs in TELEGRAM_APPROVAL_OWNER_IDS in your private .env. TELEGRAM_APPROVAL_OWNER_ID is the fallback for one owner. Each owner must open the bot's private chat and send /start. Restart the service after changing these settings. Use one running service per bot token so another poller or webhook cannot take its updates.

The bot offers Approve once, Deny, and Always approve when the request names a specific chat. Permanent approvals apply to that account, tool, and chat. /pending lists waiting requests, /always and /folders let owners review and revoke grants, and /reset_always removes permanent chat approvals after confirmation. Folder grants can authorize specific paths outside configured roots. Protected paths stay blocked.

/accounts lists configured account labels and their last observed connection status. It does not open a new session.

Use /bypass to see the current setting and choose a duration. The presets are 1h, 6h, 1d, 7d and 30d (30 days). Send /bypass 2h30m or /bypass 90m for a custom duration. /bypass forever keeps prompts off until you send /bypass off. Only a configured owner can change this setting. It skips approval prompts for otherwise permitted requests. Protected paths and approval chats stay blocked, sealed approval codes stay redacted, and chat allowlists and Telegram permissions still apply.

The default wait is 300 seconds. Set TELEGRAM_APPROVAL_TIMEOUT_SECONDS to a value from 5 to 3,600 seconds, and give your MCP client enough time to wait. TELEGRAM_APPROVAL_BOT_USERNAME optionally supplies the bot's username so the service can protect it before the first Bot API lookup. The bot chat is off-limits to MCP tools.

If the bot is unset or the service cannot deliver a prompt to any owner, use telegram-mcp approve <fingerprint> in your terminal and retry the same operation. A denial or an expired prompt does not run the operation.

Secret chats

Grammers Secret Chat provides native MTProto 2.0 secret chats over the same account connection as ordinary chats. The server commits incoming encrypted updates to durable storage before acknowledging them. All 35 secret-chat tools are subject to the same MCP exposure filters and safeguards. When the connected backend receives a ChatRequested update, it automatically attempts the incoming handshake. Use accept_secret_chat with a known chat_id to accept a pending incoming request explicitly. This tool changes chat state and is subject to owner approval.

On first open of an account with a supported legacy secret-chat store, the server verifies the authorization identity, makes a read-only backup and migrates the store before starting normal update consumption. An imported session without a cached self identity may first need a request that suppresses updates to verify its owner. See secret-chat store migration.

Telegram Operator plugin

telegram-operator 1.6.0 ships six workflow skills in five formats: Portable Agent Plugins 1.0.0, Claude Code, Codex, Cursor and Antigravity. The skills cover chat migration, backup and restore, access audits, bot and Mini App reconstruction, full bot cloning with parity checks, and reproducing message formatting and custom emoji. The plugin bundles no MCP server configuration. Configure the MCP server separately and authorize the account. For plugin setup, see installation.

Docker

Terminal
docker build --tag telegram-mcp:local .
docker run --rm -i --env-file .env --volume telegram-mcp-state:/data telegram-mcp:local serve

Keep the state volume when replacing the container. For a shared HTTPS service, set the token and certificate paths before running docker compose up --build -d. Compose mounts the certificate and key read-only, binds port 8765 to loopback, and keeps private state in its telegram-state volume. See Docker installation.

Benchmarks

Both measurements come from five cold runs on the same Windows 11 x64 host. The Python baseline uses main at 72a4aed, where startup measures module import and tool registration (3,440 ms import; 4,830 ms process wall) and disk footprint includes .venv/, package source and scripts. The Rust 3.0.0 release build measures cold stdio initialize plus tools/list for all 352 native tools, live process working-set RSS via GetProcessMemoryInfo, 50,000 serde_json UTF-8 string serializations, and the compiled executable size (34.73 MB for telegram-mcp.exe; 51.42 MB for all three binaries combined).

MeasurementPython baselineRust 3.0.0Delta
Median cold startup and tool listing3,440.09 ms36.53 ms-98.94% (94.2x faster)
Median working-set RSS124.32 MB15.98 MB-87.15% (7.8x lower)
Median time to serialize 50,000 JSON strings126.97 ms6.77 ms-94.67% (18.8x faster)
Runtime disk footprint206.01 MB34.73 MB-83.14% (5.9x smaller)

The repository-size badge shows the size GitHub reports for the repository. The disk footprint above measures the installed runtime.

Development

bash
cargo fmt --all --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-features -- --test-threads=1

CI checks the four release targets, enforces an 85% application-core line coverage floor, and runs the Windows launcher tests. CI also includes CodeQL and Gitleaks workflows. Offline tests do not establish live Telegram behavior. See contributing for the CI evidence and the reproduction bundle.

Author

KiaroSama (Kiaro.Sama.Dev@gmail.com)

License

Copyright KiaroSama. Telegram MCP is licensed under GPL-3.0-or-later; see NOTICE for third-party attributions.

Donate

Send donations only on the network listed for the address.

CurrencyNetworkAddress
Bitcoin (BTC)Bitcoinbc1qmth5m03pu5hujw5xw5jmywam3jj3sqwqupesdt
USDT, BNB, USDC, etc.BEP200x0Bd0BA443a8B9cf15922bf7f0Bb0a4b495fD06Ef
USDT, TRX, USDC, etc.TRC20TWBA3xFTqgZAeAYMxqo85xWnzvty3DcAhw
Ethereum (ETH)ERC200x0Bd0BA443a8B9cf15922bf7f0Bb0a4b495fD06Ef
TONTONUQCN8Umo_OfOWqImZetQsrNStPcmLkMAKajFyiCOhso23NDb
Litecoin (LTC)LTCltc1qntqnnrunadurnw4cshv3qgspywrueyyeyngwuy
Solana (SOL)Solana7B2wkczUjmkDhETwQuknBL8sUsbuV7nErxc317TmQuwR
Polygon (POL)Polygon0x0Bd0BA443a8B9cf15922bf7f0Bb0a4b495fD06Ef