# secure-telegram-mcp [Health: Active]

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

## Description
The secure Telegram MCP server: encrypted sessions, folder-scoped access, read-only by default. Per-endpoint API keys.

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

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

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

## Documentation

## What secure-telegram-mcp does

secure-telegram-mcp exposes selected Telegram operations as MCP tools while keeping each client behind its own endpoint. An endpoint is tied to one logged-in Telegram account and can be limited to chosen chats, folders, or channels. Access can be read-only or can include individually enabled write permissions.

The design separates client credentials from Telegram credentials. MCP clients receive an endpoint token, while the local service owns the Telegram session and policy. Clients without a valid endpoint key can discover the tool list but cannot use it to access Telegram data.

Sessions and policy are encrypted at rest with AES-256-GCM and keys protected through scrypt. Unlocking can use machine-bound protection, a PIN, or a recovery keyfile. Only salted endpoint-key hashes are stored. A single Telegram account can serve multiple endpoints through one background connection.

## How it works

Run the setup command to provide Telegram app credentials, authenticate with a QR code or phone login, choose a session name, and create an endpoint. The endpoint picker assigns read or write permissions to selected chats and folders. Setup prints the endpoint token once in an MCP client configuration block.

Clients connect with the `connect` command and the `TELEGRAM_MCP_ENDPOINT_TOKEN` environment variable. The token identifies and authorizes the endpoint; client configuration does not need the Telegram `api_id`, `api_hash`, or PIN. When PIN protection is enabled, unlock the service separately with the `start` command so clients never handle the PIN.

Every tool call checks the current endpoint policy and token. Write requests pass access control, optional confirmation, quota, and audit stages in sequence. Rotating an endpoint key revokes access for live connections. Telegram text is sanitized and length-limited before being returned to the model, and writes, denials, and media egress are recorded in append-only NDJSON logs.

## Setup and configuration

Node.js 20.10 or newer and Telegram `api_id` and `api_hash` from `my.telegram.org/apps` are required. Start setup with:

```bash
npx -y secure-telegram-mcp setup
```

Choose QR login or phone-number authentication; two-step verification is handled during setup when enabled on the account. After creating an endpoint, place its token in one MCP client configuration. Combining multiple endpoint entries in one client gives that client the combined scopes.

For a typical stdio configuration:

```json
{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["-y", "secure-telegram-mcp", "connect"],
      "env": {
        "TELEGRAM_MCP_ENDPOINT_TOKEN": "tgmcp_..."
      }
    }
  }
}
```

## Tools and capabilities

The server provides 18 tools organized around eight permission verbs:

- Read Telegram data with `get_messages`, `search_messages`, `list_dialogs`, `list_topics`, `get_chat_info`, `get_media_info`, `get_pinned_messages`, and `list_participants`.
- Download media with `download_media`, which uses a strict size limit and a server-selected destination.
- Send and edit content with `send_message`, `edit_message`, `prepare_media`, and `send_media`.
- Manage drafts, messages, read state, reactions, and forwarding with `save_draft`, `delete_message`, `mark_read`, `send_reaction`, and `forward_message`.

Forwarding requires read access to the source chat and forward permission on the destination. Sending local media uses two steps: `prepare_media` creates an expiring opaque handle for a file under the confined media root, and `send_media` consumes that handle.

Per-account token buckets pace messages, forwards, and searches, while a circuit breaker backs off the account when saturation is detected. These controls reduce flood-limit risk but cannot guarantee that Telegram will not impose a ban. Human confirmation can be enabled per endpoint for clients supporting MCP elicitation; unsupported clients fail closed rather than silently allowing writes.

## Limitations and notes

The service intentionally provides no raw MTProto `invoke` tool and does not let a model alter its own scope. Endpoint scope therefore must be changed outside the model-accessible tool surface. A forgotten PIN cannot be recovered. The endpoint key is printed only once during setup, so it must be copied before closing the setup terminal.

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

