TDLib-powered Telegram MCP server for JVM/Kotlin. Full client access for AI agents.
git clone https://github.com/tolboy/telegram-mcp-tdlibResumen de MCP Servers
# Telegram MCP Server
[](LICENSE)
[](https://github.com/tolboy/telegram-mcp-tdlib/actions/workflows/ci.yml)
[](https://github.com/tolboy/telegram-mcp-tdlib/actions/workflows/security.yml)
[](https://github.com/tolboy/telegram-mcp-tdlib/releases/latest)
**Telegram MCP for real accounts — safe by default, TDLib-powered, production-ready.**
A local-first [Model Context Protocol](https://modelcontextprotocol.io/) server that gives
an AI agent real Telegram-account access without handing it the keys to your account. It
starts read-only, hides write tools until you opt in, and runs over **STDIO** for desktop
clients or **Streamable HTTP** at `/mcp` for managed deployments.
### Why this one?
- **Safe by default** — boots in read-only mode with a small `inbox`/`reader` profile;
write and quota-consuming tools are *hidden from the model*, not merely blocked, until you
turn them on.
- **Real user accounts, not just bots** — built on **TDLib** (via tdlight-java), so an agent
can read and act on your actual account, not only a Bot API subset.
- **Isolated multi-account** — each account gets its own session, mandatory selection, and
scoped API keys; reads never fan out across accounts.
- **Two transports** — STDIO for Claude Desktop / Cursor / VS Code / Codex, Streamable HTTP
for a managed service.
- **No JDK to install** — runtime-inclusive release bundles for Windows, Linux x64/ARM64, and
Apple-silicon macOS, with checksums, an SBOM, and signed container digests.

> The image is an illustrative mockup; a real screencast is on the way.
## Safe first run
Runtime-inclusive releases need no JDK, Gradle, Git, Python, or Node.js. Use a test account
for your first run if you can.
**1. Install** (macOS Apple silicon / Linux with Homebrew):
```bash
brew install --formula https://github.com/tolboy/telegram-mcp-tdlib/releases/latest/download/telegram-mcp.rb
```
Windows with Scoop:
```powershell
scoop install https://github.com/tolboy/telegram-mcp-tdlib/releases/latest/download/telegram-mcp.json
```
**2. Log in** with a QR scan — the one-time code never touches your shell history:
```bash
telegram-mcp auth --method qr
```
**3. Serve a small, read-only surface** over STDIO:
```bash
MCP_TOOL_PROFILE=inbox MCP_READ_ONLY=true telegram-mcp serve --transport stdio
```
Now point an AI client at it (below) and try a first prompt that cannot change anything:
> “Summarize my last 20 conversations. Do not send or modify anything.”
In this mode write and quota-consuming tools are absent from the tool list entirely, so the
model has nothing destructive to call. Switch to `MCP_READ_ONLY=false` only after you have
reviewed the surface; destructive actions still require confirmation by default.
## Connect your client
STDIO is the low-friction path for desktop clients. Minimal entry:
```json
{
"mcpServers": {
"telegram": {
"command": "telegram-mcp",
"args": ["serve", "--transport", "stdio"],
"env": {
"TDLIB_API_ID": "123456",
"TDLIB_API_HASH_FILE": "/absolute/path/to/telegram-api-hash",
"MCP_TOOL_PROFILE": "inbox",
"MCP_READ_ONLY": "true"
}
}
}
}
```
- **Claude Desktop** — add the block above to `claude_desktop_config.json`, then quit the app
from the tray and start it again. Use Settings → Developer → Edit Config to open the file:
it points at the right copy for your build. Editing `%APPDATA%\Claude` by hand works only
for the installer build — the Microsoft Store build is packaged as MSIX and keeps its config
in `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\` instead.
- **Cursor** — add it to `~/.cursor/mcp.json` (or Settings → MCP → Add).
- **VS Code** — use `.vscode/mcp.json`; VS Code names the top-level key `servers` instead of
`mcpServers`, otherwise the entry is identical.
For a managed HTTP deployment instead of STDIO:
```bash
docker run --rm -p 127.0.0.1:8080:8080 \
-e TDLIB_API_ID -e TDLIB_API_HASH -e MCP_API_KEY \
ghcr.io/tolboy/telegram-mcp-tdlib:latest
```
See [CLI and STDIO](docs/CLI_AND_STDIO.md), [interactive authentication](docs/INTERACTIVE_AUTH.md), and [client compatibility](docs/MCP_CLIENT_COMPATIBILITY.md) for exact platform/client variants.
## Recipes
Copy-paste configurations and prompts for real tasks, each with the smallest
tool surface that can do the job:
[summarize your inbox](docs/recipes/summarize-inbox.md),
[find a lost message](docs/recipes/find-lost-message.md),
[research public groups](docs/recipes/research-public-groups.md),
[read-only community health check](docs/recipes/community-review-readonly.md),
and [draft replies without sending](docs/recipes/safe-draft-reply.md) —
index in [docs/recipes](docs/recipes/README.md).
## How it compares
Most Telegram MCP servers wrap the Bot API or a Telethon user session and expose every
capability to the model at once. This project optimizes for connecting an agent to a **real
account you care about**, safely:
| Dimension | This server | Typical Telethon / Bot-API MCP servers |
|---|---|---|
| Account access | Real user account via TDLib (tdlight-java) | Often bot-only, or a single Telethon user session |
| Default posture | Read-only; write/quota tools **hidden** until enabled | Usually all tools exposed from the start |
| Multi-account | Isolated sessions, mandatory selection, scoped keys, **no cross-account read fan-out** | Single account, or implicit fan-out |
| Transports | STDIO **and** Streamable HTTP `/mcp` | Usually STDIO only |
| Guardrails | Confirmation gating, audit log, anti-spam limits, chat allow-list, untrusted-content marking | Minimal |
| Distribution | Signed runtime bundles (no JDK), SBOM + provenance, GHCR image | Source install via pip/npx |
A fuller architectural comparison (TDLib vs Telethon vs Bot API, and why "hidden,
not blocked" matters) is in [docs/COMPARISON.md](docs/COMPARISON.md). The detailed,
dated benchmark against the leading public servers — including features
deliberately declined (raw MTProto escape hatch, ownership transfer, bulk contact export) —
is in [PUBLIC_BENCHMARK_AND_ROADMAP.md](docs/PUBLIC_BENCHMARK_AND_ROADMAP.md).
## Tool profiles
You don't expose 110 tools on day one. `MCP_TOOL_PROFILE` narrows the advertised surface
*before a client ever sees it*, without weakening account scoping, read-only mode,
confirmation, audit, or anti-spam:
| Profile | Surface |
|---|---|
| `reader` | Always non-mutating — safe for a first look |
| `inbox` | Personal messages, drafts, media, contacts, privacy |
| `community-admin` | Moderation, group/channel, permissions, bot commands |
| `research` | Bounded account/public discovery and reading |
| `all` | The full inventory (opt in deliberately) |
See [TOOL_PROFILES.md](docs/TOOL_PROFILES.md) for the exact intent of each surface.
## Features
- **110 MCP tools** — messages, polls, read receipts, scheduled sends, chats, folders,
invite-link administration, contacts, media, drafts, privacy, bot commands, detailed group
permissions, profile, search, and account routing.
- **TDLib via tdlight-java** — real user accounts, not just the Bot API.
- **Isolated multi-account mode** — independent sessions, mandatory account selection, and
optional per-key account scopes with no cross-account read fan-out.
- **Safe by default** — read-only tool surface, confirmation mode for destructive actions,
and task-focused profiles (`reader`/`inbox`/`community-admin`/`research`/`all`).
- **Two transports** — STDIO for desktop clients and Streamable HTTP `/mcp`
(Spring AI 2.0 / MCP SDK 2.0), with API-key auth.
- **Guardrails** — audit logging, anti-spam via Resilience4j rate limiter (30 req/s) and
circuit breaker, chat allow-list, prompt-injection patterns, and untrusted-content marking.
- **Observability** — Micrometer metrics, Prometheus endpoint, and structured JSON logging
with MDC (`traceId`, `sessionId`, `toolName`).
- **Verified, runtime-inclusive releases** — Windows x64, Linux x64/ARM64, and Apple-silicon
macOS bundles with checksums, an SBOM, and signed container digests — no JDK required.
<details>
<summary>More capabilities</summary>
- **Entity resolution** — resolve `@username`, `+phone`, or numeric IDs transparently.
- **MCP behavior annotations** — every advertised tool declares read-only, destructive,
retry, and open-world hints for safer client UX.
- **Structured, marked output** — backward-compatible JSON text plus `structuredContent`;
Telegram-controlled fields are explicitly untrusted and presentation-control Unicode is
escaped.
- **Host-friendly discovery** via `/.well-known/mcp-server.json` for installers, desktop
hosts, and service managers.
- **File security service** for safe media uploads; **Actuator** health/info/metrics;
**graceful shutdown** with configurable timeout.
- **Multi-stage Docker** build + docker-compose with dev hot-reload.
- **Runtime-inclusive app images** — the supported release archives include their own Java
runtime and pass an actual STDIO handshake before publication.
- **Offline session doctor** — inspect configured TDLib state paths and lock availability
without starting TDLib or printing secrets.
- **Clean Architecture** — config / model / client / service / tool / security / util /
exception.
- **Language-neutral public search** — callers pass synonyms, translations, and spelling
variants in any language; product-specific policy interpretation stays in the MCP host.
</details>
## Tech Stack
| Component | Version |
|------------------|------------------Lo que la gente pregunta sobre telegram-mcp-tdlib
¿Qué es tolboy/telegram-mcp-tdlib?
+
tolboy/telegram-mcp-tdlib es mcp servers para el ecosistema de Claude AI. TDLib-powered Telegram MCP server for JVM/Kotlin. Full client access for AI agents. Tiene 1 estrellas en GitHub y se actualizó por última vez today.
¿Cómo se instala telegram-mcp-tdlib?
+
Puedes instalar telegram-mcp-tdlib clonando el repositorio (https://github.com/tolboy/telegram-mcp-tdlib) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar tolboy/telegram-mcp-tdlib?
+
tolboy/telegram-mcp-tdlib aún no ha sido auditado por nuestro agente de seguridad. Revisa el repositorio original en GitHub antes de usarlo en producción.
¿Quién mantiene tolboy/telegram-mcp-tdlib?
+
tolboy/telegram-mcp-tdlib es mantenido por tolboy. La última actividad registrada en GitHub es de today, con 1 issues abiertos.
¿Hay alternativas a telegram-mcp-tdlib?
+
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.
Despliega telegram-mcp-tdlib en tu cloud
Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.
¿Mantienes este repo? Añade un badge a tu README
Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.
[](https://claudewave.com/repo/tolboy-telegram-mcp-tdlib)<a href="https://claudewave.com/repo/tolboy-telegram-mcp-tdlib"><img src="https://claudewave.com/api/badge/tolboy-telegram-mcp-tdlib" alt="Featured on ClaudeWave: tolboy/telegram-mcp-tdlib" width="320" height="64" /></a>Más 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.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!