Skip to main content
Glama
codedpro

Telegram MCP Server

by codedpro

Telegram MCP Server

Give any AI agent access to your Telegram account. An MCP (Model Context Protocol) server that lets Claude Code, Claude Desktop, Cursor, Codex, Windsurf, or any MCP-compatible agent read, search, and send Telegram messages on your behalf.

Built on MTProto via teleproto (the maintained GramJS fork), so it works with your real account — every chat, group, and channel you are in — not just a bot.

Why

Bot API bots only see chats you explicitly add them to. This server signs in as you, so an agent can answer "what did the team decide in the design channel yesterday?", triage your unread DMs, or post a build result to the chat you actually use — without you leaving your editor.

Related MCP server: Telegram MCP Server

Quick start

git clone https://github.com/codedpro/telegram-mcp-server
cd telegram-mcp-server
npm install
cp .env.example .env
  1. Get TELEGRAM_API_ID and TELEGRAM_API_HASH from https://my.telegram.orgAPI development tools, and put them in .env.

  2. Log in once and copy the printed session string into .env:

    npm run login
  3. Build it:

    npm run build

Connect it to Claude Code

claude mcp add telegram -- node /absolute/path/to/telegram-mcp-server/dist/index.js

Connect it to Claude Desktop / Cursor

{
  "mcpServers": {
    "telegram": {
      "command": "node",
      "args": ["/absolute/path/to/telegram-mcp-server/dist/index.js"]
    }
  }
}

Tools

Tool

What it does

telegram_whoami

Which account is signed in, and what it is allowed to do

telegram_list_chats

Recent dialogs with ids, kind, and unread counts

telegram_get_messages

Recent messages from one chat

telegram_search_messages

Full-text search in one chat or across all of them

telegram_send_message

Send a message (allowlisted chats only)

Safety

Writes are off by default. telegram_send_message refuses every chat that is not in TELEGRAM_WRITE_ALLOWLIST, so the default install is read-only. Start narrow:

TELEGRAM_WRITE_ALLOWLIST=me,@my_test_group

Two things worth knowing before you run this:

  • The session string is your account. Anyone holding it is logged in as you, with no second factor. It is gitignored here — keep it that way, and revoke it from Telegram → Settings → Devices if it ever leaks.

  • Automating a personal account is against Telegram's ToS if you spam with it. Personal, low-volume, human-paced use is what userbots have always been used for and is broadly fine; blasting messages will get the account limited or banned. If you only need a bot identity, use the Bot API instead — it is the supported path.

Roadmap

  • Read/unread state and mark-as-read

  • Media: download and send files, photos, voice notes

  • Streaming: push new messages to the agent as they arrive

  • npx telegram-mcp-server with zero-config setup

  • Optional Bot API mode for people who do not want a userbot

License

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    Connects AI tools to Telegram via MCP, enabling reading chats, sending messages, managing groups, and more using your own account.
    54
    5
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to control a real Telegram user account via MTProto, allowing message sending, chat reading/searching, and message management through MCP tools.
    25 npm
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants like Claude to read, search, and send messages through your personal Telegram account via MCP tools.
    MIT