Telegram MCP server — give AI tools direct access to your Telegram account
claude mcp add telegram-mcp -- python -m telegram-mcp-jgalea{
"mcpServers": {
"telegram-mcp": {
"command": "python",
"args": ["-m", "telegram-mcp-jgalea"]
}
}
}MCP Servers overview
# telegram-mcp
<!-- mcp-name: io.github.jgalea/telegram-mcp -->
Give your AI tools direct access to Telegram. Read chats, send messages, search history, manage groups, download media — all via the Model Context Protocol.
telegram-mcp is an [MCP server](https://modelcontextprotocol.io) that connects your Telegram account to Claude Code, Cursor, Windsurf, or any AI tool that supports MCP. Instead of switching to Telegram, you ask the AI to check your messages, reply to someone, or find that link from last week — and it does.
**What makes this different:**
- **Your real account.** Uses MTProto (Telethon), not the Bot API. You see everything you'd see in the Telegram app — private chats, groups, channels, media.
- **40 tools.** Chats, messages, search, media, contacts, groups, channels, scheduling, reactions, admin tools, and more.
- **Passive caching.** Messages are cached in local SQLite as you use the server. No explicit sync step — the cache builds itself. Gives you searchable history that grows over time.
- **Security first.** Session files stored with restricted permissions. No credentials in config files. Rate limiting built in.
## Quick Start
> **This is not a bot.** There is no bot to add. No third party gives you a phone number. You log in as yourself, with the same phone number you already use for Telegram. If an AI tool tells you to "add a bot to give you a number", ignore it — and never share a Telegram login code with anyone, ever.
> **If you're asking Claude (or another AI agent) to install this for you:** the agent can wire up the MCP server config and clone the repo, but the agent **cannot** complete the login step. Login is interactive — Telegram sends a code to your phone, and you type it into a terminal prompt yourself. You must run `telegram-mcp login` in a real terminal once, then the agent can use the server.
### Install from PyPI
```bash
uv tool install telegram-mcp-jgalea
```
Or with pip:
```bash
pip install telegram-mcp-jgalea
```
Both provide the `telegram-mcp` command.
### Install from source
```bash
git clone https://github.com/jgalea/telegram-mcp.git
cd telegram-mcp
uv sync
```
### Authenticate
Run the login command once to create your Telegram session:
```bash
telegram-mcp login
```
You'll need a Telegram API ID and hash first. To get them:
1. Go to [my.telegram.org](https://my.telegram.org) and log in with your phone number
2. Click **API development tools**
3. If you already have an app, use those credentials. Telegram only allows one API app per account, and the same api_id/api_hash work for any Telegram project.
4. If not, fill in the form: App title (e.g. "telegram-mcp"), Short name (anything), Platform: "Other". Description can be left blank. Click **Create application**.
5. Copy the **App api_id** (a number) and **App api_hash** (a hex string)
The login command will prompt for these if not already configured, then ask for:
1. Your phone number
2. The verification code Telegram sends you
3. Your 2FA password (if enabled)
The session is saved to `~/.telegram-mcp/session.session`. You only need to do this once.
### Connect to Claude Code
Add to your MCP config (`~/.claude.json`):
```json
{
"mcpServers": {
"telegram": {
"command": "telegram-mcp",
"args": ["serve"]
}
}
}
```
If installed from source:
```json
{
"mcpServers": {
"telegram": {
"command": "uv",
"args": ["run", "--directory", "/path/to/telegram-mcp", "telegram-mcp", "serve"]
}
}
}
```
## Troubleshooting
### Tools return errors or empty results
You almost certainly haven't logged in yet. Installing the MCP server and logging into Telegram are **two separate steps** — installation alone is not enough. Run `telegram-mcp login` in a real terminal and complete the phone + code + 2FA flow. After that, restart Claude Code (or your MCP client) so the proxy picks up the new session.
You can confirm the session is healthy with the `get_status` tool — it returns `{"connected": true, "authorized": true}` when ready.
### Claude says "this MCP can only access a bot conversation"
This is a hallucination. The server uses MTProto (Telethon) and logs in as your full Telegram account — every chat, group, channel, and contact you can see in the Telegram app is accessible. There is no bot involved. If this message appears, the underlying cause is almost always that the login step hasn't been done; see above.
### Claude tells me to add a bot or give my number to a bot
**Do not.** This is unsafe advice, never required, and never part of this MCP's setup. Telegram login codes are how attackers steal accounts — never enter them into any bot or third-party service. The only place to type your code is the `telegram-mcp login` prompt running in your own terminal.
### Daemon won't start / "another telegram-mcp daemon is running"
Check for a stale lock: `ls ~/.telegram-mcp/daemon.lock` and `lsof ~/.telegram-mcp/daemon.sock`. If no process is actually running, remove the stale socket file (`rm ~/.telegram-mcp/daemon.sock`) and retry. The lock auto-releases when the daemon exits cleanly or crashes.
### "Not configured" / "Not authorized" errors
Same root cause as the first item — run `telegram-mcp login`. "Not configured" means `~/.telegram-mcp/config.json` is missing API credentials; "Not authorized" means the credentials are there but no Telegram session exists yet.
## Tools
### Chats
| Tool | Description |
|------|-------------|
| `list_chats` | List all dialogs (groups, channels, DMs) with unread counts |
| `get_chat_info` | Details for a specific chat (members, description, type) |
| `create_group` | Create a new group |
| `create_channel` | Create a new channel |
| `archive_chat` | Archive or unarchive a chat |
| `mute_chat` | Mute or unmute notifications for a chat |
| `leave_chat` | Leave a group or channel |
| `delete_chat` | Delete a chat |
| `mark_read` | Mark a chat as read |
### Messages — Read
| Tool | Description |
|------|-------------|
| `read_messages` | Get recent messages from a chat, with time and sender filters |
| `search_messages` | Search by keyword or regex, optionally scoped to a chat |
| `get_message` | Get a single message by ID |
| `get_message_replies` | Get replies and thread for a message |
| `get_scheduled_messages` | List scheduled messages in a chat |
### Messages — Write
| Tool | Description |
|------|-------------|
| `send_message` | Send a message to a chat (supports reply-to for forum topics) |
| `edit_message` | Edit a sent message |
| `delete_message` | Delete a message |
| `forward_message` | Forward a message to another chat |
| `schedule_message` | Send a message at a future time |
| `send_reaction` | React to a message with an emoji |
### Messages — Manage
| Tool | Description |
|------|-------------|
| `pin_message` | Pin a message in a chat |
| `unpin_message` | Unpin a message |
### Media
| Tool | Description |
|------|-------------|
| `download_media` | Download a photo, video, or document from a message |
| `send_file` | Send a file or photo to a chat |
| `send_voice` | Send a voice message |
| `send_location` | Send a location |
| `get_sticker_sets` | List available sticker packs |
### Contacts
| Tool | Description |
|------|-------------|
| `list_contacts` | List all contacts |
| `get_contact` | Get contact details |
### Users
| Tool | Description |
|------|-------------|
| `get_user` | Get user profile info |
| `block_user` | Block a user |
| `unblock_user` | Unblock a user |
### Groups & Channels
| Tool | Description |
|------|-------------|
| `get_participants` | List members of a group or channel |
| `add_participant` | Add a user to a group or channel |
| `remove_participant` | Remove a user from a group or channel |
| `set_chat_title` | Change a chat's title |
| `set_chat_description` | Change a chat's description |
| `set_chat_photo` | Change a chat's photo |
| `get_invite_link` | Generate an invite link |
| `get_admin_log` | Get admin action history |
### Account & Utility
| Tool | Description |
|------|-------------|
| `get_me` | Current account info |
| `get_status` | Connection status and session health |
| `get_dialogs_stats` | Unread counts and chat activity summary |
| `export_chat` | Export messages from a chat as JSON (max 1000 per call) |
| `clear_cache` | Wipe the local message cache |
## Architecture
```
telegram-mcp/
├── src/telegram_mcp/
│ ├── __init__.py
│ ├── server.py # MCP server, tool definitions, stdio entry point
│ ├── client.py # Telethon wrapper — all Telegram API calls
│ ├── cache.py # SQLite write-through cache
│ └── login.py # Interactive login CLI
├── tests/
├── pyproject.toml
├── README.md
└── LICENSE
```
### How it works
1. **server.py** starts an MCP server on stdio, registers all tools, and handles incoming requests
2. Each tool calls methods on **client.py**, which wraps Telethon's async API into clean functions
3. **cache.py** intercepts results from client.py and writes messages to a local SQLite database. Search tools query Telegram live and merge with cached results for deeper history.
4. **login.py** is a standalone CLI that runs the interactive Telethon auth flow and saves the session file
### Data flow
```
Claude Code → MCP request → server.py → client.py → Telegram API
↓
cache.py → ~/.telegram-mcp/cache.db
```
### Storage
All data lives in `~/.telegram-mcp/`:
```
~/.telegram-mcp/
├── config.json # API ID, API hash
├── session.session # Telethon session file (auth state)
└── cache.db # SQLite message cache
```
### Cache behavior
The cache is passive and transparent:
- **Writes:** Every message returned by the Telegram API is cached automatically. No explicit sync.
- **Reads:** `read_messages` and `get_message` always fetch live from Telegram. Results are cached as a side effect.
- **SeaWhat people ask about telegram-mcp
What is jgalea/telegram-mcp?
+
jgalea/telegram-mcp is mcp servers for the Claude AI ecosystem. Telegram MCP server — give AI tools direct access to your Telegram account It has 3 GitHub stars and was last updated today.
How do I install telegram-mcp?
+
You can install telegram-mcp by cloning the repository (https://github.com/jgalea/telegram-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is jgalea/telegram-mcp safe to use?
+
jgalea/telegram-mcp has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains jgalea/telegram-mcp?
+
jgalea/telegram-mcp is maintained by jgalea. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to telegram-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy telegram-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/jgalea-telegram-mcp)<a href="https://claudewave.com/repo/jgalea-telegram-mcp"><img src="https://claudewave.com/api/badge/jgalea-telegram-mcp" alt="Featured on ClaudeWave: jgalea/telegram-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。