Telegram Bot MCP Server
Provides tools for interacting with the Telegram Bot API, enabling sending messages and photos, managing chat members, and configuring bot settings.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Telegram Bot MCP Serversend 'Hello from AI' to chat @mygroup"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง Telegram Bot MCP Server
A powerful Model Context Protocol (MCP) server for seamless Telegram Bot API integration with intelligent message splitting, comprehensive error handling, and NPX support.
โจ Key Features
๐ 45 Tools, Rich API Coverage: Messaging, media, polls, chat administration, invite links, and bot configuration
๐ Intelligent Message Splitting: Automatically handles Telegram's 4096 character limit while preserving word boundaries and formatting
๐ผ๏ธ Full Media Support: Photos, documents, videos, audio, voice messages, animations, and stickers by file_id or URL
๐ฒ Interactive Content: Polls, quizzes, dice, locations, contacts, and chat actions (typing indicators)
โ๏ธ Message Lifecycle: Edit, delete, forward, copy, and pin messages
๐ฎ Group Administration: Ban/unban, restrict/mute, promote admins, and manage invite links
๐ก๏ธ Comprehensive Error Handling: Detailed error reporting with context, error codes, and debugging information
๐ฆ NPX Support: Run directly with
npx telegram-bot-mcp-server- no installation required๐ง Easy Integration: Simple MCP client configuration for AI assistants
Related MCP server: agent-telegram-mcp
๐ Quick Start
Option 1: NPX (Recommended)
# Run directly without installation
npx telegram-bot-mcp-serverOption 2: NPM Installation
# Install globally
npm install -g telegram-bot-mcp-server
# Or install locally
npm install telegram-bot-mcp-server๐ Prerequisites
Node.js 18+: Download here
Telegram Bot Token: Get one from @BotFather
Getting Your Bot Token
Open Telegram and search for @BotFather
Start a conversation and run:
/newbotFollow the prompts to name your bot
Copy the API token provided
๐ง MCP Client Configuration
Add this configuration to your MCP client (Claude Desktop, etc.):
{
"mcpServers": {
"telegram_bot": {
"command": "npx",
"args": ["telegram-bot-mcp-server"],
"env": {
"TELEGRAM_BOT_API_TOKEN": "your_bot_token_here"
}
}
}
}Alternative Configurations
Using global installation:
{
"mcpServers": {
"telegram_bot": {
"command": "telegram-bot-mcp-server",
"env": {
"TELEGRAM_BOT_API_TOKEN": "your_bot_token_here"
}
}
}
}Using local installation:
{
"mcpServers": {
"telegram_bot": {
"command": "node",
"args": ["./node_modules/.bin/telegram-bot-mcp-server"],
"env": {
"TELEGRAM_BOT_API_TOKEN": "your_bot_token_here"
}
}
}
}๐ ๏ธ Available Tools (45)
๐จ Messaging
Tool | Description | Inputs |
| Send a text message. Messages over 4096 characters are automatically split while preserving word boundaries |
|
| Edit the text of a message previously sent by the bot |
|
| Delete a message from a chat |
|
| Forward a message from one chat to another (keeps a link to the original) |
|
| Copy a message to another chat without a link to the original |
|
| Show a status indicator like "typingโฆ" or "sending photoโฆ" |
|
๐ผ๏ธ Media
Tool | Description | Inputs |
| Send a photo with an optional caption (long captions are split automatically) |
|
| Send a document/file (PDF, ZIP, etc., up to 50 MB) |
|
| Send an MPEG4 video |
|
| Send an audio file for the music player (.MP3/.M4A) |
|
| Send a playable voice message (.OGG/OPUS, .MP3, .M4A) |
|
| Send an animation (GIF or soundless MPEG4) |
|
| Send a static, animated, or video sticker |
|
| Get file info and a direct HTTPS download link for any file_id |
|
For all media tools, media accepts a Telegram file_id (recommended) or an HTTP URL.
๐ฒ Interactive Content
Tool | Description | Inputs |
| Send a native poll or quiz (anonymous mode, multiple answers, quiz mode with a correct answer) |
|
| Send an animated random-value emoji (๐ฒ ๐ฏ ๐ โฝ ๐ณ ๐ฐ) |
|
| Send a point on the map |
|
| Send a phone contact |
|
๐ฅ Chat & Member Management
Tool | Description | Inputs |
| Fetch full chat metadata and details |
|
| Get detailed info about a chat member |
|
| Get the total number of members in a chat |
|
| List all chat administrators with their rights |
|
| Ban a user from a group, supergroup, or channel |
|
| Unban a previously banned user |
|
| Mute or limit what a user can send in a supergroup |
|
| Promote a user to administrator (or demote them) |
|
| Get a user's profile pictures |
|
| Make the bot leave a group, supergroup, or channel |
|
๐ง Chat Settings
Tool | Description | Inputs |
| Change the title of a group or channel |
|
| Change the description of a group or channel |
|
| Pin a message (optionally silently) |
|
| Unpin a message (or the most recent pin) |
|
| Unpin all pinned messages at once |
|
๐ Invite Links
Tool | Description | Inputs |
| Create an additional invite link (with optional name, expiry, member limit) |
|
| Revoke an invite link created by the bot |
|
| Generate a new primary invite link (revokes the old one) |
|
๐ค Bot Configuration
Tool | Description | Inputs |
| Test the bot's auth token and get bot info | โ |
| Configure and retrieve the bot's name |
|
| Configure and retrieve the bot's description (shown in empty chats) |
|
| Configure and retrieve the bot's short description (profile page) |
|
| Configure and retrieve the bot's command menu |
|
๐ New Features
Rich Media Support
Documents, Video, Audio, Voice, Animations, Stickers: Send any kind of media by
file_idor URLFile Downloads: Resolve any
file_idto a direct HTTPS download link withget-file
Interactive Content
Polls & Quizzes: Native polls with anonymous mode, multiple answers, and quiz mode with a correct answer
Dice, Locations, Contacts: Fun animated emoji, map points, and phone contacts
Chat Actions: Show "typingโฆ" and other status indicators while preparing a response
Full Message Lifecycle
Edit & Delete: Update or remove messages the bot has sent
Forward & Copy: Move content between chats, with or without attribution
Pin Management: Pin, unpin, and bulk-unpin messages
Group Administration
Moderation: Ban, unban, mute/restrict, and promote members
Chat Settings: Update titles and descriptions, list administrators
Invite Links: Create, revoke, and rotate invite links with expiry and member limits
Intelligent Message Splitting
Automatic Detection: Detects when messages exceed 4096 characters
Smart Splitting: Preserves word boundaries and formatting
Sequential Delivery: Sends parts in order with part indicators
Photo Captions: Handles long photo captions by splitting across messages
Enhanced Error Handling
Detailed Errors: Includes error codes, descriptions, and context
Telegram API Errors: Captures and formats Telegram-specific errors
Network Issues: Handles connection and timeout errors
Debug Information: Comprehensive logging for troubleshooting
NPX Support
Zero Installation: Run directly with
npx telegram-bot-mcp-serverCLI Interface: Built-in help and version commands
Environment Validation: Checks for required bot token
Cross-Platform: Works on Windows, macOS, and Linux
๐ Troubleshooting
Common Issues
"No bot token" Error
โ Error: Missing Telegram Bot TokenSolution: Set the TELEGRAM_BOT_API_TOKEN environment variable:
export TELEGRAM_BOT_API_TOKEN="your_token_here"
npx telegram-bot-mcp-server"Something went wrong" Errors (Legacy)
This has been replaced with detailed error messages. Update to the latest version for better error reporting.
NPX Command Not Found
Solution: Ensure Node.js 18+ is installed:
node --version # Should be 18.0.0 or higher
npm --version # Should be included with Node.jsPermission Errors
Solution: On Unix systems, you may need to use sudo for global installation:
sudo npm install -g telegram-bot-mcp-serverDebug Mode
Set NODE_ENV=development for additional debug information:
NODE_ENV=development npx telegram-bot-mcp-server๐ Usage Examples
Basic Message Sending
// Through MCP client
await sendMessage({
chatId: "@username",
text: "Hello! This is a test message."
});Long Message Handling
// Messages over 4096 characters are automatically split
await sendMessage({
chatId: "123456789",
text: "Very long message content..." // Will be split automatically
});Photo with Long Caption
await sendPhoto({
chatId: "123456789",
media: "https://example.com/photo.jpg",
text: "Very long caption..." // Will be split if needed
});๐ค Contributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake your changes
Add tests if applicable
Commit your changes:
git commit -am 'Add feature'Push to the branch:
git push origin feature-nameSubmit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฌ Support
Issues: GitHub Issues
Telegram API Docs: Official Documentation
MCP Protocol: Model Context Protocol
โ Support the Project
If you find this project helpful, consider supporting the developer:
This server cannot be deployed
Maintenance
Related MCP Connectors
Messaging tools for AI agents: send messages, manage chats, groups and channels.
Multi-tenant Telegram gateway for AI agents โ HTTP+stdio, 8 tools, MTProto User API
Manage Telegram drafts, media, schedules and publications from AI clients.
Run a Telegram channel from your AI agent. Posts go out through your own bot, not your account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to send messages and interact with Telegram chats through MCP tools, with support for user management, conversation history, and bot command handling.1-
- AlicenseAqualityDmaintenanceEnables AI agents to send and receive messages, media, and files on Telegram, and manage chats via a bot token.17MIT
- AlicenseAqualityDmaintenanceExposes the Telegram Bot API as tools for Claude Code or any MCP client, enabling message sending, chat management, file handling, and bot information retrieval.201MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Telegram Bot API, allowing them to send messages, forward messages, get bot information, and receive updates.7 npm3MIT