npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@liyu1981/mpf

v0.2.3

Published

Mosh Port Forwarding

Downloads

396

Readme

mpf: Mosh Port Forwarding

mpf is a tool designed to solve a common problem: "How can I use port forwarding with Mosh?" Inspired by VS Code's port forwarding feature, mpf acts as a lightweight wrapper for Mosh, adding persistent and dynamic TCP port forwarding. It also maintains a mobile-friendly connection for your forwarded ports.

Demo

mpf Demo

Features

  • Persistent Port Forwarding: Port forwards are saved to ~/.mpf/forwards.json and automatically restored across sessions.
  • Auto Forwarding: Automatically monitors and forwards newly opened ports.
  • Dynamic Forwarding: Add or remove port forwards on-the-fly without restarting your session.
  • Reliable Tunnel: High-performance UDP transport with great resilience (powered by QUIC) and automatic fallback to TCP.

Use & Installation

1. Via npx (Recommended)

Run mpf directly using npx without manual installation:

npx @liyu1981/mpf mosh user@hostname

2. Via Shell Script

Install mpf to ~/.local/bin using the following command:

curl -fsSL https://raw.githubusercontent.com/liyu1981/moshpf/main/install.sh | bash

3. Binary Download

Download pre-compiled binaries from the Releases page.

4. From Source (Go)

If you have Go 1.25+ installed, you can install it via:

go install github.com/liyu1981/moshpf/cmd/moshpf@latest
# The binary will be named 'moshpf'; you may want to alias it to 'mpf'

Alternatively, clone the repository and build it:

git clone https://github.com/liyu1981/moshpf.git
cd moshpf
go build -o mpf ./cmd/moshpf/main.go

Supported Platforms

mpf supports the following platforms and architectures:

  • Linux: amd64, arm64
  • macOS (Darwin): arm64

Note: only Linux with amd64 architecture is tested in real usage and others are built with golang's cross compilation. There may be issue in those platforms I do not know. If you find an issue please create an issue or a PR.

Basic Usage

Basic usage is as simple as prefixing mpf to your usual Mosh commands, as shown in the example below:

mpf mosh user@hostname -- tmux

Most of the time, this is all you will need.

Advanced Usage Options

Manage Port Forwards

On the remote side (the machine you joined via Mosh), use the forward, list, and close subcommands to manage port forwards.

Forward a port:

mpf forward 8080
# or with explicit mapping (remote:local)
mpf forward 20000:8080

Note: mpf forward 20000:8080 means the local machine listens on port 8080 and forwards to the remote port 20000.

List active forwards:

mpf list

Close a forward:

mpf close 8080

Choose QUIC or TCP Transport

mpf establishes two types of connections for the tunnel:

  1. QUIC: A high-performance UDP-based tunnel providing superior support for mobile connections.
  2. TCP: A reliable control and data tunnel established over SSH.

By default, mpf attempts to establish a QUIC connection and falls back to TCP if it fails. You can control this behavior with flags:

  • --quic: Force QUIC transport only.
  • --tcp: Force TCP transport only.

Architecture

  1. Bootstrap: mpf connects via SSH, ensures the mpf agent is present on the remote host, and starts it.
  2. Tunneling: A QUIC or Yamux session is established using the SSH-started agent's stdin/stdout.
  3. Mosh Handover: mpf executes the system mosh binary.
  4. Supervision: The mpf parent process remains running to manage the tunnel and listeners, monitoring the connection with heartbeats.
  5. Reconnection: If the tunnel drops, mpf automatically re-establishes the connection in the background.
  6. Persistence: Requested ports are stored in ~/.mpf/forwards.json and are restored whenever you reconnect to that specific user@host.

Requirements

  • mosh (client and server)
  • SSH access to the remote host (SSH keys recommended)
  • Go 1.25+ (if building from source)

License

GPLv3. See LICENSE for details.