Telegram Bot MCP Server
Enables sending Telegram messages, photos, and documents, and retrieving bot information through the Telegram Bot API.
README
Telegram Bot MCP Server
An MCP server to interact with the Telegram Bot API.
📦 Installation & Setup
- Clone the repository:
git clone https://github.com/mattleads/telegramBotMcp.git cd telegramBotMcp - Install dependencies:
npm run build
Tools
telegram_getMe: Get bot info.telegram_sendMessage: Send text messages.telegram_sendPhoto: Send photos.telegram_sendDocument: Send documents.
Skills
This project includes specialized Skills to help AI agents use this MCP server more effectively.
Usage in Claude Code
-
Create the skills directory:
mkdir -p .claude/skills/ -
Link the skill folder:
ln -s "$(pwd)/skills/telegram-notifications" .claude/skills/telegram-notificationsNote: Claude Code automatically discovers skills in the
.claude/skills/directory of your project. -
Verify: Restart your Claude Code session and run
/telegram-notificationsor look for it in the available skills list.
Usage in Gemini CLI
- Link the skill:
From the project root, run:
gemini skills link skills/telegram-notifications --scope workspace - Reload skills: In your interactive Gemini CLI session, run
/skills reload. - Verify: Run
/skills list.
Available Skills
telegram-notifications: Provides guidance, examples, and common chat IDs for sending notifications.
Telegram Bot & Channel Setup
To use this server, you need a Telegram Bot and a target chat (channel or group).
1. Get a Bot Token
- Open Telegram and search for @BotFather.
- Send
/newbotand follow the instructions to name your bot. - BotFather will provide an API Token. Keep this secure; you will need it for the
TELEGRAM_BOT_TOKENenvironment variable.
2. Create a Channel & Invite the Bot
- In Telegram, create a New Channel (or Group).
- Add your bot as an Administrator.
- Go to Channel Info -> Administrators -> Add Administrator.
- Search for your bot's username and add it.
- Ensure it has the "Post Messages" permission.
3. Find the Chat ID
To send notifications, you need the numeric chat_id.
- Option A: Use the
telegram_getChattool provided by this server with your channel's@username. - Option B: Forward a message from your channel to @userinfobot or similar bots to get the ID.
- Note: Channel IDs usually start with
-100.
Usage with Claude Desktop (Local)
To use this MCP server with Claude Desktop, you need to configure the claude_desktop_config.json file.
-
Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the following configuration under the
mcpServerssection:
{
"mcpServers": {
"telegram-bot": {
"command": "node",
"args": [
"/path/to/your/telegram-bot-mcp/build/index.js"
],
"env": {
"TELEGRAM_BOT_TOKEN": "YOUR_ACTUAL_TELEGRAM_BOT_TOKEN"
}
}
}
}
Note:
- Replace
/path/to/your/telegram-bot-mcp/build/index.jswith the absolute path to thebuild/index.jsfile in this project directory. - Replace
YOUR_ACTUAL_TELEGRAM_BOT_TOKENwith the API token you received from BotFather.
- Restart Claude Desktop for the changes to take effect.
Docker Usage
You can containerize the MCP server to run it locally or deploy it.
Build the Docker Image
docker build -t telegram-bot-mcp .
Run Locally via Docker (stdio)
You can configure Claude Desktop to run the docker container via stdio. This avoids needing Node.js installed on your host system:
{
"mcpServers": {
"telegram-bot": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"TELEGRAM_BOT_TOKEN=YOUR_ACTUAL_TELEGRAM_BOT_TOKEN",
"telegram-bot-mcp"
]
}
}
}
Deployment to GCP (Cloud Run)
By default, MCP uses stdio for local environments. However, GCP Cloud Run requires an HTTP server listening on a specific port. This project automatically detects the PORT environment variable (set by Cloud Run) and switches to an HTTP SSE (Server-Sent Events) transport.
Deploy via Google Cloud CLI
- Ensure you have the
gcloudCLI installed and authenticated. - Submit the build and deploy to Cloud Run:
# Set your GCP Project ID
export PROJECT_ID="your-gcp-project-id"
# Build and deploy the container in one step
gcloud run deploy telegram-bot-mcp \
--source . \
--project $PROJECT_ID \
--region us-central1 \
--allow-unauthenticated \
--set-env-vars="TELEGRAM_BOT_TOKEN=YOUR_ACTUAL_TELEGRAM_BOT_TOKEN"
Note: Cloud Run automatically sets the PORT environment variable (usually to 8080), which tells the server to start the Express SSE server instead of the stdio server.
Connecting an MCP Client to the Cloud Run Deployment
Remote MCP servers deployed via SSE transport require a client that supports SSE (e.g., configuring Claude Desktop with a custom client implementation or another web-based MCP client).
The server exposes two endpoints:
GET /sse: Establish the Server-Sent Events connection.POST /message: Send MCP JSON-RPC messages to the server.
Usage with Gemini Code Assist
Gemini Code Assist supports MCP servers to extend its capabilities within your IDE (VS Code, IntelliJ, etc.).
Local Setup (stdio)
- Ensure the project is built:
npm run build. - Open your IDE's Gemini settings/configuration.
- Add a new MCP server:
- Type:
stdio - Command:
node - Arguments: [
"/absolute/path/to/telegram-bot-mcp/build/index.js"] - Environment Variables:
TELEGRAM_BOT_TOKEN:YOUR_ACTUAL_TELEGRAM_BOT_TOKEN
- Type:
Remote Setup (Streamable HTTP / SSE)
If you have deployed the server to Cloud Run or another host:
- Open your IDE's Gemini settings.
- Add a new MCP server:
- Type:
sse - URL:
https://your-cloud-run-url.a.run.app/mcp(or/sseif using older client)
- Type:
Usage with Gemini CLI
You can add this MCP server to your Gemini CLI globally or within a specific project.
Local Setup (stdio)
- Ensure the project is built:
npm run build. - Open your Gemini CLI configuration (
~/.gemini/settings.jsonor project-local.gemini/settings.json). - Add the server to the
mcpServersobject:
{
"mcpServers": {
"telegram-bot": {
"command": "node",
"args": ["/absolute/path/to/telegram-bot-mcp/build/index.js"],
"env": {
"TELEGRAM_BOT_TOKEN": "YOUR_ACTUAL_TELEGRAM_BOT_TOKEN"
}
}
}
}
Remote Setup (Streamable HTTP / SSE)
If you have deployed the server to Cloud Run or another host:
- Open your Gemini CLI configuration.
- Add the server:
{
"mcpServers": {
"telegram-bot": {
"url": "https://your-cloud-run-url.a.run.app/mcp"
}
}
}
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。