better-telegram-mcp Server

Production-grade MCP server for Telegram with dual-mode Bot API + MTProto, 6 composite tools

Documentation

Better Telegram MCP

mcp-name: io.github.n24q02m/better-telegram-mcp

MCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot integrations and MTProto (Telethon) for full user-account access.

CI codecov PyPI Docker License: MIT

Python Telegram MCP semantic-release Renovate

Sister projects from n24q02m (click to expand)
ProjectTaglineTag
better-code-review-graphKnowledge graph for token-efficient code reviews -- fixed search, configurabl...MCP
better-email-mcpIMAP/SMTP email server for AI agents -- 6 composite tools with multi-account ...MCP
better-godot-mcpComposite MCP server for Godot Engine -- 17 mega-tools for AI-assisted game d...MCP
better-notion-mcpMarkdown-first Notion API server for AI agents -- 10 composite tools replacin...MCP
better-telegram-mcpMCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot...MCP
claude-pluginsFull documentation: mcp.n24q02m.com — unified docs for all 8 servers + the mc...Marketplace
imagine-mcpProduction-grade MCP server for image and video understanding + generation ac...MCP
jules-task-archiverChrome Extension for bulk operations on Jules tasks via batchexecute API -- a...Tooling
mcp-coreUnified MCP Streamable HTTP 2025-11-25 transport, OAuth 2.1 Authorization Ser...MCP
mnemo-mcpPersistent AI memory with hybrid search and embedded sync. Open, free, unlimi...MCP
qwen3-embedLightweight Qwen3 text embedding and reranking via ONNX Runtime and GGUFLibrary
skretSecrets without the server.CLI
web-coreShared web infrastructure package for search, scraping, HTTP security, and st...Library
wet-mcpOpen-source MCP Server for web search, content extraction, library docs & mul...MCP

Table of contents

better-telegram-mcp MCP server

Features

  • Dual mode -- Bot API (httpx) for bots, MTProto (Telethon) for user accounts
  • 6 tools with action dispatch: message, chat, media, contact, config, help
  • Auto-detect mode -- Set bot token for bot mode, or API credentials for user mode
  • Web-based OTP auth -- Browser-based authentication with remote relay support for headless environments
  • Tool annotations -- Each tool declares readOnlyHint, destructiveHint, idempotentHint, openWorldHint
  • MCP Resources -- Documentation available as telegram://docs/* resources
  • Security hardened -- SSRF protection, path traversal prevention, error sanitization

Status

2026-05-02 -- Architecture stabilization update

Past months saw significant churn around credential handling and the daemon-bridge auto-spawn pattern. This caused multi-process races, browser tab spam, and inconsistent setup UX across plugins. As of v<auto>, the architecture is stable: 2 clean modes (stdio + HTTP), no daemon-bridge layer, no auto-spawn from stdio.

Apologies for the instability period. If you encountered issues with prior versions, please update to v<auto>+ and follow the current Setup docs -- most prior workarounds are no longer needed.

Related plugins from the same author:

All plugins share the same architecture -- install once, learn pattern transfers.

Documentation

Full docs at mcp.n24q02m.com/servers/better-telegram-mcp/:

  • Setup -- install methods for Claude Code, Codex, Gemini CLI, Cursor, Windsurf, mcp.json
  • Modes overview -- stdio / local-relay / remote-relay / remote-oauth
  • Multi-user setup -- per-JWT-sub credential model

Install with AI agent -- paste this to your AI coding agent:

Install MCP server better-telegram-mcp following the steps at https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/better-telegram-mcp/setup-with-agent.md

Tools

ToolActionsDescription
messagesend, edit, delete, forward, pin, react, search, historySend, edit, delete, forward messages. Pin, react, search, browse history
chatlist, info, create, join, leave, members, admin, settings, topicsList and manage chats, groups, channels. Members, admin, forum topics
mediasend_photo, send_file, send_voice, send_video, downloadSend photos, files, voice notes, videos. Download media from messages
contactlist, search, add, blockList, search, add contacts. Block/unblock users (user mode only)
configstatus, set, cache_clear, setup_status, setup_start, setup_reset, setup_completeServer status, runtime settings, cache, credential setup (relay, status, reset, complete)
help--Full documentation for any topic

MCP Resources

URIContent
telegram://docs/messagesMessage operations reference
telegram://docs/chatsChat management reference
telegram://docs/mediaMedia send/download reference
telegram://docs/contactsContact management reference
telegram://statsAll documentation combined

Security

  • SSRF Protection -- All URLs validated against internal/private IP ranges, DNS rebinding blocked
  • Path Traversal Prevention -- File paths validated, sensitive directories blocked
  • Session File Security -- 600 permissions, 2FA via web UI only (never stored in env vars)
  • Error Sanitization -- Credentials never leaked in error messages

Build from Source

git clone https://github.com/n24q02m/better-telegram-mcp.git
cd better-telegram-mcp
uv sync
uv run better-telegram-mcp

Trust Model

This plugin implements TC-NearZK (in-memory, ephemeral). See mcp-core/docs/TRUST-MODEL.md for full classification.

ModeStorageEncryptionWho can read your data?
HTTP n24q02m-hosted (default)In-memory dict[sub] = MTProtoSessionIn-process onlyServer process (cleared on restart)
HTTP self-hostSame as hostedSameOnly you (admin = user)
stdio proxy~/.better-telegram-mcp/config.jsonAES-GCM, machine-bound keyOnly your OS user (file perm 0600)

License

MIT -- See LICENSE.