# tgcloud — Telegram serverless bots [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/sdamarketing/tgcloud_mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 711  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/tgcloud-telegram-serverless-bots

## Description
MCP server for Telegram serverless bots: lifecycle, deploys, migrations, webhooks via tgcloud CLI

## Tools
Capabilities this server exposes over MCP:

- **create_project** — Scaffolds a serverless bot with `npm create @tgcloud/bot <name>` inside parent_dir. Needs Node.js 18+ and the npm registry. Does not overwrite existing files.
- **init_project** — Scaffolds tgcloud into an existing directory (tgcloud init, offline): tgcloud/schema.js, handlers/, endpoints/, lib/, tgcloud.jsonc, AGENTS.md, docs/tgcloud-sdk.md. In a front-end project it detects the bundler, sets static.source, and adds an npm run deploy script (build, then push) without overwriting files you already have.
- **login_bot** — Runs `tgcloud login` with a CLI access token (app<id>:<secret> from @BotFather → your bot → Serverless → CLI Access → Access token). This is NOT the Bot API token (123456:AA…). The CLI wants a TTY, so the token is written to stdin with TGCLOUD_ASSUME_TTY=1 and masked in every tool result. NEVER show the token to the user after this call. In CI, set TGCLOUD_TOKEN and skip login.
- **add_module** — Scaffolds a module with `tgcloud add <target>` (tgcloud/ layout). handlers/<type> is one flat update handler (message, edited_message, callback_query, inline_query, chosen_inline_result, shipping_query, pre_checkout_query, poll, poll_answer, my_chat_member, chat_member, chat_join_request, message_reaction, channel_post, …). endpoints/<name> is a Mini App function (POST /api/<name>; identifier, not starting with a digit). lib/<path> is shared code and may be nested. Existing files are never overwritten.
- **upgrade** — One-time move of schema.js, handlers/, and lib/ from the project root into tgcloud/ (tgcloud upgrade). Required before other commands on projects created before CLI 0.2.0. Keeps the bot link; nothing needs to be redeployed. dry_run defaults to true and only prints the planned moves. Applying (dry_run: false) requires confirm: true.
- **status** — Shows local changes against the deployed snapshot (tgcloud status). Offline. Also reports stray .js files inside tgcloud/ that will not deploy, Mini App static diffs, and a webhook that is out of sync with the deployed handlers.
- **diff** — Line-by-line diff of the local project against the deployed snapshot (tgcloud diff). Offline.
- **push** — Uploads changed modules in one atomic batch (tgcloud push). Without files, mirrors the whole local module set (deletions included) and, when tgcloud.jsonc names static.source, uploads that build folder exactly as it is on disk. push never runs the bundler — after front-end edits call deploy, or the previous build goes live. A targeted push never deletes other modules and leaves static files untouched unless the target is the build folder. push does not migrate the database; it only prints pending schema changes. Adding or removing a handler can leave the webhook out of sync — follow with webhook_sync. force=true skips the revision check and requires confirm: true.
- **pull** — Makes the local project match the cloud: updates the snapshot and working files (tgcloud pull). Does not write the Mini App build folder.
- **fetch** — Updates the local snapshot of what is deployed without touching working files (tgcloud fetch). Use it before resolving a revision conflict.
- **reset** — DESTRUCTIVE: discards local module edits and restores the working tree from the last known cloud snapshot (tgcloud reset). Does not touch the Mini App build folder. Requires confirm: true.
- **deploy** — Runs `npm run build` when package.json has a build script, then `tgcloud push`. Use this after front-end edits: a plain push uploads static.source as it sits on disk and never runs the bundler, so it would publish a stale dist. Does not migrate the database and never passes --force. skip_build=true pushes without building. If there is no build script, only push runs.
- **run_handler** — Runs a handler or an endpoint on the platform using local files, without publishing them (tgcloud run). args is the payload (a Message for handlers/message, or the endpoint input) as a JSON5 object. ctx is the second argument (--ctx): the raw update for a handler, or initData for an endpoint, for example { initData: { user: { id: 1, first_name: "Ann" } } }. Returns the value, captured console logs, and elapsed time.
- **migrate** — Applies schema.js changes to the database (tgcloud migrate). push never does this. dry_run defaults to true (--dry-run): preview only. Applying (dry_run: false) requires confirm: true. apply "safe" passes --safe (auto-apply safe changes, skip warnings and manual steps). apply "yes" or omitting apply passes --yes (safe changes plus every warning, including .deprecated drops that delete data; manual type changes are still skipped). local: true diffs against the local schema.js instead of the deployed one (--local) and can be combined with either mode. Show the user the preview before applying. Warn when the preview contains a drop.
- **webhook_status** — Shows the platform-managed webhook (tgcloud webhook): URL, allowed_updates, pending update count, the last delivery error, and whether it is in sync with the deployed handlers. First step when a bot is silent. Deploying or removing a handler can leave it out of sync.
- **webhook_sync** — Points the webhook at the platform and rebuilds allowed_updates from deployed handlers (tgcloud webhook sync). Call it after adding or removing a handler. drop_pending=true discards updates Telegram already queued — destructive, requires confirm: true.

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

