Telegram MCP Agent
Allows AI agents to send progress updates, notifications, and approval requests to a user's Telegram chat, with interactive approval buttons and custom instructions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Telegram MCP Agent
π€ Connect your AI agents to Telegram! This MCP server allows AI assistants to send you notifications, progress updates, and request approvals directly through Telegram.
β¨ What Does This Do?
π± 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
Related MCP server: Discord Decision MCP
π Quick Setup (5 minutes)
Step 1: Create Your Telegram Bot
Open Telegram and find @BotFather
Send
/newbotand follow the instructionsSave the bot token - you'll need it!
Step 2: Get Your Chat ID
Start a chat with your new bot
Send any message to it
Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesLook for
"chat":{"id":and copy that number
Step 3: Install & Configure
# 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 IDStep 4: Test It Works
python run_tests.pySelect option 1 for a quick test. You should receive test messages in Telegram!
π§ Connect to Your AI Assistant
To use this with your AI assistant, add this configuration:
For Claude Desktop
Edit your claude_desktop_config.json file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonMac:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.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"
}
}
}
}For Claude Code
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"
}
}
}
}For Cursor
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"
}
}
}
}For VS Code (with MCP extension)
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"
}
}
}
}For Cline (VS Code Extension)
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 locationReplace
your_bot_token_hereandyour_chat_id_herewith your actual valuesAlternatively, set these as system environment variables instead of in the config
For Windows paths, use double backslashes or forward slashes
π― How Your AI Will Use This
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"
π οΈ Available Tools
Tool | Description | Timeout | Persistence |
| Send progress updates with status emojis | Instant | No |
| Ask for approval with 3 buttons + custom instructions | 30 min | Only custom instructions |
| Send notifications with priority levels | Instant | No |
| Check status of pending approval by request ID | Instant | From database |
π― Simple Approval System
When your AI requests approval, you get 3 clear options:
Approval Options:
β Approve - Standard approval, proceed with the action
β Deny - Simple denial, don't proceed
π Suggest Different Approach - Provide custom instructions for alternative method
How it Works:
β 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"
π€ Sample Agent Prompts
For Testing (Use Everything):
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.For Production (Balanced):
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!For Critical Systems (Maximum Safety):
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!
π§ͺ Testing
The project includes comprehensive tests to verify all Telegram MCP functionality. All tests are located in the tests/ directory.
Available Tests
1. Basic Feature Test (test_all_features.py)
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)
2. Interactive Approval Test (test_telegram_service.py)
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)
Testing Instructions
Before Running Tests
Ensure your bot is configured:
# Check your .env file has: TELEGRAM_BOT_TOKEN=your_bot_token TELEGRAM_CHAT_ID=your_chat_idMake sure you can receive messages:
Start a chat with your bot in Telegram
Send
/startor any message to activate the chat
During Interactive Tests
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"
Test Results
Success indicators:
[PASS]messages for each test phase[RESULT]messages showing detected actionsDatabase 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
Quick Test Runner
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
Automated Testing
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')"Test Database
Tests use the same
approval_responses.dbas productionDatabase is cleaned on each service initialization
Custom instructions are persisted between test runs
You can safely delete the
.dbfile to reset test state
π Troubleshooting
Common Issues
"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 dependenciesCheck your Python version (3.8+ required)
License
This project is open source and available under the MIT License.
Contributing
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
Support
For support, please open an issue on the project repository or contact the maintainers.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Send AI results to Telegram as private notifications or channel posts. No copy-pasting - connect your Telegram account and publish directly from AI assistants.
Give any AI agent a way to ask a person β for approval, a decision, an answer or a review.
Let AI assistants post to your Telegram chats, groups and channels. Not affiliated with Telegram.
Set up human approval for your AI agents' tool calls.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with users via Telegram to request decisions, approvals, or specific input through text and clickable buttons. This facilitates a human-in-the-loop workflow where the AI can pause for feedback or send status notifications during long-running tasks.4-
- AlicenseAqualityDmaintenanceEnables AI agents to request user decisions and send notifications via Discord when human intervention is required during autonomous tasks. It supports blocking questions with custom options, progress reporting, and persistent state for seamless remote task management.8MIT
- AlicenseBqualityDmaintenanceEnables AI agents to send notifications and media (text, photos, documents, videos) via a Telegram bot.461 npm4Do What The F*ck You Want To Public
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to send structured Telegram notifications for events like questions, plan_ready, final, attention_needed, and error.MIT