Telegram MCP Server
Allows AI assistants to send messages to Telegram users via a Telegram bot, supporting chat IDs and usernames, with optional default user configuration.
Click on "Install 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 MCP Serversend a message to the team: Deployment completed successfully"
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 MCP Server
⚠️ Disclaimer: This project contains AI-generated code that has not been thoroughly tested. Use at your own risk and verify all functionality before production deployment.
A Model Context Protocol (MCP) server that enables AI assistants to send messages to Telegram users. Features a web-based configuration interface and supports both chat IDs and usernames.
Features
MCP Tool:
send_telegram_messagetool for AI assistantsDefault User Support: Send messages to a configured default user when no recipient is specified
Web Interface: Easy configuration and testing via web browser
Flexible Recipients: Support for both Telegram chat IDs and usernames
Real-time Status: Live status monitoring of server and bot configuration
Related MCP server: Telegram Bot MCP
Prerequisites
Node.js 18 or higher
A Telegram bot token from @BotFather
Quick Start
1. Create a Telegram Bot
Open Telegram and search for @BotFather
Start a chat and send the command
/newbotFollow the prompts to:
Choose a name for your bot
Choose a username for your bot (must end with
bot)
Copy the API token provided by BotFather
2. Install and Configure
# Clone or download this repository
git clone <repository-url>
cd telegram-mcp-server
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env file with your bot token
# TELEGRAM_BOT_TOKEN=your_bot_token_here3. Start the Server
# Start the server
npm startThe web interface will be available at http://localhost:3000
4. Configure via Web Interface
Open
http://localhost:3000in your browserEnter your bot token in the configuration section
Optionally set a default user (chat ID or username)
Click "Save Configuration"
5. Test the Bot
In the web interface, go to the "Test Message Sending" section
Enter a test message
Optionally specify a recipient (leave empty to test default user)
Click "Send Test Message"
Configuration
Primary Configuration: MCP Servers GUI (Recommended)
Configuration should be managed through Cursor's MCP Servers settings:
Open Cursor Settings (
Ctrl+,orCmd+,)Search for "MCP" or navigate to MCP Servers settings
Add or edit the
telegramserver configurationSet environment variables:
TELEGRAM_BOT_TOKEN(required): Your bot token from @BotFatherTELEGRAM_DEFAULT_USER(optional): Default chat ID or username for messages
Configuration Priority:
Primary: Environment variables from MCP Server configuration (Cursor GUI) - used at startup
Secondary: Runtime updates via web interface API - for testing/debugging only
Stored Values as Defaults:
When tool calls don't provide
chatIdorusername, the storedTELEGRAM_DEFAULT_USERis used automaticallyIf
TELEGRAM_DEFAULT_USERis not configured and no recipient is provided, an error is returned
Web Interface Configuration (Testing/Debugging)
The web interface (http://localhost:3000) allows runtime configuration changes for testing:
Bot Token: Enter your Telegram bot token (runtime only)
Default User: Set a fallback recipient when no user is specified in messages
Use chat ID (numeric) for reliability
Username can be used but requires the user to have started your bot
⚠️ Note: Web interface configuration is temporary and for testing purposes. For persistent configuration, use Cursor's MCP Servers GUI.
Legacy: Environment Variables File
For standalone usage (not via MCP), you can create a .env file:
# Required: Your bot token from BotFather
TELEGRAM_BOT_TOKEN=your_bot_token_here
# Optional: Default user for messages (chat ID or username)
TELEGRAM_DEFAULT_USER=123456789
# Optional: Web interface port (default: 3000)
WEB_PORT=3000Usage with MCP Clients
Connecting to Cursor
Build the project:
npm run buildConfigure in Cursor's MCP Servers GUI:
Open Cursor Settings (
Ctrl+,orCmd+,)Search for "MCP Servers" or navigate to MCP settings
Add a new server or edit existing:
Name:
telegramCommand:
nodeArguments:
C:\AppDev\Projects\MsgMCP\dist\index.js(use your full path)Environment Variables:
TELEGRAM_BOT_TOKEN: Your bot token from @BotFatherTELEGRAM_DEFAULT_USER: (Optional) Default chat ID or username
Restart Cursor for changes to take effect
Cursor AI Notification Rule
Purpose: Ensure the user is promptly notified whenever user intervention is required.
Triggers:
Completion of the process with a success message
Any unexpected halts or issues in the process
When Cursor AI requires user input or has questions
Action: Utilize send_telegram_message tool to send a detailed Telegram message to the user.
Connecting to Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"telegram": {
"command": "node",
"args": ["/path/to/telegram-mcp-server/dist/index.js"],
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_DEFAULT_USER": "your_default_user"
}
}
}
}Using the Tool
The server provides one MCP tool: send_telegram_message
Parameters
message(required): The text message to send to the default user
Examples
Send to default user:
Send a message saying "Hello from AI!"The tool automatically sends to the TELEGRAM_DEFAULT_USER configured in the .env file. No recipient specification needed!
Simple usage:
Tell the user that the task is completeNotify that the server is runningAPI Endpoints
The server exposes a REST API for configuration and testing:
GET /api/status
Get server and bot status information.
Response:
{
"server": "running",
"bot": "initialized",
"config": {
"hasToken": true,
"hasDefaultUser": true
}
}GET /api/config
Get current configuration (masked for security).
Response:
{
"telegramBotToken": "configured",
"telegramDefaultUser": "123456789",
"webPort": 3000
}POST /api/config
Update configuration.
Request:
{
"telegramBotToken": "new_token_here",
"telegramDefaultUser": "new_default_user"
}POST /api/test
Send a test message.
Request:
{
"message": "Test message",
"chatId": "123456789",
"username": "@testuser"
}Development
Build
npm run buildDevelopment Mode
npm run devRun Web Interface Only
npm run webTroubleshooting
Bot Not Sending Messages
Check Bot Token: Ensure your bot token is correct and the bot is not revoked
User Interaction: For username-based sending, the user must have started your bot first
Chat ID vs Username: Use chat IDs for more reliable message delivery
Web Interface Not Loading
Port Conflict: Check if port 3000 is available
Firewall: Ensure the port is not blocked by firewall
Environment: Verify Node.js version and dependencies
MCP Connection Issues
Path: Ensure the path to
dist/index.jsis correct in your MCP client configEnvironment Variables: Make sure required environment variables are set
Build: Ensure the project is built (
npm run build) before connecting
Security Considerations
Store bot tokens securely and never commit them to version control
The web interface is intended for local configuration only
Consider additional authentication for production deployments
Bot tokens have full access to your bot - keep them confidential
License
Contributing
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Submit a pull request
Support
For issues and questions:
Check the troubleshooting section above
Review the Telegram Bot API documentation
Check MCP documentation for client integration
Changelog
v1.0.0
Initial release
MCP server with Telegram messaging tool
Web-based configuration interface
Support for chat IDs and usernames
Default user fallback functionality
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bonzhigh/MsgMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server