telegram-mcp-server
telegram-mcp-server
Un servidor MCP de Telegram mediante Telethon — cliente persistente, seguro contra flooding, 9 herramientas agrupadas.
Cero claves API en el código. Los archivos de sesión se almacenan localmente. Funciona con cuentas de usuario (2FA) y bots.
1. Instalación
git clone <this-repo> telegram-mcp-server
cd telegram-mcp-server
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
pip install -e .Obtén tus credenciales API
Ve a my.telegram.org
Inicia sesión con tu número de teléfono
Crea una aplicación → obtén tu API ID y API Hash
Autenticación única
# User account (with 2FA support)
export TG_API_ID=12345
export TG_API_HASH="your_hash_here"
telegram-mcp-server --auth --phone +33612345678
# Or via MCP tool: tg_session(action="auth", api_id=12345, api_hash="...", phone="+33612345678")Related MCP server: tdlib-mcp-server
2. Regístrate en tu cliente MCP
Claude Desktop / OpenCode
{
"mcpServers": {
"telegram": {
"command": "telegram-mcp-server",
"env": {
"TG_API_ID": "12345",
"TG_API_HASH": "your_hash_here"
}
}
}
}Si no está en el PATH:
{
"mcpServers": {
"telegram": {
"command": "/path/to/.venv/bin/python",
"args": ["-m", "telegram_mcp_server"],
"env": {
"TG_API_ID": "12345",
"TG_API_HASH": "your_hash_here"
}
}
}
}Docker
docker build -t telegram-mcp .
docker run -i --rm \
-v ~/.telegram-mcp/sessions:/root/.telegram-mcp/sessions \
-e TG_API_ID=12345 \
-e TG_API_HASH="your_hash" \
telegram-mcp3. Catálogo de herramientas (9 herramientas, 8 acciones)
tg_session — Gestión de sesión
action | Required args | Description |
|
| Autenticar (soporta 2FA) |
| — | Comprobar estado de sesión |
| — | Eliminar sesión |
tg_message — Enviar, reenviar, eliminar, responder
action | Required args | Description |
|
| Enviar un mensaje |
|
| Reenviar un mensaje |
|
| Eliminar un mensaje |
|
| Responder a un mensaje |
tg_chat — Operaciones de chat
action | Required args | Description |
| — | Listar chats recientes |
|
| Obtener información del chat |
|
| Listar miembros del chat |
|
| Salir de un chat |
tg_search — Búsqueda
action | Required args | Description |
|
| Buscar mensajes (opcionalmente en |
|
| Buscar contactos/usuarios |
|
| Buscar canales |
tg_history — Historial de chat
action | Required args | Description |
|
| Obtener historial de mensajes |
|
| Obtener historial solo de medios |
|
| Obtener historial solo de archivos |
tg_user — Operaciones de usuario
action | Required args | Description |
| — | Obtener tu propia información |
|
| Obtener información del usuario |
|
| Bloquear un usuario |
|
| Desbloquear un usuario |
tg_media — Enviar medios
action | Required args | Description |
|
| Enviar una foto |
|
| Enviar un video |
|
| Enviar un documento |
|
| Enviar una nota de voz |
tg_channel — Gestión de canales
action | Required args | Description |
|
| Crear un supergrupo/canal |
|
| Unirse a un canal |
|
| Salir de un canal |
|
| Obtener información del canal |
tg_draft — Mensajes borrador
action | Required args | Description |
|
| Guardar un borrador |
| — | Listar borradores |
|
| Eliminar un borrador |
4. Variables de entorno
Variable | Default | Description |
|
| ID de API de Telegram (de my.telegram.org) |
|
| Hash de API de Telegram |
|
| Ubicación de los archivos de sesión |
5. Seguridad
Límite de frecuencia: Las acciones de envío están limitadas a 5/min. Las acciones de lectura son ilimitadas.
Reintento automático de FloodWaitError: Espera el tiempo requerido (máximo 5 minutos).
Archivos de sesión: Solo locales, nunca se incluyen en git.
Soporte 2FA: Compatibilidad total con cuentas con autenticación de dos factores.
6. Recursos MCP
tg://version— Versión del servidortg://session/status— Estado de sesión
Licencia
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityBmaintenanceEnables AI agents to interact with Telegram via MTProto, supporting high-performance communication and seamless integration.1
- FlicenseNot gradedqualityCmaintenanceConnects AI agents to Telegram via the official TDLib library, enabling tools like getting user info, listing dialogs, and searching messages.
- AlicenseNot gradedqualityCmaintenanceEnables interaction with Telegram Bot API for sending messages, photos, editing messages, answering callbacks, and fetching updates.MIT
- AlicenseNot gradedqualityBmaintenanceEnables sending Telegram messages, photos, and documents, and retrieving bot information through the Telegram Bot API.581MIT
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Search 1.2M+ Telegram channels, 245k+ chats, 160k+ bots — no account, no key, no install.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Steph-ux/telegram-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server