Back to all blogs
Open Source

Connecting Terminals to the Web: The mconnect Story

October 15, 20256 min read
Avatar
Arya Teja Rudraraju
AI Product Manager & Engineering Lead
Connecting Terminals to the Web: The mconnect Story

I love AI coding agents. Claude Code and Cursor have completely changed how I build software. But they have one fatal flaw: they are tethered to my laptop. If I step away to grab a coffee or go for a walk, the agent stops, or worse, pauses at a confirmation prompt.

I wanted a way to check on my agents—and actually control them—from my phone. Not a VNC session (too laggy). Not SSH (too clunky on mobile). I wanted a mobile-first UI that felt like a native app.

The Problem: TTY transparency

Most web terminals are just dumb pipes. They send keystrokes and receive text. But AI agents like Claude Code use complex TUI (Text User Interface) libraries like Ink or Bubble Tea. They re-render lines, use colors, and capture specific key combos.

Sending raw text wasn't enough. I needed full PTY (Pseudo-Terminal) emulation.

The Solution: mconnect

I built LeCoder mconnect (npx lecoder-mconnect) to bridge this gap. It's an open-source tool that sits between your shell and the web.

How it works

  1. PTY Management: It spawns a node-pty process that acts as a real terminal.
  2. WebSocket Sync: It pumps xterm.js data over a specialized WebSocket protocol.
  3. Cloudflare Tunnel: It instantly creates a secure, encrypted public URL so I can access it from LTE/5G without opening router ports.

The 'Aha' Moment

The real magic happened when I added the QR code feature. You run one command on your Mac, scan the QR code with your phone, and boom—you have full control of your terminal.

I now kick off long-running migrations or test suites, walk to the gym, and approve the agent's next step from the treadmill. It feels like having a superpower.

Check out the code on GitHub.

Arya Teja Rudraraju | AI Product Manager | Building LeSearch AI