Depending on your needs, there are a few possibilities:
- Announcing klipper-repl: the missing Klipper command line
- Remote API - Moonraker
- Using
socat
, refer to Question: Any way to divorce Klipper from Octo* · Issue #138 · Klipper3d/klipper · GitHub for a bit discussion on it