Telegram CLI MCP
Provides access to Telegram through an existing tg CLI session, letting MCP clients discover and describe Telegram RPC methods and invoke explicitly allowed methods on the user's behalf.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Telegram CLI MCP
Give an MCP client access to Telegram through a tg session you already use. The bridge asks the installed CLI for its Telegram schema and forwards approved RPCs to that CLI. When the schema changes, the same MCP tools can discover and describe the new methods without adding wrapper code or reconfiguring each client.
Telegram MCP servers such as lexfrei/mcp-tg and dryeab/mcp-telegram provide their own Telegram client and curated tools. Telegram CLI MCP focuses on session reuse and schema discovery. Its three MCP tools are stable even as the Telegram method catalog changes.
MCP tool | What it does |
| Search the installed catalog by name. Results are paginated and indicate which methods may be invoked. |
| Inspect the fields and types of a method or TL constructor. |
| Pass a method name and JSON arguments to |
Install
Use Python 3.11 or newer on macOS or Linux. The bridge currently requires the schema RPC fork of tg. The standard gotd/cli 0.12.1 release lacks tg rpc list, tg rpc describe, and tg rpc invoke. Build the compatible binary into a separate path with Go 1.26 or newer.
git clone --branch codex/telegram-rpc-discovery --single-branch https://github.com/skyzer/cli.git tg-rpc-source
mkdir -p "$HOME/.local/bin"
cd tg-rpc-source
git switch --detach a68c75683aacef377f638fed6fee68cc9ec3bc37
go build -o "$HOME/.local/bin/tg-rpc" ./cmd/tgInstall the Python bridge in an isolated environment. The install targets an immutable GitHub release tag. The build backend and direct Python dependencies are pinned to the tested versions.
pipx install 'git+https://github.com/skyzer/mcp-telegram-cli.git@v0.1.0'Related MCP server: telegram-mcp
Connect an MCP client
Register the bridge as one stdio MCP server. This example uses the local MCP JSON shape understood by Claude Desktop and Cursor. For a gateway or another client, use the same executable and argument list in its stdio configuration.
{
"mcpServers": {
"telegram": {
"command": "/absolute/path/to/telegram-cli-mcp",
"args": [
"--tg", "/absolute/path/to/tg-rpc",
"--config", "/absolute/path/to/existing/gotd.cli.yaml",
"--account", "your-existing-account-label",
"--allow", "help.getConfig"
]
}
}
}Run the bridge with the same OS user, config, account label, and storage access as the existing CLI. That includes access to the macOS Keychain if tg uses it. telegram_list and telegram_describe work without a Telegram login. telegram_invoke needs the existing authenticated session. Remove the example --allow pair for discovery-only mode. Repeat --allow to grant more exact method names.
Try telegram_list with {"query":"help.getConfig"}, then telegram_describe with {"name":"help.getConfig"}. To invoke it, pass {"method":"help.getConfig","params":{}}. When a field takes an abstract TL type, specify the constructor in _, for example {"_":"inputPeerSelf"}.
Pass 64-bit fields such as access_hash and random_id as decimal strings, for example "9007199254740993". This preserves precision in JavaScript-based clients. The bridge rejects integer numbers outside JavaScript's safe range and returns large integers as decimal strings.
Each invocation takes a file lock. It defaults to .tg-session.lock next to the config, and --lock-file can point at a writable lock shared with another process. A lock only coordinates programs that use the same file. If an importer uses this session, configure its existing lock here or arrange for the processes to run at different times.
If you attach the bridge to a remote MCP gateway, have that gateway authenticate callers and authorize tools. Allowed methods run with the Telegram account's privileges. Keep the tg configuration and session on the host. Upgrading tg-rpc updates what agents can discover, while new methods need an explicit --allow before an agent can run them.
Develop
python -m pip install -e .
python -m unittest discover -s tests -vTests exercise the MCP tools with a disposable CLI fixture and require no Telegram credentials. Use tg-rpc --output json rpc list to check the real binary's catalog.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search, inspect and invoke every public tool on Invokera through one MCP connection.
An authenticated remote MCP server for user-owned devices and one-shot capability invocation.
Schedule posts, read analytics and manage Telegram channels in TGStudio from any MCP client.
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables searching, inspecting, and calling Telegram Bot API methods via five stable MCP tools, with automatic schema updates from official documentation.729 npmMIT
- AlicenseBqualityDmaintenanceEnables MCP clients to operate a Telegram account as a userbot, providing tools for reading and sending messages, searching chats and contacts, managing media, and performing other account actions via MTProto with a locally encrypted session.28MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to drive a real Telegram account, exposing chats, messages, media, secret chats, admin rights, invite links, Mini Apps, and multi-account routing as callable tools.33GPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible clients such as Claude and Cursor to access and manage Telegram accounts, chats, messages, contacts, media, folders, and admin operations through exposed tools.Apache 2.0