Tdlib Server
БесплатноНе проверенConnects AI agents to Telegram via the official TDLib library, enabling tools like getting user info, listing dialogs, and searching messages.
Описание
Connects AI agents to Telegram via the official TDLib library, enabling tools like getting user info, listing dialogs, and searching messages.
README
Open-source MCP server that connects AI agents to Telegram via the official TDLib (Telegram Database Library).
Unlike other Telegram MCP servers (GramJS, Telethon), this uses the official C++ library via Python ctypes. Your account is treated as an official client (like Telegram Desktop) — no unofficial client flags.
Features
| Tool | Description |
|---|---|
get_me |
Get current authorized user profile |
list_dialogs |
List chats with basic info |
resolve_username |
Convert @username to chat info |
get_chat_info |
Get detailed chat/channel/group info |
list_messages |
Get messages from a chat (newest first) |
get_message |
Get a single message by ID |
search_in_chat |
Search messages in a specific chat |
search_global |
Search messages across all chats |
Quick Start
# 1. Clone
git clone https://github.com/Crocodile-beep/tdlib_mcp_server.git
cd tdlib_mcp_server
# 2. Create venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# 3. Configure API credentials
cp .env.example .env
# Edit .env with your api_id, api_hash from https://my.telegram.org/apps
# 4. First-time auth
python test_auth.py
# Enter the code sent to Telegram
# 5. Run MCP server
python main.py
MCP Client Configuration
Add to your opencode.jsonc:
{
"mcp": {
"tdlib": {
"type": "local",
"command": ["./venv/bin/python", "-u", "./main.py"],
"enabled": true
}
}
}
For other MCP clients (Claude Desktop, etc.), point them to python /path/to/tdlib-mcp-server/main.py.
Architecture
┌──────────────┐ queue.Queue ┌──────────────────┐
│ asyncio │ ──────────────────>│ TDLib Thread │
│ MCP Server │ │ libtdjson.so │
│ (main.py) │ <──────────────────│ (tdlib_client) │
│ │ asyncio.Future │ │
└──────────────┘ └──────────────────┘
- Python 3.14 — MCP stdio transport via
mcpSDK - TDLib 1.8.57 — compiled
libtdjson.soinlib/ - ctypes — direct C function calls, no bindings
- SQLite — session data stored in
data/tdlib/(managed by TDLib)
Roadmap
list_messages_date_range— filter messages by date- Error handling — FLOOD_WAIT retry, reconnection
- More tools as needed
License
MIT — fully open source, use it freely.
Установка Tdlib Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/Crocodile-beep/tdlib_mcp_serverFAQ
Tdlib Server MCP бесплатный?
Да, Tdlib Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Tdlib Server?
Нет, Tdlib Server работает без API-ключей и переменных окружения.
Tdlib Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Tdlib Server в Claude Desktop, Claude Code или Cursor?
Открой Tdlib Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Gmail
Read, send and search emails from Claude
автор: GoogleSlack
Send, search and summarize Slack messages
автор: SlackRunbear
No-code MCP client for team chat platforms, such as Slack, Microsoft Teams, and Discord.
Discord Server
A community discord server dedicated to MCP by [Frank Fiegel](https://github.com/punkpeye)
Compare Tdlib Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории communication
