telegram-commandcode
Provides tools for sending messages, photos, files, and reading updates from Telegram, allowing AI agents to communicate via Telegram chats.
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-commandcodeSend the test results to Telegram"
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-commandcode v2
Async Python Telegram bot for Command Code CLI — Hermes Agent architecture patterns.
Control your AI coding agent from Telegram with streaming progress, persistent sessions,
and resilient message delivery. Rewritten in Python with python-telegram-bot 20.x.
Telegram
↕
┌──────────┴──────────┐
│ bot.py (gateway) │ Async Python PTB bot
│ index.js (MCP) │ Node.js MCP server (unchanged)
└──────────┬──────────┘
↕
command code CLITwo Modes
Mode | File | Language | Direction | Purpose |
Bot Daemon |
| Python | Telegram → CC | Async gateway with streaming progress |
MCP Server |
| Node.js | CC → Telegram | Agent sends messages, files, photos |
Related MCP server: Telegram MCP Server
Architecture (v2)
telegram_commandcode/
├── bot.py # PTB Application — entry point & lifecycle
├── gateway.py # Async event router — non-blocking dispatch
├── commands.py # 46+ slash command handlers
├── executor.py # Async subprocess runner for `cmd`
├── session.py # Persistent session state (JSON-backed)
├── formatter.py # MarkdownV2 escaping & safe formatting
├── chunking.py # Smart 4096-char split + file fallback
└── __init__.pyKey Architectural Patterns
Pattern | Implementation |
Decoupled Gateway | PTB message handler is thin — never blocks. Long work dispatched via |
Persistent Sessions |
|
Streaming Progress | Edit-in-place: one status message, progressively edited with stages (🤔→✅/❌). No message flooding |
Resilient Chunking |
|
Error Boundaries | Every |
Quick Install
# Clone and install
git clone https://github.com/qrak/telegram-commandcode.git
cd telegram-commandcode
pip install -e "."
# Or with voice transcription support
pip install -e ".[voice]"Requirements
Python 3.11+
python-telegram-bot[job-queue]>=20.8Command Code CLI (
cmd) installed and on PATH(Optional)
openaifor voice transcription
Setup
# 1. Get bot token from @BotFather
# 2. Set environment variables
export TELEGRAM_BOT_TOKEN="123456:ABC..."
export TELEGRAM_ALLOWED_USERS="any" # or comma-separated user IDs
# 3. Start the bot
telegram-commandcode
# or: python -m telegram_commandcode.botEnv Vars
Variable | Default | Description |
| (required) | Bot token from @BotFather |
|
| Comma-separated user IDs |
|
| Path to Command Code binary |
|
|
|
|
| Max conversation turns per prompt |
| (optional) | For voice message transcription |
systemd Service (persistent)
# ~/.config/systemd/user/telegram-commandcode.service
[Unit]
Description=Telegram Command Code Bot
After=network-online.target
[Service]
Type=simple
ExecStart=/home/user/.local/bin/telegram-commandcode
Environment="TELEGRAM_BOT_TOKEN=your_token"
Environment="COMMAND_CODE_YOLO=true"
Restart=always
RestartSec=5
[Install]
WantedBy=default.targetsystemctl --user daemon-reload
systemctl --user enable --now telegram-commandcode.serviceFeatures
Feature | Description |
👀 Reactions | 👀 while processing, ✅ on success, ❌ on error |
📷 Photo reception | Photos downloaded and passed to |
📄 File reception | Documents sent to |
🎤 Voice transcription | OpenAI Whisper (requires |
📎 Auto-send files |
|
👥 Group chat | Responds when @mentioned or replied to |
✏️ Single-message editing | Status message edited in-place — no chat clutter |
🔄 Session chaining |
|
🎯 Goal tracking |
|
🧭 Mid-session steering |
|
📋 Prompt queueing |
|
🔄 Background tasks |
|
⚙️ Config persistence | Model/provider/effort persist to |
Slash Commands
All 46+ commands from the Node.js version are implemented. Type / in Telegram to see the menu.
CLI-mapped: /feedback, /learntaste, /login, /logout, /mcp, /skills, /taste, /info, /version, /update
Config & session: /status, /model, /effort, /provider, /add-dir, /goal, /steer, /plan, /compact-mode, /configure-models, /context
Session control: /resume, /clear, /new, /fork, /rename, /undo, /retry, /queue, /background, /stop, /reload
Prompt-based: /review, /init, /memory, /pr-comments, /agents, /cmd
MCP Server (unchanged)
The Node.js MCP server (index.js) remains for Command Code → Telegram direction:
cmd mcp add telegram \
-e TELEGRAM_BOT_TOKEN=*** \
-e TELEGRAM_DEFAULT_CHAT_ID=1141080547 \
-- npx github:qrak/telegram-commandcodeLicense
MIT
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/qrak/telegram-commandcode'
If you have feedback or need assistance with the MCP directory API, please join our Discord server