freshcrate
Skin:/
Home > MCP Servers > fast-mcp-telegram

fast-mcp-telegram

Telegram MCP Server and HTTP-MTProto bridge | Multi-user, web setup, Docker and MTProto-Proxy ready

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Telegram MCP Server and HTTP-MTProto bridge | Multi-user, web setup, Docker and MTProto-Proxy ready

README

Hero image

Python Version License: MIT Docker Ready Health Status

Fast MCP Telegram Server - Production-ready Telegram integration for AI assistants with comprehensive search, messaging, and direct API access capabilities.

Demo

  1. Open https://tg-mcp.l1979.ru/setup to begin the authentication flow.
  2. After finishing, you'll receive a ready-to-use mcp.json with your Bearer token.
  3. Use the config with your MCP client to check out this MCP server capabilities.
  4. Or try the HTTP-MTProto Bridge right away with curl (replace TOKEN):
curl -X POST "https://tg-mcp.l1979.ru/mtproto-api/messages.SendMessage" \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"params": {"peer": "me", "message": "Hello from Demo!"}}'

Features

Feature Description
🔐 Multi-User Authentication Production-ready Bearer token auth with session isolation and LRU cache management
🌐 HTTP-MTProto Bridge Direct curl access to any Telegram API method with entity resolution and safety guardrails
🔍 Unified Message API Single get_messages tool for search, browse, read by IDs, and replies - 5 modes in one
💬 Universal Replies Get replies from channel posts, forum topics, or any message with one parameter
🔎 Intelligent Search Global & per-chat message search with multi-query support and intelligent deduplication
🏗️ Dual Transport Seamless development (stdio) and production (HTTP) deployment support
📁 Secure File Handling Rich media sharing with SSRF protection, size limits, album support, optional HTTP attachment streaming
✉️ Advanced Messaging Send, edit, reply, post to forum topics, formatting, file attachments, and phone number messaging
🎤 Voice Transcription Automatic speech-to-text for Premium accounts with parallel processing and polling
🗃️ Unified Session Management Single configuration system for setup and server, with multi-account support
👥 Smart Contact Discovery Search users, groups, channels with uniform entity schemas, forum detection, profile enrichment
📁 Folder Filtering Filter chats by dialog folder (archived, custom folders) with integer ID or name matching
🤖 Bot Chat Detection Bots identified with type: "bot" and filterable via chat_type="bot"
High Performance Async operations, parallel queries, connection pooling, and memory optimization
🛡️ Production Reliability Auto-reconnect, structured logging, comprehensive error handling with clear actionable messages
🎯 AI-Optimized Literal parameter constraints, LLM-friendly API design, and MCP ToolAnnotations
🌐 Web Setup Interface Browser-based authentication flow with immediate config generation
🚀 MTProto Proxy Support Connect via MTProto proxy with automatic Fake TLS (EE prefix) and standard proxy detection

Quick Start (pip)

1. Install

pip install fast-mcp-telegram

2. Authenticate

fast-mcp-telegram-setup --api-id="your_api_id" --api-hash="your_api_hash" --phone-number="+123456789"

Or use the web interface: run fast-mcp-telegram and open /setup

Quick Start (uvx)

1. First-time setup

uvx --from fast-mcp-telegram fast-mcp-telegram-setup --api-id="your_api_id" --api-hash="your_api_hash" --phone-number="+123456789"

Sessions are stored in ~/.config/fast-mcp-telegram/ and persist between uvx invocations.

2. Configure MCP Client

STDIO:

{
  "mcpServers": {
    "telegram": {
      "command": "uvx",
      "args": ["fast-mcp-telegram"],
      "env": {
        "API_ID": "your_api_id",
        "API_HASH": "your_api_hash"
      }
    }
  }
}

HTTP_AUTH:

{
  "mcpServers": {
    "telegram": {
      "url": "https://your-server.com",
      "headers": {
        "Authorization": "Bearer AbCdEfGh123456789..."
      }
    }
  }
}

