Claude代码Telegram警报服务

一个通过Telegram发送Claude代码状态更新的MCP服务器,适用于需要实时接收代码状态通知的开发场景。

  • by anthony-potts
  • Shell
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 anthony-potts/claude-telegram-alerts

使用说明

克劳德电报警报

发送克劳德代码状态更新电报警报的MCP服务器。在以下情况下,您的手机会收到通知:

  • Claude需要您的意见或批准
  • 长时间运行的任务已完成
  • 构建完成或测试通过/失败
  • 您配置的任何自定义状态更新

特性

  • alert -向您的Telegram发送状态警报(正常或紧急优先级)
  • get_chat_id -帮助工具,用于在设置过程中检索您的Telegram聊天ID

快速开始

1.创建Telegram Bot

  1. 打开电报和消息 @植物学家
  2. 发送 /newbot 并按照提示进行操作
  3. 复制您的机器人令牌(例如。, 123456789:ABCdefGHIjklMNOpqrsTUVwxyz)

2.给你的机器人发消息

在Telegram中搜索您的新机器人,并向其发送任何消息(例如“嗨”)。这使得机器人能够给你回消息。

3.安装

git clone https://github.com/anthony-potts/claude-telegram-alerts.git
cd claude-telegram-alerts
npm install
npm run build

4.配置克劳德代码

添加到 ~/.claude/settings.json:

{
  "mcpServers": {
    "telegram-alerts": {
      "command": "node",
      "args": ["/path/to/claude-telegram-alerts/build/index.js"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token",
        "TELEGRAM_CHAT_ID": ""
      }
    }
  }
}

5.获取您的聊天ID

重新启动Claude Code,然后问:

“使用get_chat_id工具查找我的Telegram聊天id”

使用返回的聊天ID更新您的配置,然后重新启动Claude Code。

用法示例

手动警报

"Send me a Telegram alert that the deployment is complete"

"Send an urgent alert that I need to approve the PR"

自动化工作流程

"Run the test suite and alert me on Telegram when done"

"Deploy to staging and send me a Telegram alert with the result"

"When you need my input, send me a Telegram alert"

状态更新

"Alert me via Telegram: Build failed - missing dependency in package.json"

"Send Telegram alert: Waiting for approval to delete 50 files"

工具

alert

向您的Telegram发送状态警报。

参数 类型 必填 说明
message string 是 警报消息
priority "normal" "urgent" 没有

get_chat_id

在向机器人发送消息后检索您的聊天ID。没有参数。

故障排除

错误 解决方案
“需要TELEGRAM_BOT_TOKEN” 将您的机器人令牌添加到MCP服务器环境配置中
“需要TELEGRAM_CHAT_ID” 运行 get_chat_id 工具并将结果添加到配置中
“未找到消息” 请先在Telegram中向您的机器人发送消息
警报未到达 检查机器人的Telegram通知是否已静音

发展

npm install      # Install dependencies
npm run build    # Compile TypeScript
npm run dev      # Watch mode

许可证

麻省理工学院