telegram-mcp-server
telegram-mcp-server
Telethon ベースのTelegram MCPサーバー — 永続クライアント、フラッドセーフ、9つのグループ化されたツール。
コード内にAPIキーは不要。 セッションファイルはローカルに保存。ユーザーアカウント(2FA)とボットの両方に対応。
1. インストール
git clone <this-repo> telegram-mcp-server
cd telegram-mcp-server
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
pip install -e .API認証情報を取得
my.telegram.org にアクセス
電話番号でログイン
アプリを作成 → API ID と API Hash を取得
初回認証
# User account (with 2FA support)
export TG_API_ID=12345
export TG_API_HASH="your_hash_here"
telegram-mcp-server --auth --phone +33612345678
# Or via MCP tool: tg_session(action="auth", api_id=12345, api_hash="...", phone="+33612345678")Related MCP server: tdlib-mcp-server
2. MCPクライアントに登録
Claude Desktop / OpenCode
{
"mcpServers": {
"telegram": {
"command": "telegram-mcp-server",
"env": {
"TG_API_ID": "12345",
"TG_API_HASH": "your_hash_here"
}
}
}
}PATHにない場合:
{
"mcpServers": {
"telegram": {
"command": "/path/to/.venv/bin/python",
"args": ["-m", "telegram_mcp_server"],
"env": {
"TG_API_ID": "12345",
"TG_API_HASH": "your_hash_here"
}
}
}
}Docker
docker build -t telegram-mcp .
docker run -i --rm \
-v ~/.telegram-mcp/sessions:/root/.telegram-mcp/sessions \
-e TG_API_ID=12345 \
-e TG_API_HASH="your_hash" \
telegram-mcp3. ツールカタログ(9ツール、8アクション)
tg_session — セッション管理
action | 必須引数 | 説明 |
|
| 認証(2FA対応) |
| — | ログイン状態を確認 |
| — | セッションを削除 |
tg_message — 送信、転送、削除、返信
action | 必須引数 | 説明 |
|
| メッセージを送信 |
|
| メッセージを転送 |
|
| メッセージを削除 |
|
| メッセージに返信 |
tg_chat — チャット操作
action | 必須引数 | 説明 |
| — | 最近のチャットを一覧 |
|
| チャット情報を取得 |
|
| チャットメンバーを一覧 |
|
| チャットから退出 |
tg_search — 検索
action | 必須引数 | 説明 |
|
| メッセージを検索( |
|
| 連絡先・ユーザーを検索 |
|
| チャンネルを検索 |
tg_history — チャット履歴
action | 必須引数 | 説明 |
|
| メッセージ履歴を取得 |
|
| メディアのみの履歴を取得 |
|
| ファイルのみの履歴を取得 |
tg_user — ユーザー操作
action | 必須引数 | 説明 |
| — | 自分の情報を取得 |
|
| ユーザー情報を取得 |
|
| ユーザーをブロック |
|
| ユーザーのブロックを解除 |
tg_media — メディア送信
action | 必須引数 | 説明 |
|
| 写真を送信 |
|
| 動画を送信 |
|
| ドキュメントを送信 |
|
| 音声メモを送信 |
tg_channel — チャンネル管理
action | 必須引数 | 説明 |
|
| スーパーグループ/チャンネルを作成 |
|
| チャンネルに参加 |
|
| チャンネルから退出 |
|
| チャンネル情報を取得 |
tg_draft — 下書きメッセージ
action | 必須引数 | 説明 |
|
| 下書きを保存 |
| — | すべての下書きを一覧 |
|
| 下書きを削除 |
4. 環境変数
変数 | デフォルト | 説明 |
|
| Telegram API ID(my.telegram.org から) |
|
| Telegram API Hash |
|
| セッションファイルの保存場所 |
5. 安全性
レートリミッター: 送信アクションは毎分5回まで。読み取りアクションは無制限。
FloodWaitError 自動リトライ: 必要な時間だけ待機(最大5分)。
セッションファイル: ローカルのみに保存され、git にコミットされることはありません。
2FA対応: 二段階認証が有効なアカウントを完全サポート。
6. MCPリソース
tg://version— サーバーバージョンtg://session/status— ログイン状態
ライセンス
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
- FlicenseAqualityBmaintenanceEnables AI agents to interact with Telegram via MTProto, supporting high-performance communication and seamless integration.1
- FlicenseNot gradedqualityCmaintenanceConnects AI agents to Telegram via the official TDLib library, enabling tools like getting user info, listing dialogs, and searching messages.
- AlicenseNot gradedqualityCmaintenanceEnables interaction with Telegram Bot API for sending messages, photos, editing messages, answering callbacks, and fetching updates.MIT
- AlicenseNot gradedqualityBmaintenanceEnables sending Telegram messages, photos, and documents, and retrieving bot information through the Telegram Bot API.581MIT
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Search 1.2M+ Telegram channels, 245k+ chats, 160k+ bots — no account, no key, no install.
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/Steph-ux/telegram-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server