The Bot API can't read history. MTProto can. Give your AI agent complete access to your Telegram workspace — read any message, send to any topic, manage any group.
# Clone and install $ git clone https://github.com/sandikodev/telegram-mcp.git && cd telegram-mcp $ bun install # One-time authentication (saves session to ~/.config/telegram-mcp/session.txt) $ bun run auth API ID: •••••••• | API Hash: •••••••••••••••• Phone: +62•••••••••• | OTP: •••••• ✅ Session saved. # mcp.json — full access: history, dialogs, topics, search { "mcpServers": { "telegram": { "command": "bun", "args": ["run", "/path/to/telegram-mcp/src/index.ts"], "env": { "TELEGRAM_API_ID": "...", "TELEGRAM_API_HASH": "..." } }} }
Everything your AI agent needs to work with Telegram — all inputs validated with Zod, 15s timeout on every call
Fetch up to 100 messages from any chat or forum topic. Includes sender, timestamp, and media info.
Send Markdown or HTML formatted messages to any chat or specific forum topic thread. Max 4096 chars.
Upload and send any file — PDFs, CSVs, images, logs — with an optional caption.
Get all your chats, groups, and channels with names, IDs, and unread counts.
Get all topics in a supergroup forum — perfect for organized team workspaces.
Search messages by keyword within any chat. Returns up to 100 matching results with full context.
Fetch metadata of any chat, group, or channel — title, username, type, member count, description.
stdio transport (local/Docker) or HTTP transport (Cloudflare Workers)
Built for production. Simple by default, powerful when needed.
Bot API only gets new messages. MTProto reads any message from any time.
Acts as your account — access private groups, DMs, and channels you're in.
Read and write to specific topics in supergroups — Bot API support is limited.
~10ms startup. TypeScript first, no build step, no transpilation.
All tool inputs validated at runtime — no silent failures, clear error messages.
Every API call has a 15s timeout — server never hangs, always responds.
Local, Docker, npx, or Cloudflare Workers — one codebase, five deployment targets.
Session stored locally or via env var — never hardcoded, never committed.
Open source, MIT licensed, contributions welcome.