```json
"mcpServers": {
  "tgcloud-telegram-serverless-bots": {
    "command": "npx",
    "args": ["-y","tgcloud-mcp"],
    "env": {
      "TGCLOUD_CLI": "",
      "TGCLOUD_CLI_ARGS": "",
      "TGCLOUD_TIMEOUT_MS": ""
    }
  }
}
```

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

## Documentation

## What tgcloud — Telegram serverless bots does

tgcloud — Telegram serverless bots MCP server exposes 16 operations from the tgcloud CLI to MCP clients. It covers project scaffolding and initialization, linking a bot with an @BotFather token, adding handlers or modules, and upgrading older project layouts.

Synchronization tools report status and diffs, upload changes, deploy projects, retrieve cloud state, fetch data, or reset local state. A separate deployment operation builds before pushing, which is useful for Mini App front ends; a plain push uploads the build directory without running the bundler.

The server also runs handlers or endpoints without a deployment, applies or previews migrations, and reports or changes the bot webhook. MCP resources under `tgcloud://docs/*` provide English platform reference material covering project layout, imports, SDK areas, the CLI, and platform limits.

## How it works

The MCP process invokes the installed or remotely launched `tgcloud` CLI for each requested operation. An assistant can therefore turn requests such as creating a bot, testing a handler, or synchronizing a webhook into CLI-backed tool calls. Handler execution accepts test input such as chat data and message text, then returns output and logs.

Destructive operations have confirmation controls. Resetting, force-pushing, applying an upgrade, applying migrations, and synchronizing a webhook with pending updates to be dropped require `confirm: true`. The assistant is expected to show the pending change and request confirmation first. Bot tokens are sent to the CLI through standard input and masked in tool results.

## Setup and configuration

Install the npm package globally with Node.js 20 or newer, then run `tgcloud-mcp setup` to create the MCP configuration. Docker and source installation are also documented. A minimal stdio configuration starts the `tgcloud-mcp` command under an `mcpServers` entry.

The server supports `TGCLOUD_CLI` to select how the CLI starts, `TGCLOUD_CLI_ARGS` for arguments placed before the subcommand, and `TGCLOUD_TIMEOUT_MS` for the per-command timeout. The defaults launch the CLI through `npx`, use `tgcloud` as the command argument, and allow 120 seconds per operation.

The setup wizard can also install the Agent Plugin package. The repository includes an agent skill describing layouts, imports, recipes, and safety rules; it can be added with the documented skills command.

## Tools and capabilities

- Create and initialize serverless bot projects.
- Link a project to a Telegram bot using the BotFather token.
- Add handlers, endpoints, and library modules.
- Inspect differences and synchronize local and cloud project state.
- Push changes or build and deploy Mini App changes.
- Run handlers without deploying them.
- Preview or apply migrations with safe, local, and confirmation options.
- Inspect and synchronize webhooks.
- Read platform reference documents through MCP resources.

## Limitations and notes

tgcloud — Telegram serverless bots MCP server is an unofficial community project and is not affiliated with Telegram. It depends on the tgcloud CLI and its supported platform behavior; the official platform tool is `@tgcloud/cli`. Node.js 20 or newer is recommended for the MCP package, while the platform CLI requires Node.js 18 or newer.

Human documentation is available in English, Russian, Chinese, Arabic, German, and French, while tool descriptions and the agent skill are written in English.

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

