Telegram MCP
What it does
Telegram for AI agents: messages, chats, media, and contacts in bot and user-account modes.
- Connects 在你的电脑上运行
- Account or key Needs TELEGRAM_BOT_TOKEN, TELEGRAM_API_HASH
- Category 聊天与邮件
安装
选择你使用的 AI 应用,然后复制设置。
通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月13日
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
{ "mcpServers": { "better-telegram": { "command": "uvx", "args": [ "n24q02m-telegram" ], "env": { "TELEGRAM_BOT_TOKEN": "your-value", "TELEGRAM_API_ID": "your-value", "TELEGRAM_API_HASH": "your-value" } } } }只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
退出 Claude 再重新打开
试一试
用 Telegram MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 Telegram MCP,或回答中出现 Telegram MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 Telegram MCP
Telegram MCP 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 Telegram MCP 的应用
- 需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
- 需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
- 需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
B · 聊天与邮件 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Inbox Zero✓ ChatGPT
- draw.io✓ ChatGPT
- TradingMCP✓ ChatGPT
可连接 Claude Code,但需要先准备
需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
注册并创建 Telegram MCP 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
claude mcp add --scope user better-telegram --env TELEGRAM_BOT_TOKEN=your-value --env TELEGRAM_API_ID=your-value --env TELEGRAM_API_HASH=your-value -- uvx n24q02m-telegram按 Enter 前,把“your-value”改成你的密钥
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Claude Code 中输入 /mcp
应能看到 Telegram MCP 在列表中并显示已连接
试一试
用 Telegram MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 Telegram MCP,或回答中出现 Telegram MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
注册并创建 Telegram MCP 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 Telegram MCP 的设置中,TELEGRAM_BOT_TOKEN, TELEGRAM_API_ID, TELEGRAM_API_HASH 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 Telegram MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 Telegram MCP,或回答中出现 Telegram MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要 Telegram MCP 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
注册并创建 Telegram MCP 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 Telegram MCP 的设置中,TELEGRAM_BOT_TOKEN, TELEGRAM_API_ID, TELEGRAM_API_HASH 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 Telegram MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 Telegram MCP,或回答中出现 Telegram MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
claude mcp add --scope user better-telegram --env TELEGRAM_BOT_TOKEN=your-value --env TELEGRAM_API_ID=your-value --env TELEGRAM_API_HASH=your-value -- uvx n24q02m-telegramClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"better-telegram": {
"command": "uvx",
"args": [
"n24q02m-telegram"
],
"env": {
"TELEGRAM_BOT_TOKEN": "your-value",
"TELEGRAM_API_ID": "your-value",
"TELEGRAM_API_HASH": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"better-telegram": {
"command": "uvx",
"args": [
"n24q02m-telegram"
],
"env": {
"TELEGRAM_BOT_TOKEN": "your-value",
"TELEGRAM_API_ID": "your-value",
"TELEGRAM_API_HASH": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"better-telegram": {
"type": "stdio",
"command": "uvx",
"args": [
"n24q02m-telegram"
],
"env": {
"TELEGRAM_BOT_TOKEN": "your-value",
"TELEGRAM_API_ID": "your-value",
"TELEGRAM_API_HASH": "your-value"
}
}
}
}需要你填写的值
TELEGRAM_BOT_TOKEN机密 envTelegram bot token from @BotFather (for bot mode)TELEGRAM_API_IDenvTelegram API ID from my.telegram.org (for user mode)TELEGRAM_API_HASH机密 envTelegram API hash from my.telegram.org (for user mode)
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月13日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 n24q02m 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于今天
- ✓ 通过
有许可证
使用 Apache-2.0
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“聊天与邮件”中的其他服务器比较i
- 星标数多于此分类中其他 2009 个服务器的 0%
- 发布到注册中心的时间比此分类中其他 2009 个服务器的 62% 更新
- 基础检查结果等于或优于此分类中其他 2009 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
Telegram MCP 安全吗?
它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
你需要填写:TELEGRAM_BOT_TOKEN, TELEGRAM_API_HASH
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于今天,最新版本(4.23.0)于17天前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv), Docker。
有什么可以替代它?
同一分类中有:Inbox Zero, draw.io, TradingMCP
同类别的其他选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
draw.io
Create draw.io diagrams in chat from Mermaid or XML, shown live and interactive. 10,000+ shapes.
TradingMCP
Market analysis for AI assistants: screeners, multi-timeframe analysis, backtests, in-chat charts.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
telegram
mcp-name: io.github.n24q02m/better-telegram-mcp
Telegram for AI agents: messages, chats, media, and contacts in bot and user-account modes.
Sister projects from n24q02m (click to expand)
| Project | Tagline | Tag |
|---|---|---|
| agent-chat-plugin | Peer AI agents chat in a shared folder — no human relay, no orchestrator, wor... | Tooling |
| better-code-review-graph | Knowledge graph for token-efficient code reviews -- semantic search and call-... | MCP |
| better-drive | 2-way Google Drive sync with .driveignore filter — rclone engine, Windows tray | Tooling |
| better-email-mcp | IMAP/SMTP email for AI agents -- read, send, organize folders, and manage att... | MCP |
| better-godot-mcp | Composite MCP server for Godot Engine -- 17 composite tools for AI-assisted g... | MCP |
| better-notion-mcp | Markdown-first Notion for AI agents -- pages, databases, blocks, and comments... | MCP |
| better-semantic-release | Drop-in python-semantic-release fork with built-in release-safety guards (orp... | Tooling |
| better-telegram-mcp | Telegram for AI agents -- messages, chats, media, and contacts across both bo... | MCP |
| better-workspace-mcp | Google Workspace MCP server (Docs/Drive/Calendar/Gmail/Sheets/Slides/Tasks/Ch... | MCP |
| claude-plugins | Claude Code plugin marketplace for the n24q02m MCP servers -- install web sea... | Marketplace |
| imagine-mcp | Image and video understanding + generation for AI agents -- across Gemini, Op... | MCP |
| jules-task-archiver | Chrome Extension for bulk operations on Jules tasks via batchexecute API -- a... | Tooling |
| mcp-core | Shared foundation for building MCP servers -- Streamable HTTP transport, OAut... | MCP |
| mnemo-mcp | Persistent AI memory with hybrid search and embedded sync. Open, free, unlimi... | MCP |
| qwen3-embed | Lightweight Qwen3 text embedding and reranking via ONNX Runtime and GGUF | Library |
| skret | Secrets without the server. | CLI |
| tacet | A self-distilling neuro-symbolic cascade that amortises LLM cost across knowl... | Tooling |
| web-core | Shared web infrastructure package for search, scraping, HTTP security, and st... | Library |
| wet-mcp | Open-source MCP server for AI agents: web search, content extraction, and lib... | MCP |
Table of contents
- Features
- Install
- Setup
- Smithery
- Configuration
- HTTP mode
- CLI
- Tools
- Comparison
- Security
- Build from Source
- Trust Model
- License
Features
- Dual mode -- Bot API (httpx) for bots, MTProto (Telethon) for user accounts
- 6 tools with action dispatch:
message,chat,media,contact,config,help - Auto-detect mode -- Set a bot token for bot mode, or a phone number for user mode
- Local CLI auth --
telegram authhandles the bot token, or phone + OTP + 2FA, on the machine that runs the server - Stdio or HTTP -- stdio by default; HTTP with no-auth (loopback only), a single bearer token, or per-user tokens
- Tool annotations -- Each tool declares
readOnlyHint,destructiveHint,idempotentHint,openWorldHint - MCP Resources -- Documentation available as
telegram://docs/*resources - Security hardened -- SSRF protection, path traversal prevention, error sanitization, prompt-injection boundary tags on Telegram content
Install
# Claude Code plugin (stdio, bot mode)
/plugin marketplace add n24q02m/claude-plugins /plugin install better-telegram-mcp@n24q02m-plugins
Direct uvx invocation (stdio, bot mode)
claude mcp add telegram -e TELEGRAM_BOT_TOKEN=123456:ABC-DEF -- uvx n24q02m-telegram
Docker stdio
docker run -i --rm -e TELEGRAM_BOT_TOKEN=123456:ABC-DEF n24q02m/telegram
The package is n24q02m-telegram (formerly better-telegram-mcp; the old package receives one final release then freezes). The MCP Registry id stays io.github.n24q02m/better-telegram-mcp, the Docker image is n24q02m/telegram, and the legacy better-telegram-mcp command is kept as an alias of telegram. Local data moves once from ~/.better-telegram-mcp to ~/.telegram on first start.
Install matrix
| Client | Install |
|---|---|
| Claude Code | /plugin marketplace add n24q02m/claude-plugins + /plugin install better-telegram-mcp@n24q02m-plugins (stdio bot mode), or claude mcp add as in the block above |
| Cursor / Windsurf / Gemini CLI / any MCP client | mcpServers JSON in the client's config: stdio command, or type: "http" + url pointing at a server you run (see HTTP mode) |
Install with AI agent -- paste this to your AI coding agent:
Install MCP server
telegramfollowing the steps at
https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/better-telegram-mcp/setup-with-agent.md
Setup
Credentials are configured on the machine that runs the server.
Bot mode: set TELEGRAM_BOT_TOKEN in the client config, or save it once:
telegram auth --bot-token 123456:ABC-DEF
User mode: sign in interactively with your phone number. Telegram sends an OTP; a 2FA password is prompted if the account has one. The Telethon session is stored on disk.
telegram auth --phone +15551234567
Check the result with telegram status. The server reads saved credentials at startup, so restart it after telegram auth. Without any credentials the stdio server prints these instructions to stderr and exits with status 1.
Smithery
Also listed on Smithery. Per smithery.yaml, Smithery starts the server over stdio with uvx --python 3.13 n24q02m-telegram and takes no install-time configuration (empty configSchema). Credentials come from the TELEGRAM_BOT_TOKEN env var or a prior telegram auth (see Setup).
Configuration
Settings load from TELEGRAM_-prefixed environment variables (Pydantic Settings). Env vars take precedence over credentials saved by telegram auth.
| Variable | Required | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN | Bot mode | Bot token from @BotFather (format 123456789:ABCdef...) |
TELEGRAM_PHONE | User mode | Phone number in + form |
TELEGRAM_API_ID / TELEGRAM_API_HASH | No | Override the bundled public API pair |
USE_BUNDLED_TELEGRAM_CLIENT | No | Set to false to require your own API pair |
TELEGRAM_SESSION_NAME | No | Telethon session file name (default default) |
TELEGRAM_DATA_DIR | No | Session directory (default ~/.telegram) |
MCP_TRANSPORT | No | Set to http to start in HTTP mode (--http or TRANSPORT_MODE=http also work) |
There is no TELEGRAM_PASSWORD env var: telegram auth prompts for the 2FA password and never stores it in the environment.
HTTP mode
telegram --http serves MCP at /mcp and an unauthenticated GET /health. Settings live in ~/.telegram/config.toml:
[server]
host = "127.0.0.1" # default; --host overrides port = 8000 # default; --port overrides auth = "token" # "no-auth" | "token" | "multi" token_hash = "scrypt$..."
auth | Who can connect | Credentials used |
|---|---|---|
no-auth | Anyone who can reach the port; loopback binds only (a non-loopback host is refused) | The default credentials |
token | Clients sending Authorization: Bearer matching token_hash | The default credentials |
multi | Users listed in users.toml (default ~/.telegram/users.toml), each with their own token | Each user's own namespace |
Create a token hash with telegram token hash (it reads the token from stdin or a prompt, never from the command line). In multi mode, add users by editing users.toml and restarting the server:
[users.alice]
token_hash = "scrypt$..." enabled = true namespace = "alice"
Then authorize Telegram for that user on the server machine:
telegram auth --phone +15551234567 --user alice
To reach a server on another machine, put it behind a TLS-terminating reverse proxy or a private network and use token or multi auth.
CLI
The telegram console script (installed by uvx / pip; better-telegram-mcp is a legacy alias) starts the MCP server when run without a subcommand. Flags that are not a subcommand are passed through to the server (for example --http, --host, --port).
telegram # start the MCP server (stdio)
telegram --http # start in HTTP mode telegram --version # print the version
| Subcommand | Usage | Description |
|---|---|---|
auth | auth --bot-token or auth --phone <+number>, optional --user | Authorize this machine. Bot mode validates the token; phone mode runs the interactive OTP/2FA flow and stores the Telethon session on disk |
login | Same arguments as auth | Deprecated alias of auth |
logout | logout [--yes] [--user ] | Revoke the Telegram session, delete the session file and the saved credentials |
| config | config status, `config delete --ye