Telegram Notification MCP Server
Telegram 通知 MCP サーバー
Claude Code がタスクを完了したときに Telegram へ通知を送信する MCP(Model Context Protocol)サーバー。Cloudflare Agents SDK を使用して TypeScript で構築され、Cloudflare Workers にデプロイ可能です。
📢 Discord をお使いですか? Discord 通知は Discord 通知 MCP をご覧ください。
特徴
🤖 MCP ツール: 通知を送信するための
send_telegram_messageツールを提供🚀 Cloudflare Workers: サーバーレスでグローバルに配信
🔐 認証付き: Cloudflare シークレットとして保存されたベアラートークンが必要
🌐 Streamable HTTP: 現在のステートレス MCP トランスポートを使用
💬 メッセージ形式: Markdown および HTML 形式に対応
📝 形式: Markdown および HTML メッセージ形式に対応
Related MCP server: mcp-telegram-claudecode
アーキテクチャ
このサーバーは Cloudflare Agents SDK を使用して MCP 仕様を実装しています:
POST /mcp: MCP 通信用のステートレス Streamable HTTP エンドポイント
GET /sse:
410 Goneを返却。レガシー SSE クライアントは/mcpへ移行してくださいTypeScript、MCP SDK、Cloudflare Agents SDK で構築
適切な JSON-RPC 2.0 エラーハンドリング
Node.js 互換モードを有効化
セットアップ
前提条件
Telegram ボット: @BotFather でボットを作成し、ボットトークンを取得します
チャット ID: ボットにメッセージを送信し、以下にアクセスしてチャット ID を取得します:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesCloudflare アカウント: cloudflare.com でサインアップします
インストール
このリポジトリをクローンします
依存関係をインストールします:
pnpm install
設定
サンプルファイルから
.dev.varsを作成します:cp .dev.vars.example .dev.vars次に、
.dev.varsにボットトークンとチャット ID を記入します。このファイルはローカル開発と本番デプロイの両方で使用されます。本番デプロイ用に、MCP ベアラートークンを生成し、Cloudflare シークレットを設定します:
openssl rand -hex 32 pnpm exec wrangler secret put BOT_TOKEN pnpm exec wrangler secret put DEFAULT_CHAT_ID # Optional pnpm exec wrangler secret put MCP_AUTH_TOKEN注:
DEFAULT_CHAT_IDはオプションです。設定しない場合は、send_telegram_messageツールを呼び出す際にchat_idパラメータを指定する必要があります。必要に応じて
wrangler.tomlのワーカー名を更新します
デプロイ
Cloudflare Workers にデプロイします:
Wrangler を使用してデプロイ:
# First set secrets
pnpm exec wrangler secret put BOT_TOKEN
pnpm exec wrangler secret put DEFAULT_CHAT_ID # Optional
# Then deploy
pnpm run deploy代替: 継続的デプロイ
Cloudflare ダッシュボードから直接継続的デプロイを設定することもできます。詳細は Cloudflare の Git 連携 をご覧ください。
Claude Code 設定
Streamable HTTP と同一のベアラートークンを使用して、MCP サーバーを Claude Code に追加します:
# For production deployment
claude mcp add --scope user --transport http \
--header "Authorization: Bearer <MCP_AUTH_TOKEN>" \
telegram-notify https://your-worker-name.workers.dev/mcp
# For local development
claude mcp add --transport http \
--header "Authorization: Bearer <MCP_AUTH_TOKEN>" \
telegram-notify http://localhost:8787/mcpこのトークンは MCP エンドポイントへのクライアントアクセス用であり、Telegram ボットトークンではありません。ボットトークンを Claude の MCP 設定に入れないでください。
以下のコマンドで設定を確認できます:
claude mcp list使用方法
設定が完了すると、Claude Code は必要なときにいつでも Telegram へ通知を送信できます。
利用可能なツール
send_telegram_message: Telegram へ通知メッセージを送信します
text(必須): 送信するメッセージテキストchat_id(オプション): Telegram チャット ID(未指定の場合はDEFAULT_CHAT_IDを使用)parse_mode(オプション): メッセージ形式の "Markdown" または "HTML"disable_notification(オプション): サイレントでメッセージを送信
使用例:
// Uses DEFAULT_CHAT_ID from environment
await send_telegram_message({ text: "Task completed!" })
// Send to specific chat (overrides DEFAULT_CHAT_ID)
await send_telegram_message({ text: "Hello!", chat_id: "123456789" })
// Send with Markdown formatting
await send_telegram_message({
text: "*Bold* and _italic_ text",
parse_mode: "Markdown"
})通知を受け取るタイミング
Claude Code は以下の場合に通知を送信します:
明示的に依頼した場合: 「完了したら通知して」や「Telegram で知らせて」
実行中にエラーが発生した場合
重要なマイルストーンに到達した場合
ユーザーの入力や介入が必要な場合
シナリオ例
# You say: "Deploy to production and notify me when done"
# Result: 🤖 Claude Code Notification
# Deployment completed successfully! The app is now live.
# You say: "Run all tests and let me know the results"
# Result: 🤖 Claude Code Notification
# All tests passed! 52/52 tests successful.
# You say: "Process this data and notify me if there are any errors"
# Result: 🤖 Claude Code Notification
# Error: Failed to process row 451 - invalid date format通知例
CLAUDE.md への記載例
Claude Code が Telegram 通知を効果的に使用するよう促すには、CLAUDE.md に以下を追加します:
# Telegram Notifications
Use the mcp__telegram-notify__send_telegram_message tool to send notifications to Telegram.
- Always send a Telegram notification when:
- A task is fully complete
- You need user input to continue
- An error occurs that requires user attention
- The user explicitly asks for a notification (e.g., "notify me", "send me a message", "let me know")
- Include relevant details in notifications:
- For builds/tests: success/failure status and counts
- For errors: the specific error message and file location
- Use concise, informative messages like:
- "✅ Build completed successfully (2m 34s)"
- "❌ Tests failed: 3/52 failing in auth.test.ts"
- "⚠️ Need permission to modify /etc/hosts"開発
ローカルで実行:
# Start local development server
pnpm devローカル開発では、Wrangler が .dev.vars ファイルから環境変数を自動的に読み込みます。
デプロイ前にすべてのチェックを実行:
pnpm buildこのコマンドは以下を実行します:
pnpm format- Biome でコードをフォーマットpnpm lint:fix- リンティングの問題を修正pnpm cf-typegen- Cloudflare 型を生成pnpm type-check- TypeScript の型をチェック
サーバーをテスト:
# An unauthenticated request must return HTTP 401
curl -i http://localhost:8787/mcp
# Claude Code performs the authenticated MCP handshake and health check
claude mcp listデバッグ
認証のテスト
ベアラートークンなしでエンドポイントがリクエストを拒否することを確認できます:
curl -i http://localhost:8787/mcpこれにより 401 Unauthorized が返されるはずです。その後、claude mcp list を使用して、認証済みクライアント接続を確認します。
一般的な問題
401 Unauthorized: クライアントの
Authorization: Bearer ...ヘッダーが Cloudflare シークレットのMCP_AUTH_TOKENと一致しているか確認してください。MCP の再接続またはタイムアウト: クライアントが HTTP トランスポートと
/mcpエンドポイントを使用しているか確認してください。廃止された/sseエンドポイントではありません。Telegram 通知が送信されない: Worker 環境で
BOT_TOKENとDEFAULT_CHAT_IDが正しく設定されているか確認してください。
技術詳細
言語: TypeScript(ES2021 ターゲット)
ランタイム: Node.js 互換モードの Cloudflare Workers
プロトコル: MCP(Model Context Protocol)
トランスポート: ステートレス Streamable HTTP
可観測性: モニタリング有効
参考資料
このプロジェクトは以下のガイドに基づいて構築されています:
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to send notifications to Discord channels via webhooks when tasks complete, errors occur, or user intervention is needed. Deployed serverlessly on Cloudflare Workers with support for rich message formatting and embeds.8MIT
- AlicenseAqualityDmaintenanceEnables Claude Code to send and receive messages via Telegram for remote interaction and approval of sensitive operations.8187MIT
- FlicenseNot gradedqualityDmaintenanceSends Telegram alerts for Claude Code status updates, including notifications for task completion, user requests, and custom status updates with normal or urgent priority.1
- FlicenseNot gradedqualityDmaintenanceEnables Claude Code to send messages to and receive instructions from Telegram, with task tracking and persistent storage.
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Let your AI agent notify you by email, Slack, Discord, or webhook. One tool: send_notification.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kstonekuan/telegram-notification-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server