BM

braindao/mcp-telegram

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

8 stars 6 forks 品質 65 トレンド 20

Model Context Protocol Server for interacting with Telegram Channels

概要

An MCP (Model Context Protocol) server for interacting with Telegram bots and channels using the Telegraf library. This server enables AI agents to send messages, manage channels, forward content, and respond intelligently to Telegram conversations. By implementing the Model Context Protocol (MCP), this server allows Large Language Models (LLMs) to interact with Telegram directly through their context window, bridging the gap between AI and messaging platforms. * : Send messages to channels or chats with optional topic support * : Get information about channels/chats * : Forward messages between chats * : Pin messages in channels * : Get list of channel administrators * : AI-powered responses using FastMCP sampling * : Smart filtering - responds when mentioned in groups * : Supports text, photos, documents, voice, video, stickers, locations, contacts, polls * : Configurable user/chat allow/block lists * : Per-user and per-chat rate limiting * : Highly customizable behavior and...

README

以下は原文 README の抜粋です。原文を見る。

Telegram MCP Server

Overview

An MCP (Model Context Protocol) server for interacting with Telegram bots and channels using the Telegraf library. This server enables AI agents to send messages, manage channels, forward content, and respond intelligently to Telegram conversations.

By implementing the Model Context Protocol (MCP), this server allows Large Language Models (LLMs) to interact with Telegram directly through their context window, bridging the gap between AI and messaging platforms.

Features

Core Tools

  • SEND_MESSAGE: Send messages to channels or chats with optional topic support
  • 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

AI Sampling (Enhanced)

  • Intelligent Responses: AI-powered responses using FastMCP sampling
  • Mention-Only Mode: Smart filtering - responds when mentioned in groups
  • Multi-Message Types: Supports text, photos, documents, voice, video, stickers, locations, contacts, polls
  • Access Control: Configurable user/chat allow/block lists
  • Rate Limiting: Per-user and per-chat rate limiting
  • Advanced Configuration: Highly customizable behavior and templates

Installation

To use this server without installing it globally:

npx @iqai/mcp-telegram

Build from Source

git clone https://github.com/IQAIcom/mcp-telegram.git
cd mcp-telegram
pnpm install
pnpm run build

Running with an MCP Client

Add the following configuration to your MCP client settings (e.g., claude_desktop_config.json).

Minimal Configuration

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["-y", "@iqai/mcp-telegram"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your_bot_token_here"
      }
    }
  }
}

Advanced Configuration (Local Build)

{
  "mcpServers": {
    "telegram": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-telegram/dist/index.js"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your_bot_token_here",
        "SAMPLING_ENABLED": "true",
        "SAMPLING_MENTION_ONLY": "true"
      }
    }
  }
}

Configuration (Environment Variables)

Required

Variable Required Description
TELEGRAM_BOT_TOKEN Yes Your Telegram bot token from @BotFather

Sampling Configuration

Variable Default Description
SAMPLING_ENABLED true Enable/disable AI sampling entirely
SAMPLING_MENTION_ONLY true Only respond when mentioned in groups
GitHub で README 全文を見る

インストール

npx -y @iqai/mcp-telegram
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "telegram": { "command": "npx", "args": ["-y", "@iqai/mcp-telegram"], "env": { "TELEGRAM_BOT_TOKEN": "your_bot_token_here" } } } }