Telegram MCP

Telegram MCP

https://github.com/EncryptMan/telegram-mcp

Category
访问服务器

README

Telegram MCP

An MCP (Model Context Protocol) server that exposes Telegram bot actions as tools for LLM clients (e.g. Claude Desktop, Claude Code).

Requirements

  • Python 3.10+
  • uv for dependency management and running the server
  • A Telegram bot application with a bot token (Telegram Bot API)

Installation

git clone https://github.com/EncryptMan/telegram-mcp telegram-mcp
cd telegram-mcp
uv sync

Configuration

The server reads its Telegram bot token from the TELEGRAM_BOT_TOKEN environment variable.

Add the server to your MCP client config (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "telegram": {
      "command": "uv",
      "args": [
        "run",
        "--project",
        "/absolute/path/to/telegram-mcp",
        "python",
        "/absolute/path/to/telegram-mcp/main.py"
      ],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token-here"
      }
    }
  }
}

Restart your MCP client after editing the config so it picks up the new server.

Bot permissions

Make sure the bot is set up with the following, depending on which tools you use:

  • Privacy mode disabled via @BotFather if you need get_updates to see all messages in a group, not just commands and replies to the bot.
  • Admin rights in the chat/channel for any moderation or management tool: ban_chat_member, unban_chat_member, delete_message, pin_chat_message, unpin_chat_message, set_chat_title, set_chat_description.
  • A webhook URL with a valid HTTPS certificate if you use set_webhook instead of polling with get_updates.

Tools

Update this list to match what main.py actually implements.

Tool Description
get_bot_info Fetch the bot's own user info
get_webhook_info / set_webhook / delete_webhook Manage the bot's webhook
get_updates Poll for new messages/events (alternative to a webhook)
get_my_commands / set_my_commands Fetch or register the bot's slash commands
send_message / edit_message_text / delete_message Send, edit, or delete a text message
send_photo / send_video / send_audio / send_document / send_voice Send media to a chat
send_poll / stop_poll Create a poll or close one and return results
pin_chat_message / unpin_chat_message Pin or unpin a message
set_message_reaction React to a message with an emoji
answer_callback_query Respond to an inline keyboard button press
get_chat Fetch info about a chat/channel
get_chat_administrators List a chat's administrators
get_chat_member Get a specific user's membership status in a chat
ban_chat_member / unban_chat_member Moderation actions
set_chat_title / set_chat_description Update a chat/channel's title or description

Example automations

Some concrete tasks this server can drive, e.g. for a trading-alerts community:

Alert distribution

  • Push formatted signals to a channel with send_message, with a chart via send_photo
  • Pin the top-priority alert with pin_chat_message, unpin it later with unpin_chat_message
  • Correct a typo or update a price target on a sent alert with edit_message_text instead of re-sending

Community engagement

  • Run a daily sentiment poll with send_poll, close it with stop_poll, and post the tally with send_message
  • Auto-react to confirm an alert was received, using set_message_reaction
  • Send weekly performance recaps as a file with send_document

Interactive bot menus

  • Build inline buttons (e.g. "Mute this ticker"); receive the press via get_updates/webhook, acknowledge it with answer_callback_query, then reply with send_message
  • Register commands like /subscribe, /mute, /stats with set_my_commands and drive their logic off get_updates

Moderation & access control

  • Ban a user spamming or scraping paid content with ban_chat_member, reverse with unban_chat_member
  • Gate sensitive commands by checking get_chat_administrators or get_chat_member first
  • Remove spam or leaked-content messages with delete_message

Housekeeping / setup

  • Rotate the channel name/description with set_chat_title / set_chat_description
  • Switch between polling (get_updates) and push delivery (set_webhook/get_webhook_info) when moving from local dev to hosted
  • Sanity-check the bot's identity and permissions with get_bot_info before deploying a new flow

Running standalone

uv run --project /absolute/path/to/telegram-mcp python /absolute/path/to/telegram-mcp/main.py

The server communicates over stdio, so it's meant to be launched by an MCP client rather than run interactively.

Security notes

  • Never commit your TELEGRAM_BOT_TOKEN — keep it in your MCP client config or a local .env file that's gitignored.
  • Scope the bot's admin rights in each chat to only what these tools need; avoid granting full admin unless required.

License

Add a license of your choice (MIT, Apache-2.0, etc.).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选