π€ Connect your AI agents to Telegram! This MCP server allows AI assistants to send you notifications, progress updates, and request approvals directly through Telegram.
- π± Get notified when your AI agent is working on tasks
- π€ Approve or deny actions with 3 simple buttons (no typing needed!)
- π Smart alternatives - provide custom instructions when you want a different approach
- π Track progress of long-running operations
- π Receive alerts with different priority levels
- β Stay in control of what your AI agent does
- Open Telegram and find @BotFather
- Send
/newbotand follow the instructions - Save the bot token - you'll need it!
- Start a chat with your new bot
- Send any message to it
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Look for
"chat":{"id":and copy that number
# Clone the project
git clone https://github.com/juanhuttemann/telegram-assistant-mcp.git
cd telegram-assistant-mcp
# Install dependencies
pip install -r requirements.txt
# Setup your credentials
cp .env.example .env
# Edit .env with your bot token and chat IDpython run_tests.pySelect option 1 for a quick test. You should receive test messages in Telegram!
To use this with your AI assistant, add this configuration:
Edit your claude_desktop_config.json file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"telegram-assistant": {
"command": "python",
"args": ["C:\\path\\to\\telegram-assistant-mcp\\mcp_telegram_tool.py"],
"cwd": "C:\\path\\to\\telegram-assistant-mcp",
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_CHAT_ID": "your_chat_id_here"
}
}
}
}Add to your MCP settings or use environment variables:
{
"mcpServers": {
"telegram-assistant": {
"command": "python",
"args": ["path/to/telegram-assistant-mcp/mcp_telegram_tool.py"],
"cwd": "path/to/telegram-assistant-mcp",
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_CHAT_ID": "your_chat_id_here"
}
}
}
}Add to your MCP settings in Cursor preferences:
{
"mcpServers": {
"telegram-assistant": {
"command": "python",
"args": ["path/to/telegram-assistant-mcp/mcp_telegram_tool.py"],
"cwd": "path/to/telegram-assistant-mcp",
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_CHAT_ID": "your_chat_id_here"
}
}
}
}Add to your VS Code MCP settings:
{
"mcpServers": {
"telegram-assistant": {
"command": "python",
"args": ["path/to/telegram-assistant-mcp/mcp_telegram_tool.py"],
"cwd": "path/to/telegram-assistant-mcp",
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_CHAT_ID": "your_chat_id_here"
}
}
}
}Add to your Cline MCP configuration:
{
"mcpServers": {
"telegram-assistant": {
"command": "python",
"args": ["path/to/telegram-assistant-mcp/mcp_telegram_tool.py"],
"cwd": "path/to/telegram-assistant-mcp",
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"TELEGRAM_CHAT_ID": "your_chat_id_here"
}
}
}
}π Notes:
- Replace
path/to/telegram-assistant-mcpwith your actual project location - Replace
your_bot_token_hereandyour_chat_id_herewith your actual values - Alternatively, set these as system environment variables instead of in the config
- For Windows paths, use double backslashes or forward slashes
Once connected, your AI assistant can:
-
Send you progress updates:
- "π WORKING - Installing dependencies..."
- "β SUCCESS - Tests passed!"
- "β ERROR - Build failed"
-
Request approval with simple options:
- "π€ APPROVAL REQUIRED - Delete old files?"
- Click: β Approve | β Deny | π Suggest Different Approach
- Provide custom instructions when suggesting alternatives
-
Send notifications:
- "π Task completed successfully!"
- "
β οΈ Warning: High memory usage detected"
| Tool | Description | Timeout | Persistence |
|---|---|---|---|
notify_progress |
Send progress updates with status emojis | Instant | No |
request_approval |
Ask for approval with 3 buttons + custom instructions | 30 min | Only custom instructions |
send_notification |
Send notifications with priority levels | Instant | No |
check_approval_status |
Check status of pending approval by request ID | Instant | From database |
When your AI requests approval, you get 3 clear options:
- β Approve - Standard approval, proceed with the action
- β Deny - Simple denial, don't proceed
- π Suggest Different Approach - Provide custom instructions for alternative method
- β Approve - Immediate approval, agent proceeds
- β Deny - Immediate denial, agent stops
- π Suggest Different Approach - You type custom instructions, agent receives your specific guidance
Workflow for Custom Instructions:
- Click "π Suggest Different Approach"
- System asks you to type your suggestion
- You type: "do this like that" or any specific instruction
- Agent receives: "β User denied with custom instructions: [your text]"
- Your instruction persists across tool calls until handled
Example Custom Instructions:
- "Try using a different API endpoint instead"
- "Use a safer approach with backup first"
- "Get user confirmation before proceeding"
- "Try this during off-peak hours"
You are a helpful AI assistant with Telegram integration for real-time communication and approval workflows.
TELEGRAM COMMUNICATION REQUIREMENTS:
- Send progress updates for EVERY task using notify_progress (started, in_progress, completed, error)
- Request approval via Telegram before ANY action that: creates/modifies files, installs packages, makes API calls, changes configurations, accesses external services, or could impact the system
- Send notifications for important events, warnings, completions, and status changes
- Use different priority levels (low, normal, high, urgent) based on importance
APPROVAL WORKFLOW:
- Always explain what you want to do and why approval is needed
- Wait for user response via Telegram buttons (Approve/Deny/Suggest Different Approach)
- If denied with custom instructions, follow the user's alternative approach
- Use 30-minute timeout for realistic response times
TESTING FOCUS:
Be extremely proactive with Telegram communication - use all notification types, request approvals frequently, and demonstrate the full approval workflow including custom instruction handling. This helps test the complete Telegram MCP integration.
Your goal is to be helpful while showcasing all Telegram features through natural workflow integration.
KEEP ME UPDATED VIA TELEGRAM: Send me progress updates for long tasks, ask for my approval before risky actions (like deleting files, deploying, or spending money), and notify me when important things happen. Use the Telegram tools to stay in touch!
TELEGRAM APPROVAL REQUIRED: Ask for my approval via Telegram before ANY file modification, system change, API call, or potentially impactful action. Send detailed progress updates and notify me immediately of any errors or warnings. Safety first!
Pick the style that matches your needs!
The project includes comprehensive tests to verify all Telegram MCP functionality. All tests are located in the tests/ directory.
Quick test of core functionality - suitable for development and basic verification.
What it tests:
- Progress notifications (all status types)
- Regular notifications (all priority levels)
- One approval request with 30-second timeout:
- β "Pet a cute cat" (test any button you want)
How to run:
cd telegram-assistant-mcp
python tests/test_all_features.pyExpected outcome:
- Several notification messages appear in your Telegram
- One approval request appears
- Test waits 30 seconds for you to click any button
- Test completes regardless of your response (~40 seconds total)
Comprehensive test requiring manual interaction - tests the complete approval workflow.
What it tests:
- All notification types with realistic scenarios
- Complete 3-button approval workflow:
- β Approve scenario: "Pet a cute cat"
- β Deny scenario: "Wipe entire disk permanently"
- π Suggest Different Approach: "Deploy directly to production on Friday at 5PM"
- Custom instruction workflow
- Database persistence across service instances
- Error handling
How to run:
cd telegram-assistant-mcp
python tests/test_telegram_service.pyWhat to expect:
- Automatic tests (progress + regular notifications)
- Manual interaction required - you'll see prompts like:
============================================================ WAITING FOR YOUR ACTION IN TELEGRAM: 1. Check your Telegram for the approval request 2. This is something nice - you should APPROVE it 3. Click the 'Approve' button (green checkmark) ============================================================ - Three approval scenarios - each waits 60 seconds for your response
- Database persistence verification
- Complete test takes ~5 minutes (depending on your response time)
-
Ensure your bot is configured:
# Check your .env file has: TELEGRAM_BOT_TOKEN=your_bot_token TELEGRAM_CHAT_ID=your_chat_id -
Make sure you can receive messages:
- Start a chat with your bot in Telegram
- Send
/startor any message to activate the chat
For the "Pet a cute cat" request:
- Click β Approve (this tests direct approval)
For the "Wipe entire disk permanently" request:
- Click β Deny (this tests direct denial)
For the "Deploy directly to production on Friday at 5PM" request:
- Click π Suggest Different Approach
- When prompted, type a better suggestion like:
- "Deploy to staging first, then production Monday morning"
- "Run tests before deploying"
- "Deploy during maintenance window"
Success indicators:
[PASS]messages for each test phase[RESULT]messages showing detected actions- Database persistence working message
- No
[FAIL]or[TIMEOUT]messages
Common issues:
[TIMEOUT]- You didn't respond within 60 seconds[FAIL]- Technical issue (check your bot token/chat ID)- Unicode errors - Usually harmless display issues on Windows
Use the interactive test runner for easy test selection:
cd telegram-assistant-mcp
python run_tests.pyThis gives you options to:
- Run basic test only (quick, automated)
- Run interactive test only (comprehensive, manual)
- Run all tests
- Exit
For CI/CD or automated testing, use the basic feature test:
# Quick automated test (no user interaction)
python tests/test_all_features.py
# Check if service initializes correctly
python -c "from telegram_service import TelegramService; TelegramService(); print('OK')"- Tests use the same
approval_responses.dbas production - Database is cleaned on each service initialization
- Custom instructions are persisted between test runs
- You can safely delete the
.dbfile to reset test state
-
"TELEGRAM_BOT_TOKEN environment variable is required"
- Make sure you've set the environment variable correctly
- Verify the token is valid and not expired
-
"TELEGRAM_CHAT_ID environment variable is required"
- Ensure you've set the TELEGRAM_CHAT_ID environment variable
- Make sure the chat ID is a valid integer (no quotes in the value)
-
"TELEGRAM_CHAT_ID must be a valid integer"
- The chat ID should be numeric only (e.g., 123456789)
- Remove any quotes or special characters from the chat ID
-
"Chat not found" error
- Ensure you've started a conversation with your bot
- Verify the chat ID is correct
-
Import errors
- Run
pip install -r requirements.txtto install dependencies - Check your Python version (3.8+ required)
- Run
This project is open source and available under the MIT License.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For support, please open an issue on the project repository or contact the maintainers.