4. Start Using

{"tool": "search_messages_globally", "params": {"query": "hello", "limit": 5}}
{"tool": "get_messages", "params": {"chat_id": "me", "limit": 10}}
{"tool": "send_message", "params": {"chat_id": "me", "message": "Hello!"}}

Deploy to Production

This project uses GitHub Actions for automatic builds and deployments.

  1. Fork this repository
  2. Add secrets in GitHub Settings: SSH_HOST, SSH_USER, SSH_PRIVATE_KEY
  3. Edit .env in your fork
  4. Push to main — deployment happens automatically

Manual deployment: Use scripts/sync-remote-config.sh

See Deployment Guide for details.

Available Tools

Tool Purpose Key Features
search_messages_globally Search across all chats Multi-term queries, date filtering, chat type filtering
get_messages Unified message retrieval Search/browse, read by IDs, get replies (posts/topics/messages), 5 modes
send_message Send new message File attachments (URLs/local), formatting (markdown/html), reply to forum topics
edit_message Edit existing message Text formatting, preserves message structure
find_chats Find users/groups/channels Multi-term search, contact discovery, folder filtering, username/phone lookup
get_chat_info Get detailed profile info Member counts, bio/about, online status, forum topics, enriched data
send_message_to_phone Message phone numbers Auto-contact management, optional cleanup, file support
invoke_mtproto Direct Telegram API access Raw MTProto methods, entity resolution, safety guardrails

See Tools Reference for detailed documentation with examples.

Security

  • Bearer token authentication with session isolation
  • SSRF protection for file downloads
  • Dangerous method blocking with opt-in override

See SECURITY.md for details.

Documentation

License

MIT License - see LICENSE

Release History

