Repo: github.com/manupareekk/VPS_Bridge_Bot
Run Cursor CLI on your VPS from Telegram: send a message as the agent prompt, get stdout/stderr streamed back in chat (line-by-line, split under Telegram's size limit).
- Node.js 20+
- Cursor CLI installed on the VPS and authenticated the same way you already use in the terminal (
CURSOR_API_KEYor login—see Cursor docs). - A Telegram bot token (@BotFather).
git clone https://github.com/manupareekk/VPS_Bridge_Bot.git
cd VPS_Bridge_BotInstall dependencies and build (prefer npm ci on the server for a clean lockfile match; npm install is fine for local hacking):
npm ci
npm run buildCopy and edit env (see Environment and .env.example):
cp .env.example .env
nano .env # set TELEGRAM_BOT_TOKEN, ALLOWED_CHAT_IDS, AGENT_WORKDIR, CURSOR_*Before relying on the bot, SSH into the VPS and run your usual Cursor CLI command once in AGENT_WORKDIR so you know auth and flags work.
Run the bridge (keep it running with tmux/screen, or use systemd below):
npm startNetwork: long polling needs outbound HTTPS from the VPS to api.telegram.org (port 443). No inbound port is required for Telegram.
cp .env.example .env
# edit .env
npm install # or: npm ci
npm run build
npm startFor development:
npm run dev| Variable | Required | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
yes | Bot token from BotFather |
ALLOWED_CHAT_IDS |
yes | Comma-separated Telegram user IDs allowed to control the bot |
AGENT_WORKDIR |
yes | Working directory passed to spawn (cwd) |
CURSOR_BIN |
no | Default cursor |
CURSOR_ARGS_JSON |
no | JSON array of CLI args before the prompt; default ["agent"] |
MAX_TELEGRAM_CHUNK |
no | Default 3800 (Telegram max 4096) |
Your message text becomes the last argument:
cursor + CURSOR_ARGS_JSON... + your message
Match this to whatever you already run in the terminal (add flags like --force only if you understand the risk).
/start,/help— short usage/status— busy, queue length, current job id/cancel—SIGTERMon the current process tree (tree-kill)
Plain text (not starting with /) starts a job. If one is already running, new messages are queued (FIFO).
DM @userinfobot — use the Id value in ALLOWED_CHAT_IDS.
Adjust paths to match where you cloned the repo (example: /opt/VPS_Bridge_Bot).
[Unit]
Description=VPS Bridge Bot (Cursor CLI)
After=network-online.target
[Service]
Type=simple
User=YOUR_USER
WorkingDirectory=/opt/VPS_Bridge_Bot
EnvironmentFile=/opt/VPS_Bridge_Bot/.env
ExecStart=/usr/bin/node dist/index.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.targetInstall the unit (e.g. /etc/systemd/system/vps-bridge-bot.service), then:
sudo systemctl daemon-reload
sudo systemctl enable --now vps-bridge-bot
journalctl -u vps-bridge-bot -fCanonical remote:
https://github.com/manupareekk/VPS_Bridge_Bot.git
git remote add origin https://github.com/manupareekk/VPS_Bridge_Bot.git
# or: git remote set-url origin https://github.com/manupareekk/VPS_Bridge_Bot.git
git push -u origin mainSet the GitHub description (one-time):
gh repo edit manupareekk/VPS_Bridge_Bot --description "Telegram bot: send prompts to Cursor CLI on your VPS; stream agent stdout/stderr back to chat."Never commit .env (it is listed in .gitignore).
| Symptom | What to check |
|---|---|
| Bot replies Unauthorized | Your Telegram account id must be in ALLOWED_CHAT_IDS (use @userinfobot). No typos or spaces in the comma list. |
| No output or instant failure | On the VPS, run the same cursor … invocation manually in AGENT_WORKDIR. Fix CURSOR_BIN, CURSOR_ARGS_JSON, and Cursor auth (CURSOR_API_KEY / login) until that works. |
| Bot never responds / hangs | Is npm start running? Wrong or revoked TELEGRAM_BOT_TOKEN? |
| Network / polling issues | Ensure outbound TCP 443 to the internet (and not blocked by a strict firewall). The process must reach api.telegram.org. |
| Huge or empty Telegram messages | Very long lines are split; empty lines are skipped. Check raw logs on the VPS if needed. |
- Anyone with your bot token can call the Telegram API as the bot; keep
.envprivate. ALLOWED_CHAT_IDSis mandatory so random users cannot enqueue work.- The agent can modify files under
AGENT_WORKDIR; use a dedicated clone/branch if needed.
MIT