# TG multi-account MCP [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/Mesteriis/tg-account-mcp  
**GitHub Stars:** 2  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/tg-multi-account-mcp

## Description
Self-hosted, consent-based access to Telegram accounts and bots for MCP clients

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

```json
"mcpServers": {
  "tg-multi-account-mcp": {
    "command": "uvx",
    "args": ["--from","tg-account-mcp","tg-mcp"],
    "env": {
      "TG_MCP_PORT": "",
      "TG_MCP_STATE_DIR": "",
      "TG_MCP_BIND": "",
      "TG_MCP_TRUSTED_NETWORKS": "",
      "TG_MCP_URL": "",
      "TG_MCP_TOKEN": ""
    }
  }
}
```

**Requires environment variables:** `TG_MCP_PORT`, `TG_MCP_STATE_DIR`, `TG_MCP_BIND`, `TG_MCP_TRUSTED_NETWORKS`, `TG_MCP_URL`, `TG_MCP_TOKEN` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What TG multi-account MCP does

TG multi-account MCP provides an MCP interface to Telegram user accounts and optionally connected bots. It is designed for agent operations rather than interactive Telegram use. Agents can discover accounts and bots, search chats and message history, inspect folders and discussion threads, retrieve attachments, follow updates, create drafts, and send or modify messages.

The service supports multiple independent user sessions. Each account has its own onboarding flow and local session, while bots are added separately using BotFather tokens. Account and bot actions require an explicit stable identifier, so the sender is not chosen implicitly.

Messaging capabilities include sending, editing, scheduling, forwarding, reactions, replies, and idempotency keys. Chat lookup supports Cyrillic and Latin transliteration matching. The service also includes project memory and local semantic indexing with a configurable embedding provider, along with separate text and attachment storage rules for RAG workflows.

## How it works

Run the service locally or deploy it with Docker Compose and Caddy-managed HTTPS. The MCP endpoint uses Streamable HTTP and accepts a Bearer token. A generated administrative token can create narrower agent tokens with `read`, `send`, or `admin` scopes, account and bot restrictions, and chat allowlists. Agent token hashes are retained, while the plaintext token is shown only once.

The local web dashboard handles account management, including reconnecting, disabling, or deleting an account and its session. It also supports bot enrollment, searchable and paginated chat tables, RAG and S3 rule editing, and queue monitoring. Operations metadata is recorded without message text, passwords, queries, or tokens.

## Setup and configuration

Python 3.12+, `uv`, and a Telegram `api_id` and `api_hash` are required. Install the published package with `uv tool install tg-account-mcp`, run `tg-mcp setup`, then start the service with `tg-mcp serve`. The setup command collects Telegram API credentials in the terminal and creates an MCP access token.

Open the local dashboard, scan its QR code from Telegram’s device-linking screen, enter the cloud password if Telegram 2FA is enabled, and assign a local display name. Repeat the wizard for additional accounts. Add bots independently through the dashboard.

The default state location is `~/.local/share/tg-mcp`; use `--state-dir` or `TG_MCP_STATE_DIR` to change it. Configure clients with the `/mcp` URL and an `Authorization: Bearer` header. Clients that require OAuth and cannot set a Bearer header are not supported.

## Tools and capabilities

Initial discovery can use `get_capabilities`, `list_accounts`, and `list_bots`. The broader tool set covers:

- Chat, folder, message, topic, reply-thread, mention, attachment, and global search
- Folder message retrieval with date ranges and IANA time zones
- Sending, editing, scheduling, forwarding, reactions, drafts, and idempotent requests
- Account and bot selection using stable IDs
- Scoped token creation and revocation
- Local semantic indexing, project memory, and configurable RAG or S3 rules
- Queue speed, backlog, ETA, filtering, and pagination monitoring

A Codex plugin adds authenticated service discovery and workflows for chat resolution, summaries, pagination, attachments, drafts, and idempotent sending.

## Limitations and notes

Telegram sessions can access their associated accounts, so protect the state directory and MCP tokens. Use separate agent tokens with only the permissions and identities each agent needs. Chat-limited tokens cannot use aggregate inbox, folder, or global-search tools because those tools may expose neighboring chats.

Operators must use their own Telegram API credentials and obtain informed, continuing consent before processing messages or files with AI systems. The integration is unofficial and is not affiliated with Telegram. A direct LAN configuration can bypass Bearer authentication for clients in configured private CIDR ranges, granting full administrative MCP access to those devices; it should not be exposed beyond a trusted network.

_Full upstream README: https://allmcps.com/mcp/tg-multi-account-mcp/readme_

