mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-10 22:41:14 +00:00
This PR implements the foundation for Issue #11146 - Native Telegram Bot Integration for Remote Control. Changes: - Add ApproveAsk and DenyAsk commands to IPC types - Add IPC command handlers in extension for approve/deny - Create @roo-code/telegram-bridge MCP server package - Add Telegram bot integration with approve/deny buttons - Add tests for new IPC commands The Telegram Bridge MCP Server allows users to: - Receive Roo Code messages on Telegram in real-time - Approve/reject tool operations via inline buttons - Send new instructions from Telegram - Monitor task status remotely |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
@roo-code/telegram-bridge
Telegram bridge for remote control of Roo Code. This MCP server enables you to interact with Roo Code via Telegram, allowing you to:
- Receive messages: Get real-time updates from Roo Code on your Telegram
- Approve/Reject operations: Use inline buttons to approve or deny tool operations
- Send instructions: Forward messages to Roo Code as new instructions
- Monitor task status: Track task progress remotely
Prerequisites
-
Create a Telegram Bot:
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts - Save the bot token you receive
-
Get your Chat ID:
- Start a conversation with your new bot
- Send any message to the bot
- Visit
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Find your
chat.idin the response
Installation
As an MCP Server
Add the following to your MCP settings file (~/.roo-code/settings/mcp_settings.json):
{
"mcpServers": {
"telegram-bridge": {
"command": "node",
"args": ["/path/to/roo-code/packages/telegram-bridge/build/index.js"],
"env": {
"TELEGRAM_BOT_TOKEN": "your-bot-token",
"TELEGRAM_CHAT_ID": "your-chat-id"
}
}
}
}
Build from Source
cd packages/telegram-bridge
npm install
npm run build
Usage
Once the MCP server is running, you can use the following tools:
start_bridge
Start the Telegram bridge with your credentials.
{
"botToken": "your-bot-token",
"chatId": "your-chat-id",
"socketPath": "/path/to/roo-code.sock",
"enableTts": false
}
stop_bridge
Stop the Telegram bridge.
bridge_status
Get the current status of the bridge.
send_telegram_message
Send a custom message to Telegram.
{
"message": "Hello from Roo Code!"
}
Telegram Commands
Once connected, you can use these commands in Telegram:
/startor/help- Show help message/status- Show connection status/cancel- Cancel the current task
Any other message will be forwarded to Roo Code as a new instruction.
How It Works
- The bridge connects to Roo Code via IPC (Inter-Process Communication)
- It listens for task events and messages from Roo Code
- Messages are formatted and sent to your Telegram chat
- When approval is needed, inline buttons are shown
- Button clicks and messages are sent back to Roo Code
Architecture
┌─────────────┐ IPC ┌──────────────────┐ Telegram API ┌──────────┐
│ Roo Code │◄────────────►│ Telegram Bridge │◄──────────────────►│ Telegram │
│ Extension │ │ (MCP Server) │ │ App │
└─────────────┘ └──────────────────┘ └──────────┘
Environment Variables
| Variable | Description | Required |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Your Telegram bot token | Yes |
TELEGRAM_CHAT_ID |
Your Telegram chat ID | Yes |
ROO_CODE_SOCKET_PATH |
Custom IPC socket path | No |
Security Considerations
- Keep your bot token secret - never commit it to version control
- The bridge only responds to messages from the configured chat ID
- Consider using a private chat or group for better security
- All communication between the bridge and Roo Code happens locally via IPC
Troubleshooting
Bridge not connecting
- Ensure Roo Code is running with IPC enabled
- Check the socket path is correct
- Verify your bot token is valid
Not receiving messages
- Ensure you've started a conversation with the bot
- Check the chat ID is correct
- Look for errors in the MCP server logs
Buttons not working
- Make sure the bridge is still connected
- Check for any error messages in Telegram
- Try stopping and restarting the bridge
License
Apache-2.0