telegram-bot-mcp
Exposes the Telegram Bot API as tools for MCP clients, enabling sending messages, photos, polls, and more via a Telegram bot.
README
telegram-bot-mcp
A Model Context Protocol (MCP) server that exposes the Telegram Bot API as tools — letting Claude and other MCP clients send messages, photos, polls and more via a Telegram bot.
Built with FastMCP (Python). No external auth proxy required — OIDC/JWT authentication is built in.
Features
- Tools:
get_me,list_chats,send_message,send_photo,send_document,send_location,send_poll,edit_message_text,delete_message,get_chat,get_chat_member_count - Three auth modes: stdio (no auth), static Bearer token, full OIDC OAuth2 proxy (e.g. Authentik, Keycloak)
- Transports: stdio (Claude Desktop) + Streamable HTTP (remote/K8s)
- Multi-arch Docker image: linux/amd64 + linux/arm64
Quick Start
stdio (Claude Desktop / local)
pip install .
export TELEGRAM_BOT_TOKEN=your_token_here
python -m telegram_bot_mcp
Add to Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"telegram": {
"command": "python",
"args": ["-m", "telegram_bot_mcp"],
"env": {
"TELEGRAM_BOT_TOKEN": "your_token_here"
}
}
}
}
Streamable HTTP (remote)
export TELEGRAM_BOT_TOKEN=your_token_here
export AUTH_TOKEN=your_secret_bearer_token # optional: require auth
python -m telegram_bot_mcp --transport streamable-http --port 8000
Connect from Claude Code:
claude mcp add telegram --transport http https://your-host:8000/mcp \
--header "Authorization: Bearer your_secret_bearer_token"
OIDC OAuth2 (production)
Full OAuth2 flow — the server acts as an OIDC proxy. Users authenticate via your identity provider (Authentik, Keycloak, Auth0, etc.) and receive a session that lasts SESSION_LIFETIME_HOURS (default: 8h).
export TELEGRAM_BOT_TOKEN=your_token_here
export OIDC_DISCOVERY_URL=https://auth.example.com/application/o/my-app/.well-known/openid-configuration
export OIDC_CLIENT_ID=your_client_id
export OIDC_CLIENT_SECRET=your_client_secret
export BASE_URL=https://telegram-bot-mcp.example.com
python -m telegram_bot_mcp --transport streamable-http --port 8000
Environment Variables
| Variable | Required | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Yes | Bot token from @BotFather |
OIDC_DISCOVERY_URL |
No* | OIDC discovery URL — enables full OAuth2 proxy mode |
OIDC_CLIENT_ID |
No* | OAuth2 client ID |
OIDC_CLIENT_SECRET |
No* | OAuth2 client secret |
BASE_URL |
No* | Public base URL of this server (required for OAuth2 redirects) |
JWT_SIGNING_KEY |
No | Stable key for signing session JWTs; random per startup if unset |
SESSION_LIFETIME_HOURS |
No | Session duration in hours (default: 8) |
AUTH_TOKEN |
No | Static Bearer token (simpler alternative to OIDC) |
KNOWN_CHATS |
No | Pre-configured chats: Name=chat_id,Name2=chat_id2 |
CHAT_STORE_PATH |
No | Path for discovered-chat cache (default: ~/.local/share/fastmcp/chats.json) |
* All four OIDC variables must be set together to enable OAuth2 mode.
Docker
docker run -p 8000:8000 \
-e TELEGRAM_BOT_TOKEN=your_token_here \
-v telegram-data:/data \
ghcr.io/your-org/telegram-bot-mcp:latest
The named volume (telegram-data:/data) persists discovered chat IDs across container restarts.
Or use Docker Compose:
cp .env.example .env # fill in your token
docker compose up -d
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。