VersionChangesUrgencyDate
v0.28.2Folder filter query performance: use dialog.date instead of GetPeerDialogsRequest for flags entities ## Fixes - **Folder filter (`folder=`) query hang** — Fixed a ~30s stall when querying Telegram folders that combine `include_peers` with date filters (e.g. `find_chats` with `folder="Без каналов"`, `min_date`). The hang was caused by `GetPeerDialogsRequest` receiving stale `access_hash` for certain entities from `iter_dialogs`, which blocked subsequent batches. Now `dialog.date` from the dialogHigh6/4/2026
0.24.0Multi‑term global search is now up to 2× faster — parallel gather replaces sequential interleaving. ## New Features - **`find_chats` / parallel multi‑term search** — Global search with comma‑separated terms (e.g. `query="alex, channel, bot"`) now runs all `SearchRequest` calls in parallel via `asyncio.gather()`. Results are merged round‑robin with deduplication. Measured **−48%** on the benchmark stand (0.54s → 0.28s for 3 terms). This release makes multi‑term global search significantly fasteHigh5/29/2026
0.19.0For **one agent with multiple MCP connections** to the same server (same URL, different Bearer tokens): opt-in tool name prefixes so merged tool lists stay distinct. **Multi-user shared servers** (each user, one token, one connection) already isolate sessions and do **not** need `PREFIX_MCP_TOOLS_WITH_ACCOUNT`. ## New Features - **`PREFIX_MCP_TOOLS_WITH_ACCOUNT`** — Per-connection tool name prefix (`{username}_send_message` or `{user_id}_…`). Use when one agent wires several tokens to one HTTPHigh5/24/2026
0.18.0Reliable forum thread and reply fetching: topic roots, in-topic anchors, and supergroup threads each use the right Telegram API path. ## New Features - **`get_messages` `thread_scope`** - With `reply_to_id`, choose `auto` (default), `full`, or `direct`. Forum **topic ids** load the whole topic via GetReplies; a **message id inside a topic** uses in-topic search (offset jump + filter). Supergroup `full` uses `SearchRequest` with `top_msg_id`. Channel posts still resolve to the linked discussion High5/18/2026
0.17.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.17.2...0.17.3High5/12/2026
0.17.2**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.17.1...0.17.2High5/5/2026
0.17.1Direct CDN resend and improved find_chats performance with date-based filtering. ## New Features - **`send_message` file_id passthrough**: Resending files from `get_messages` now uses Telegram's CDN directly — no download/upload through the server. Works for all media types (photos, documents, videos, etc.). URL format standardized to `/v1/attachments/{uuid}/{filename}`. - **`find_chats` date filtering for per-chat search**: Added `min_date` and `max_date` parameters to filter messages withHigh5/3/2026
0.16.6Major docs overhaul **Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.16.5...0.16.6High4/22/2026
0.16.4**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.16.3...0.16.4High4/20/2026
0.16.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.16.2...0.16.3High4/14/2026
0.16.2**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.16.1...0.16.2High4/13/2026
0.16.1## What's Changed * chore(deps): bump cryptography from 46.0.6 to 46.0.7 in the uv group across 1 directory by @dependabot[bot] in https://github.com/leshchenko1979/fast-mcp-telegram/pull/35 **Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.16.0...0.16.1High4/9/2026
0.16.0## New Features -**`find_chats` / Bot chat type** - Bots now appear as a separate type from regular users, making it easier to find and identify Telegram bots -**`find_chats` / Folder filtering** - Filter your chats by Telegram folder using the new `folder` parameter (by name or ID) -**`find_chats` / Date range filtering** - Narrow chat results by last activity date using `min_date` and `max_date` parameters This release enhances chat discovery with flexible filtering options for managinMedium3/31/2026
0.15.0Connect via MTProto proxy servers including Fake TLS (EE prefix) obfuscation for networks that block direct Telegram connections. ## New Features - **MTProto Proxy Support** - Connect to Telegram through MTProto proxy servers by setting `MTPROTO_PROXY` environment variable. Supports both standard MTProto proxies and Fake TLS proxies with automatic secret format detection and processing. Configure via URL format (`tg://proxy?server=...&port=443&secret=...`) or simple format (`host:port:secretMedium3/31/2026
0.14.2## What's Changed * Clarify stdio-only local file paths in tool docstrings by @leshchenko1979 in https://github.com/leshchenko1979/fast-mcp-telegram/pull/27 * Fix MediaInvalidError for single-URL file sends by @leshchenko1979 in https://github.com/leshchenko1979/fast-mcp-telegram/pull/28 **Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.14.1...0.14.2Medium3/29/2026
0.14.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.14.0...0.14.1Medium3/29/2026
0.14.0 ## New Features - **`url_auth` endpoint** - New URL-based authentication allows clients that cannot set custom HTTP headers to authenticate by including the bearer token in the URL path (e.g., `/v1/url_auth/{token}/mcp/tools/call`) - **Dual authentication options** - Setup now displays both Header-Based Auth (recommended) and URL-Based Auth configurations for easy copy/paste - **Phone number validation** - Enhanced phone number normalization and validation in web setup with clear error messMedium3/29/2026
0.13.1## What's Changed * Update activeContext and progress documentation for web setup improvements by @leshchenko1979 in https://github.com/leshchenko1979/fast-mcp-telegram/pull/20 **Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.13.0...0.13.1Medium3/27/2026
0.13.0## New Features - **Attachment download URLs** - Media in tool results will now include `attachment_download_url`. AI agents can use these links to download attachments and media. Downloads use a short-lived ticket and do not require authorization. ## Fixes - **FastMCP 3.x** - Upgraded to FastMCP 3.x; HTTP MCP behavior and auth wiring follow the current FastMCP stack. - **`send_message` on channels with discussions** - When `reply_to_id` targets a channel post that has a linked discussion Medium3/25/2026
0.12.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.12.2...0.12.3Low3/15/2026
0.12.2## What's Changed * Parse mode lowercasing, autodetection by @leshchenko1979 in https://github.com/leshchenko1979/fast-mcp-telegram/pull/18 **Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.12.1...0.12.2Low3/1/2026
0.12.0## New Features - **`get_messages` tool** - Replaces `search_messages_in_chat` and `read_messages` with one tool supporting five modes: search, browse, read by IDs, get replies, and search in replies - **Channel post comments** - `reply_to_id` automatically detects channel posts with discussion groups and fetches comments - **Forum topics support** - `get_chat_info` returns topics list with `topics_limit`; `send_message` and `edit_message` support posting and editing in forum threads via `repLow2/28/2026
0.11.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.11.0...0.11.1Low2/18/2026
0.11.0## New Features - **Voice Message Transcription** - Automatic speech-to-text for Premium Telegram accounts with parallel processing and polling - **Session Deletion** - Added secure session deletion functionality to the web setup interface for permanent removal of session files - **Health Monitoring Script** - New `check-status.sh` script for application health checks and container statistics monitoring - **Enhanced Deployment** - Improved deployment script with code formatting validation chLow1/21/2026
0.10.2**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.10.1...0.10.2Low1/19/2026
0.10.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.10.0...0.10.1Low1/17/2026
0.10.0Enhanced read_messages with automatic parsing of Telegram Todo lists and Polls, returning structured JSON data instead of raw objects. Added comprehensive Todo list parsing (titles, items, completion status, timestamps) and Poll parsing (questions, options, vote counts, metadata). ## New Features - **Todo List Support** - read_messages now automatically detects and parses Telegram Todo lists, extracting structured data including titles, completion status, and timestamps for each item - **PoLow11/27/2025
0.9.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.9.0...0.9.1Low11/26/2025
0.9.0## Message Formatting - **Auto parse_mode detection** - Messages automatically detect and use HTML/Markdown formatting, with HTML taking precedence when both are present - **Smarter message sending** - No need to manually specify parse_mode; formatting is detected automatically across all message tools ## Search Enhancements - **Public/private chat filtering** - New `public` parameter filters search results by username presence (public chats) or invite-only status - **Better chat discovLow11/19/2025
0.8.4**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.8.3...0.8.4Low11/12/2025
0.8.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.8.2...0.8.3Low10/17/2025
0.8.2**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.8.1...0.8.2Low10/11/2025
0.8.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.8.0...0.8.1Low10/2/2025
0.8.0### Multi-Bot Support - **Bot Account Setup** - Added support for creating bot sessions using `--bot-token` parameter in CLI setup, enabling multiple bots to operate independently with their own Bearer tokens and session files - **Bot Session Isolation** - Each bot gets its own unique Bearer token and session file, allowing multiple bots to run simultaneously without conflicts - **Bot Restrictions** - Implemented automatic detection and restrictions for bot sessions, ensuring bots can only acLow10/2/2025
0.7.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.7.0...0.7.1Low10/2/2025
0.7.0## Features - **MTProto API HTTP endpoint** - Added `POST /mtproto-api/{method}` (+ alias `/mtproto-api/v1/{method}`) to call raw Telegram MTProto methods from HTTP. Includes case-insensitive method resolution, optional entity resolution (e.g., usernames → entities), and standardized JSON responses. - **Entity resolution convenience** - Optional `resolve: true` automatically resolves fields like `peer`, `from_peer`, `to_peer`, `user_id`, and list variants to proper Telegram entities. ## SecLow10/1/2025
0.6.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.6.0...0.6.1Low10/1/2025
0.6.0## New Features - **File sending in messages** - Both `send_message` and `send_message_to_phone` tools now support sending files alongside text messages. Messages become captions when files are included. - **Flexible file sources** - Send files from URLs (all server modes) or local paths (stdio mode only for security) - **Multiple file support** - Send single files or multiple files as albums with automatic parallel downloading from URLs - **Smart file handling** - Automatic file type detectLow10/1/2025
0.5.0## Tool & API Clarity - **Clearer tool names and parameters**: Refined names and descriptions reduce ambiguity and improve LLM ergonomics. - **Explicit operation split**: Clear separation between global vs per‑chat search and send vs edit operations guides correct usage. - **Strict value sets**: `chat_type` and `parse_mode` accept only valid values to prevent input errors. ## Setup & Authentication UX - **Complete 2FA web flow**: Added the missing `/setup/2fa` route and improved the setupLow9/17/2025
0.4.5**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.4.4...0.4.5Low9/15/2025
0.4.4**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.4.3...0.4.4Low9/9/2025
0.4.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.4.2...0.4.3Low9/9/2025
0.4.2**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.4.1...0.4.2Low9/8/2025
0.4.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.4.0...0.4.1Low9/8/2025
0.4.0## Web Setup Interface (HTMX/Jinja2) - **Browser-based Telegram auth flow** - Replaces the CLI for browser users with a guided flow: `/setup` → phone → code/2FA → config generation and download. Uses HTMX fragments for seamless UX. - **Runtime config generation** - Generates `mcp.json` using `DOMAIN` env at runtime with immediate download and copy options. - **Session hygiene** - Adds TTL-based opportunistic cleanup for temporary `setup-*.session` files (default 900s). ## Server ArchitectuLow9/8/2025
0.2.1## Authentication System Resolution - **Bearer Token Authentication Fixed** - Successfully identified and resolved the core issue where bearer tokens were not being properly extracted and processed by the `@with_auth_context` decorator, causing incorrect fallback to default sessions - **Critical FastMCP Parameter Discovery** - Discovered that `stateless_http=True` parameter is essential for FastMCP to properly execute authentication decorators in HTTP transport mode when dealing with current vLow9/4/2025
0.2.0## 🎯 Major Features ### 🔐 Multi-User Bearer Token Authentication - **Token-Based Sessions**: Each user gets unique 256-bit cryptographically secure Bearer tokens - **Session Isolation**: Token-specific session files (`{token}.session`) for complete user separation - **Authentication Middleware**: `@with_auth_context` decorator applied to all MCP tools - **Dual Transport Support**: HTTP (multi-user) and stdio (single-user legacy) modes - **Development Mode**: `DISABLE_AUTH=true` environLow9/4/2025
0.1.4**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.1.3...0.1.4Low9/3/2025
0.1.3**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.1.2...0.1.3Low9/3/2025
0.1.2Release 0.1.2Low9/3/2025
0.1.1**Full Changelog**: https://github.com/leshchenko1979/fast-mcp-telegram/compare/0.1.0...0.1.1Low9/3/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

