Skip to main content
MCP server CX Codex

Telegram MCP Server — Claude Code MCP server: features & setup

Connects real Telegram user accounts to AI assistants via TDLib. Starts in read-only mode and hides write tools until configured.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env TDLIB_API_ID=<TDLIB_API_ID> --env TDLIB_API_HASH=<TDLIB_API_HASH> --env TDLIB_PHONE_NUMBER=<TDLIB_PHONE_NUMBER> --env TDLIB_AUTH_CODE=<TDLIB_AUTH_CODE> --env TDLIB_2FA_PASSWORD=<TDLIB_2FA_PASSWORD> --transport stdio telegram-mcp-server -- docker run -i --rm -e TDLIB_API_ID -e TDLIB_API_HASH -e TDLIB_PHONE_NUMBER -e TDLIB_AUTH_CODE -e TDLIB_2FA_PASSWORD ghcr.io/tolboy/telegram-mcp-tdlib:1.17.3-stdio
Open on GitHub

What Telegram MCP Server does

This server connects agents to real personal Telegram accounts via TDLib rather than a limited Bot API. On launch, it applies a read-only profile such as inbox or reader. Write actions remain invisible to the model schema until explicitly switched on.

Destructive operations like deletions or user bans require manual confirmation via host elicitation or a local loopback page. The server also uses an idempotency_key to avoid duplicate messages whenever a network reply drops.

Starting the STDIO transport manually in a terminal causes client failures. The terminal process locks td.binlog, forcing the desktop client instance to exit with code 2. Configuration requires TDLIB_API_ID and TDLIB_API_HASH.

What it helps with

  • read private chats and channels with an AI assistant
  • inspect recent conversations without exposure to unintended writes
  • prevent duplicated outbound messages with idempotency keys
  • require explicit human confirmation before deletions or bans

Example prompts for the agent

  • Summarize my last 20 conversations without sending or modifying anything
  • Check for unread messages across recent Telegram chats
  • Search recent messages in personal Telegram dialogs

How to install Telegram MCP Server

Platform CLI

claude mcp add --env TDLIB_API_ID=<TDLIB_API_ID> --env TDLIB_API_HASH=<TDLIB_API_HASH> --env TDLIB_PHONE_NUMBER=<TDLIB_PHONE_NUMBER> --env TDLIB_AUTH_CODE=<TDLIB_AUTH_CODE> --env TDLIB_2FA_PASSWORD=<TDLIB_2FA_PASSWORD> --transport stdio telegram-mcp-server -- docker run -i --rm -e TDLIB_API_ID -e TDLIB_API_HASH -e TDLIB_PHONE_NUMBER -e TDLIB_AUTH_CODE -e TDLIB_2FA_PASSWORD ghcr.io/tolboy/telegram-mcp-tdlib:1.17.3-stdio

Replace <…> with your own values. 2 more environment variables are in the server README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Telegram MCP Server

What does Telegram MCP Server do?

It connects AI clients to personal Telegram accounts via TDLib. It boots in a read-only mode that keeps write tools hidden until you enable them.

How to install Telegram MCP Server in Claude Code?

Run `claude mcp add --env TDLIB_API_ID=<TDLIB_API_ID> --env TDLIB_API_HASH=<TDLIB_API_HASH> --env TDLIB_PHONE_NUMBER=<TDLIB_PHONE_NUMBER> --env TDLIB_AUTH_CODE=<TDLIB_AUTH_CODE> --env TDLIB_2FA_PASSWORD=<TDLIB_2FA_PASSWORD> --transport stdio telegram-mcp-server -- docker run -i --rm -e TDLIB_API_ID -e TDLIB_API_HASH -e TDLIB_PHONE_NUMBER -e TDLIB_AUTH_CODE -e TDLIB_2FA_PASSWORD ghcr.io/tolboy/telegram-mcp-tdlib:1.17.3-stdio`.

Why does the server exit with code 2 on manual terminal launch?

Running the STDIO command directly in a terminal locks the td.binlog file. The AI client cannot obtain this session lock simultaneously and terminates.

Similar MCP servers

MCP servers catalog →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor