Skip to main content

Production-grade MCP server for Telegram — dual-mode Bot API + MTProto, domain-separated tools

Project description

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)
Project Tagline Tag
better-code-review-graph Knowledge graph for token-efficient code reviews -- fixed search, configurabl... MCP
better-email-mcp IMAP/SMTP email server for AI agents -- 6 composite tools with multi-account ... MCP
better-godot-mcp Composite MCP server for Godot Engine -- 17 mega-tools for AI-assisted game d... MCP
better-notion-mcp Markdown-first Notion API server for AI agents -- 10 composite tools replacin... MCP
better-telegram-mcp MCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot... MCP
claude-plugins Full documentation: mcp.n24q02m.com — unified docs for all 8 servers + the mc... Marketplace
imagine-mcp Production-grade MCP server for image and video understanding + generation ac... MCP
jules-task-archiver Chrome Extension for bulk operations on Jules tasks via batchexecute API -- a... Tooling
mcp-core Unified MCP Streamable HTTP 2025-11-25 transport, OAuth 2.1 Authorization Ser... MCP
mnemo-mcp Persistent AI memory with hybrid search and embedded sync. Open, free, unlimi... MCP
qwen3-embed Lightweight Qwen3 text embedding and reranking via ONNX Runtime and GGUF Library
skret Secrets without the server. CLI
web-core Shared web infrastructure package for search, scraping, HTTP security, and st... Library
wet-mcp Open-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 docs/setup-manual.md -- 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

Tool Actions Description
message send, edit, delete, forward, pin, react, search, history Send, edit, delete, forward messages. Pin, react, search, browse history
chat list, info, create, join, leave, members, admin, settings, topics List and manage chats, groups, channels. Members, admin, forum topics
media send_photo, send_file, send_voice, send_video, download Send photos, files, voice notes, videos. Download media from messages
contact list, search, add, block List, search, add contacts. Block/unblock users (user mode only)
config status, set, cache_clear, setup_status, setup_start, setup_reset, setup_complete Server status, runtime settings, cache, credential setup (relay, status, reset, complete)
help -- Full documentation for any topic

MCP Resources

URI Content
telegram://docs/messages Message operations reference
telegram://docs/chats Chat management reference
telegram://docs/media Media send/download reference
telegram://docs/contacts Contact management reference
telegram://stats All 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.

Mode Storage Encryption Who can read your data?
HTTP n24q02m-hosted (default) In-memory dict[sub] = MTProtoSession In-process only Server process (cleared on restart)
HTTP self-host Same as hosted Same Only you (admin = user)
stdio proxy ~/.better-telegram-mcp/config.json AES-GCM, machine-bound key Only your OS user (file perm 0600)

License

MIT -- See LICENSE.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_telegram_mcp-4.11.0.tar.gz (198.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

better_telegram_mcp-4.11.0-py3-none-any.whl (64.1 kB view details)

Uploaded Python 3

File details

Details for the file better_telegram_mcp-4.11.0.tar.gz.

File metadata

  • Download URL: better_telegram_mcp-4.11.0.tar.gz
  • Upload date:
  • Size: 198.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for better_telegram_mcp-4.11.0.tar.gz
Algorithm Hash digest
SHA256 d839798674c2a8739b851139a7bf9280229f33c752529240887996cf5d01790f
MD5 7d741fb92d7c1e2f1fd1f94864ded739
BLAKE2b-256 1f5feb059b2e4449666fdb3312e04096ec69f6155715888609460c3fe9eff567

See more details on using hashes here.

File details

Details for the file better_telegram_mcp-4.11.0-py3-none-any.whl.

File metadata

  • Download URL: better_telegram_mcp-4.11.0-py3-none-any.whl
  • Upload date:
  • Size: 64.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for better_telegram_mcp-4.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95c7964fb911a7b8a55d803277e3d69bfd419307571d608a364f1ce7af66c515
MD5 f8feb03aae0fa440242f7ce9cde9e730
BLAKE2b-256 4dea4d5b66143321fe682130343ed11d4ab8d5108faddb667995c98bd77eb5ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page