mcp-audit🌟 Track token consumption in real-time with MCP Audit. Diagnose context bloat and unexpected spikes across MCP servers and tools efficiently.main@2026-06-06
pattern8Enforce zero-trust rules for AI agents to prevent hallucinations, unsafe actions, and policy bypassesmain@2026-06-05
Ollama-Terminal-AgentAutomate shell tasks using a local Ollama model that plans, executes, and fixes commands without cloud or API dependencies.main@2026-06-04
GhostDeskGive any AI agent a full desktop — it sees the screen, clicks, types, and runs apps like a human. Automate anything with a UI: browsers, legacy software, internal tools. No API needed. One Docker commv7.4.1
AI-Agents-Orchestrator🪈 Intelligent orchestration system that coordinates multiple AI coding assistants (Claude, Codex, Gemini CLI, Copilot CLI) to collaborate on complex software development tasks via REPL or a Vue/Nuxt v1.0.0

More in MCP Servers

claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.
langchain4jLangChain4j is an open-source Java library that simplifies the integration of LLMs into Java applications through a unified API, providing access to popular LLMs and vector databases. It makes impleme
hyperframesWrite HTML. Render video. Built for agents.
claude-code-guideClaude Code Guide - Setup, Commands, workflows, agents, skills & tips-n-tricks go from beginner to power user!