MCP Hub
Back to servers

Telegram

A robust MCP server that enables AI assistants to interface with Telegram for chat management, message automation, and AI-driven conversation summarization.

Tools
16
Updated
Dec 30, 2025

mcp-telegram

MCP server for Telegram — let AI assistants interact with your Telegram account

MCP Server Go Version License: MIT Go Report Card


Features

  • Chat Management: List, search, mute/unmute chats
  • Messages: Read, send, draft, schedule, and backup messages
  • AI Summarization: Summarize chat conversations using multiple LLM providers
  • Secure: Session stored in macOS Keychain (file-based storage on Linux/Windows)

Installation

go install github.com/tolmachov/mcp-telegram@latest

Or build from source:

git clone https://github.com/tolmachov/mcp-telegram.git
cd mcp-telegram
go build -o mcp-telegram .

Setup

1. Get Telegram API Credentials

  1. Go to my.telegram.org/apps
  2. Create an application
  3. Copy api_id and api_hash

2. Configure Environment

cp .env.example .env
# Edit .env with your credentials

3. Login to Telegram

mcp-telegram login --phone +1234567890

You'll be prompted for a verification code sent to your Telegram.

4. Configure MCP Client

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "telegram": {
      "command": "mcp-telegram",
      "args": ["run"],
      "env": {
        "TELEGRAM_API_ID": "your_api_id",
        "TELEGRAM_API_HASH": "your_api_hash"
      }
    }
  }
}

Claude Code

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "tg": {
      "type": "stdio",
      "command": "/path/to/mcp-telegram",
      "args": ["run"],
      "env": {
        "TELEGRAM_API_ID": "your_api_id",
        "TELEGRAM_API_HASH": "your_api_hash"
      }
    }
  }
}

Available Tools

ToolDescription
GetMeGet current user information
GetChatsList all chats, groups, and channels
SearchChatsFuzzy search for chats by name
GetChatInfoGet detailed information about a chat
GetMessagesGet messages from a chat
SendMessageSend a message
DraftMessageSave a draft message
ScheduleMessageSchedule a message for later
GetScheduledMessagesList scheduled messages
DeleteScheduledMessageCancel a scheduled message
BackupMessagesExport messages to a text file
ResolveUsernameResolve @username to user/chat info
MuteChatMute chat notifications
UnmuteChatUnmute chat notifications
SummarizeChatAI-powered chat summarization
GetMediaGet photo from a message by resource URI

Available Resources

URIDescription
telegram://meCurrent user info
telegram://chatsAll chats list
telegram://chats/{id}Last 100 messages from a pinned chat (dynamic)

Pinned chat resources are created dynamically for each pinned chat and updated on every resources/list request.

Prompt Examples

Here are some example prompts you can use with AI assistants:

Message Management

  • "Check for any unread important messages in my Telegram"
  • "Summarize all my unread Telegram messages"
  • "Read and analyze my unread messages, prepare draft responses where needed"
  • "Check non-critical unread messages and give me a brief overview"

Organization

  • "Analyze my Telegram dialogs and suggest a folder structure"
  • "Help me categorize my Telegram chats by importance"
  • "Find all work-related conversations and suggest how to organize them"

Communication

  • "Monitor specific chat for updates about [topic]"
  • "Draft a polite response to the last message in [chat]"
  • "Check if there are any unanswered questions in my chats"

Backup & Export

  • "Backup my conversation with [contact] to a file"
  • "Export the last week of messages from [group]"

Chat Summarization

The SummarizeChat tool supports multiple LLM providers:

  • sampling (experimental): Uses the MCP client's LLM via MCP Sampling. Only works with clients that support sampling: VS Code, fast-agent, Continue. Does NOT work with Claude Desktop or Claude Code.
  • ollama: Local LLM via Ollama - no API key required
  • gemini: Google Gemini API
  • anthropic: Anthropic Claude API

Configure via environment variables:

SUMMARIZE_PROVIDER=ollama  # or: sampling, gemini, anthropic
SUMMARIZE_MODEL=           # provider-specific model name

Commands

# Run MCP server (used by MCP clients)
mcp-telegram run

# Login to Telegram
mcp-telegram login --phone +1234567890

# Logout and delete session
mcp-telegram logout

Configuration Options

Environment VariableDescriptionDefault
TELEGRAM_API_IDTelegram API IDRequired
TELEGRAM_API_HASHTelegram API HashRequired
TELEGRAM_ALLOWED_PATHSAllowed directories for backupsOS app data dir
SUMMARIZE_PROVIDERLLM provider for summarizationsampling (experimental)
SUMMARIZE_MODELModel nameProvider default
SUMMARIZE_BATCH_TOKENSTokens per summarization batch8000
OLLAMA_URLOllama API URLhttp://localhost:11434
GEMINI_API_KEYGoogle Gemini API key-
ANTHROPIC_API_KEYAnthropic API key-

Session Storage

  • macOS: Stored securely in Keychain
  • Linux/Windows: Stored in ~/.local/state/mcp-telegram/session.json

License

MIT

Reviews

No reviews yet

Sign in to write a review