Skip to main content
Glama

🤖 kurigram-mcp

AIでTelegramボットをデバッグ — MTProto経由でTelegramユーザーセッションを操作するローカルMCPサーバー。

PyPI Version Python Versions License

English · 简体中文


✨ 機能

🔌 標準MCP

Streamable HTTPトランスポート、2026-07-28プロトコル、2025-11-25クライアント(Claude Code、Codex、DSH)と後方互換

🧪 ボットデバッグ

/startを送信、応答レイテンシーを測定、イベントを待機、更新ストリームをドレイン

🛠️ ディープデバッグ

組み込みのAPIディスカバリー付きで任意のMTProto関数をraw_invoke

🔒 チャットホワイトリスト

リクエストヘッダーによるクライアント単位の制御、デフォルトでフェイルクローズ

⚡ ステートレス

サーバー再起動が接続中のクライアントに影響しない

🚀 ゼロ設定

uv tool install、対話式セットアップウィザード、ワンコマンドログイン

Related MCP server: io.github.daedalus/mcp-telegram-bot

🚀 クイックスタート

# 1. Install (provides `kurigram-mcp` and the `km` alias)
uv tool install kurigram-mcp

# 2. One-time setup: API_ID / API_HASH / whitelist / proxy / port
#    AUTH_TOKEN is auto-generated if left blank (Bearer auth on by default)
km setup

# 3. Log in (skip if you chose to during setup): phone → code → 2FA
km auth

# 4. Start the server
km run     # default: http://127.0.0.1:8765/mcp

API_ID / API_HASH は my.telegram.org/apps から取得してください。ログインは必ずご自身で行ってください — 認証情報があなたのマシンから外部に出ることはありません。

🧰 ツール(22)

グループ

ツール

🧾 セッション

whoami、mcp_get_server_info

📤 送信

send_message、send_photo、send_document、edit_message、delete_message、send_chat_action、start_bot、click_inline_button、send_reaction

📥 読み取り

get_chat、get_chat_history、get_messages、get_dialogs、search_messages、download_media

⏱️ イベント

wait_for_update、drain_updates

🔬 ディープ

raw_invoke、list_raw_methods、get_raw_method_info

エラーは安定した[CODE] message形式に従います:NOT_WHITELISTED · FLOOD_WAIT {seconds} · SESSION_INVALID · RPC · NETWORK · INTERNAL。

🔌 クライアント設定

# Claude Code
claude mcp add --transport http kurigram-mcp http://127.0.0.1:8765/mcp \
  --header "Authorization: Bearer <AUTH_TOKEN>" \
  --header "X-Kurigram-Allowed-Chats: 6540476263"   # optional per-client whitelist
# Codex (~/.codex/config.toml)
[mcp_servers.kurigram-mcp]
url = "http://127.0.0.1:8765/mcp"
http_headers = { "Authorization" = "Bearer <AUTH_TOKEN>", "X-Kurigram-Allowed-Chats" = "6540476263" }
# DSH — cordis.yml plugin row (@deepseek-ai/dsh-mcp-client)
- id: mcp-kurigram
  name: '@deepseek-ai/dsh-mcp-client'
  config:
    serverName: kurigram
    transport: streamable-http
    url: http://127.0.0.1:8765/mcp
    headers:
      Authorization: !!js '`Bearer ${process.env.KURIGRAM_TOKEN}`'
      X-Kurigram-Allowed-Chats: '6540476263'

🔐 チャットホワイトリスト

  1. リクエストヘッダー X-Kurigram-Allowed-Chats — クライアント単位の宣言(カンマ区切り:数値チャットID、 @username、 me)。

  2. 設定 allowed_chat_ids — ヘッダーがない場合のフォールバック。

フェイルクローズ:ホワイトリスト外のチャットは[NOT_WHITELISTED]で拒否されます。get_dialogsはホワイトリスト登録された チャットのみを返します。

⚙️ 設定

すべての設定は1つのファイルに集約されます:~/.kurigram-mcp/config.yaml。

api_id: 123456
api_hash: your_hash
allowed_chat_ids: "123456789,me"   # fallback whitelist
host: 127.0.0.1
port: 8765
auth_token: auto_generated_or_yours # Bearer auth
proxy: ""                           # optional, e.g. socks5://127.0.0.1:1080

📁 データとファイル

~/.kurigram-mcp/
├── config.yaml         # setup-generated config (chmod 600)
├── u_{API_ID}.session  # Telegram session (bound to API_ID, persists)
└── downloads/          # download_media output

🧑💻 開発

uv sync
uv run pytest
uv run ruff check src tests scripts

# Configure like a regular user (shared ~/.kurigram-mcp):
uv run kurigram-mcp setup
# Or isolate a dev environment (never touches your real config):
# KURIGRAM_MCP_HOME=$PWD/.dev-home uv run kurigram-mcp setup
# KURIGRAM_MCP_HOME=$PWD/.dev-home uv run kurigram-mcp run

📄 ライセンス

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that connects AI assistants to your real Telegram account via User API (MTProto). Features default-deny ACL with per-chat permissions, message search, file sending, forwarding, media downloads, and rate limiting.
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server that exposes a Telegram bot, enabling sending messages and retrieving updates through natural language.
    3
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that connects to Telegram as your real user account and exposes read-only tools to read and search messages, list chats and folders, inspect group info, and download media.
    16 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A safe-by-default MCP server for real Telegram accounts powered by TDLib, enabling AI agents to read and act on your account with read-only mode and human approval for destructive actions.
    9
    Apache 2.0