0.0.1 • Published 5 months ago

@iqai/mcp-telegram v0.0.1

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

Telegram MCP Server

An MCP (Model Context Protocol) server for interacting with Telegram bots and channels using the Telegraf library.

Features

  • SEND_MESSAGE: Send messages to channels or chats
  • GET_CHANNEL_INFO: Get information about channels/chats
  • FORWARD_MESSAGE: Forward messages between chats
  • PIN_MESSAGE: Pin messages in channels
  • GET_CHANNEL_MEMBERS: Get list of channel administrators

Setup

  1. Install dependencies:
npm install
  1. Set up your Telegram bot token:
export TELEGRAM_BOT_TOKEN="your_bot_token_here"
  1. Build the project:
npm run build
  1. Start the MCP server:
npm start

Usage

The server communicates over stdio and can be used with any MCP-compatible client.

Available Tools

SEND_MESSAGE

Send a message to a Telegram chat or channel.

  • chatId: Chat ID or username (e.g., @channelname or -1001234567890)
  • text: Message text
  • parseMode: Optional formatting (HTML, Markdown, MarkdownV2)
  • disableWebPagePreview: Optional boolean
  • disableNotification: Optional boolean for silent messages

GET_CHANNEL_INFO

Get information about a channel or chat.

  • channelId: Channel ID or username

FORWARD_MESSAGE

Forward a message from one chat to another.

  • fromChatId: Source chat ID
  • toChatId: Destination chat ID
  • messageId: Message ID to forward
  • disableNotification: Optional boolean for silent forwarding

PIN_MESSAGE

Pin a message in a chat or channel.

  • chatId: Chat ID or username
  • messageId: Message ID to pin
  • disableNotification: Optional boolean for silent pinning

GET_CHANNEL_MEMBERS

Get channel administrators (limited by Telegram API).

  • channelId: Channel ID or username
  • limit: Maximum number of members to retrieve (1-50, default: 10)

Environment Variables

  • TELEGRAM_BOT_TOKEN: Your Telegram bot token (required)

Bot Setup

  1. Create a bot with @BotFather
  2. Get your bot token
  3. Add your bot to channels with appropriate permissions
  4. Use channel usernames (e.g., @mychannel) or chat IDs for interactions

To install the required dependencies, run:

npm install telegraf zod dedent fastmcp
npm install -D @types/node typescript tsx

This Telegram MCP server provides comprehensive tools for interacting with Telegram channels and chats, including sending messages, getting channel information, forwarding messages, pinning messages, and retrieving member lists. The bot uses the Telegraf library which is a modern and feature-rich Telegram bot framework for Node.js.

0.0.1

5 months ago