loading…
Search for a command to run...
loading…
Telegram MTProto-based MCP server with 19 tools for reading, searching, sending, forwarding, and summarizing messages
Telegram MTProto-based MCP server with 19 tools for reading, searching, sending, forwarding, and summarizing messages
MCP server for Telegram — let AI assistants interact with your Telegram account
MCP Server Go Version License: MIT Go Report Card mcp-telegram MCP server
go install github.com/tolmachov/mcp-telegram@latest
Or build from source:
git clone https://github.com/tolmachov/mcp-telegram.git
cd mcp-telegram
make
api_id and api_hashStore credentials (macOS Keychain; plaintext JSON at ~/.local/state/mcp-telegram/config.json with 0600 perms on Linux/Windows):
mcp-telegram config set api-id 123456789
mcp-telegram config set api-hash abcd1234efgh5678
Or use a .env file:
cp .env.example .env
# Edit .env with your credentials
mcp-telegram login --phone +1234567890
You'll be prompted for a verification code sent to your Telegram.
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 mcp add telegram -- /path/to/mcp-telegram run
Set environment variables in your .env file or pass them via --env.
19 tools exposed to MCP clients. Messages are identified by opaque string
handles ("42" for regular, "s:42" for scheduled) — copy them back
verbatim from tool outputs to follow-up calls, never parse or construct
them manually.
| Tool | Description |
|---|---|
GetMe |
Get current user information |
GetChats |
List all chats, groups, and channels |
SearchChats |
Fuzzy search for chats by name |
GetChatInfo |
Get detailed information about a chat |
GetMessages |
Get messages from a chat (set include_scheduled=true to also list pending scheduled messages in a separate field) |
SearchMessages |
Search within one chat by substring, with optional date / sender / media / thread filters |
SearchMessagesGlobal |
Search by substring across all chats with opaque cursor-based pagination |
GetMessageContext |
Get messages around a specific anchor message in chronological order |
SendMessage |
Send, reply, schedule, or draft a message. mode = send (default) / schedule / draft; reply_to_message_id works with any mode; schedule_at is RFC3339 |
EditMessage |
Edit a message; for scheduled handles, schedule_at reschedules delivery in the same call |
DeleteMessage |
Delete a message; "s:<id>" handles cancel pending scheduled messages |
ForwardMessage |
Forward a delivered message (scheduled handles are rejected) |
ResolveMessageLink |
Parse t.me / tg:// message links into chat_id, message_id, and topic_message_id for forum links |
MarkAsRead |
Mark one or more chats as read |
BackupMessages |
Export messages to a text file (idempotent; overwrites target) |
ResolveUsername |
Resolve @username to user/chat info |
SetChatMute |
Mute or unmute chat notifications (muted bool + optional duration_seconds) |
SummarizeChat |
AI-powered chat summarization via sampling / Gemini / Ollama / Anthropic |
GetMedia |
Download photo media from a media resource URI; returns MCP image content |
| URI | Description |
|---|---|
telegram://me |
Current user info |
telegram://chats |
All chats list |
telegram://chat/{id}/info |
Detailed info for any chat ID via resource template |
telegram://chats/{id} |
Last 100 messages from a pinned chat (dynamic resource, only for currently pinned chats) |
Pinned chat resources are created dynamically for each pinned chat and refreshed in the background; clients will receive resources/list_changed when the set changes.
3 parameterized prompts that MCP clients expose as slash-commands or quick actions.
| Prompt | Arguments | Description |
|---|---|---|
daily-digest |
period — day (default) / week / month |
Walks active chats and produces a per-chat digest of key updates and action items. Read-only. |
chat-catchup |
chat (required) — ID / @username / title; period — day / week (default) / month |
Summarizes a specific chat and lists messages that look like they need a reply. Read-only. |
find-and-reply |
chat (required), query (required) — what to search for, reply (required) — reply text or instruction |
Searches for a message, shows a draft reply, and sends only after explicit user confirmation. |
Here are some example prompts you can use with AI assistants:
The SummarizeChat tool supports multiple LLM providers:
Configure via environment variables:
SUMMARIZE_PROVIDER=ollama # or: sampling, gemini, anthropic
SUMMARIZE_MODEL= # provider-specific model name
# 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
# Securely store config values (macOS Keychain / file on Linux)
mcp-telegram config set api-id 123456789
mcp-telegram config set api-hash abcd1234
# List stored keys
mcp-telegram config list
# Delete a stored value
mcp-telegram config delete api-id
Allowed keys: api-id, api-hash, anthropic, gemini.
Credentials resolve in this priority order (higher wins): CLI flags (--api-id, --api-hash) → environment variables (including .env) → secure store values set via config set. This lets you keep stable values in the keychain and override per-run from the command line without editing the store.
| Environment Variable | Description | Default |
|---|---|---|
TELEGRAM_API_ID |
Telegram API ID | Required |
TELEGRAM_API_HASH |
Telegram API Hash | Required |
TELEGRAM_ALLOWED_PATHS |
Allowed directories for backups | OS app data dir |
SUMMARIZE_PROVIDER |
LLM provider for summarization | sampling (experimental) |
SUMMARIZE_MODEL |
Model name | Provider default |
SUMMARIZE_BATCH_TOKENS |
Tokens per summarization batch | 8000 |
OLLAMA_URL |
Ollama API URL | http://localhost:11434 |
GEMINI_API_KEY |
Google Gemini API key | - |
ANTHROPIC_API_KEY |
Anthropic API key | - |
TELEGRAM_MEDIA_MAX_BYTES |
Max bytes GetMedia will download per call (cap to avoid OOM on large attachments) |
52428800 (50 MiB) |
TELEGRAM_RATE_LIMIT_RPS |
RPS ceiling for history-fetching calls to Telegram. Exceeding Telegram's FLOOD_WAIT thresholds pauses all tools. | 0 (safe built-in default) |
TELEGRAM_PINNED_REFRESH_SECONDS |
Polling interval (seconds) for the pinned-chat resource watcher. 0 disables the watcher. |
30 |
Tools like DeleteMessage request user confirmation via MCP elicitation before proceeding. If your MCP client does not support elicitation, the server proceeds automatically without a confirmation dialog.
~/.local/state/mcp-telegram/session.json with 0600 file permissions. The file is plaintext — keep the containing user account trusted, and prefer running on macOS when handling sensitive accounts.Config values set via mcp-telegram config set (API keys, Telegram credentials) follow the same backend: Keychain on macOS, plaintext JSON on Linux/Windows.
Run in your terminal:
claude mcp add mcp-telegram -- npx Yes, Telegram MCP is free — one-click install via Unyly at no cost.
No, Telegram runs without API keys or environment variables.
Self-hosted: the server runs locally on your machine via the install command above.
Open Telegram on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Read, send and search emails from Claude
by GoogleSend, search and summarize Slack messages
by SlackNo-code MCP client for team chat platforms, such as Slack, Microsoft Teams, and Discord.
A community discord server dedicated to MCP by [Frank Fiegel](https://github.com/punkpeye)
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All communication MCPs