Documentation

localhostforonline is a single-binary CLI you can run via npx.

Install

npm
$ npm install -g localhostforonline

tunnel

Forward a local port to a public HTTPS URL.
tunnel
$ npx localhostforonline --port 3000
With a pinned subdomain:
tunnel
$ npx localhostforonline --port 3000 --subdomain my-app

login

Authenticate the CLI and store the API key locally.
auth
$ npx localhostforonline login

whoami

Show the currently authenticated user.
auth
$ npx localhostforonline whoami

tunnels

List tunnels from every workspace where you are an active member. Each row identifies its workspace.
tunnels
$ npx localhostforonline tunnels
Use JSON output for scripts and integrations:
tunnels
$ npx localhostforonline tunnels --json

subdomains

List subdomains from every workspace where you are an active member. Each row identifies its workspace.
subdomains
$ npx localhostforonline subdomains
Use JSON output for scripts and integrations:
subdomains
$ npx localhostforonline subdomains --json
Configure password protection:
subdomains
$ npx localhostforonline subdomains auth my-app
npx localhostforonline subdomains auth my-app --user visitor --password secret
npx localhostforonline subdomains auth my-app --off

Flags

  • --port <n> — local port to forward
  • --url <url> — forward to a full URL (e.g. http://localhost:8080)
  • --subdomain <name> — pin a permanent subdomain (requires login)
  • --host-header rewrite — rewrite Host header to localhost:<port>
  • --tcp — enable TCP forwarding
  • --dev — force dev mode (auto-detected for Vite and Next.js)
  • --keep-origin — forward Origin/Referer/Sec-Fetch-* untouched, even in dev mode
  • tunnels --json — list every accessible tunnel as JSON, including its workspace
  • subdomains --json — list every accessible subdomain as JSON, including its workspace
  • subdomains auth <name> --off — configure or disable password protection

MCP server

Let AI agents (Claude, Cursor, any MCP client) manage your workspaces, tunnels, subdomains, custom domains, and billing. Available on every plan.
server url
$ https://api.localhostfor.online/mcp
OAuth (recommended). Add the URL as a custom connector in Claude or Cursor. The client registers itself, opens a consent screen, and you pick which areas it can access. Revoke it anytime under Connected apps in the dashboard.
API key. Send your account API key as a bearer token. It grants full access, so prefer OAuth for third-party clients.
claude code
$ claude mcp add --transport http localhostfor https://api.localhostfor.online/mcp --header "Authorization: Bearer <your API key>"
  • Scopes: user, workspace, tunnels, subdomains, domains, billing — each with :read and :write. A client only sees tools its scopes allow.
  • Tools take a workspace_id; call list_workspaces first.
  • change_plan and delete_workspace return a preview until called with confirm: true.
  • Limit: 60 requests per minute per token. Access tokens last 1 hour; refresh tokens 30 days and rotate on use.
  • Every tool call is logged and visible under Connected apps.

Tools

Account user:read / user:write
  • get_me — Return the signed-in account: id, email, name and plan.
  • update_name — Change the account's display name.
Workspaces & members workspace:read / workspace:write
  • list_workspaces — List every workspace you belong to, with your role.
  • get_workspace — Return one workspace and your role in it.
  • create_workspace — Create a new workspace.
  • update_workspace — Rename a workspace or transfer ownership.
  • delete_workspace — Permanently delete a workspace (needs confirm).
  • list_members — List members, pending invitations and seat usage.
  • invite_member — Invite someone by email.
  • resend_invite — Send a pending invitation again.
  • change_member_role — Change a member's role.
  • remove_member — Remove a member or cancel an invitation.
  • get_invite — Look up an invitation by token.
  • accept_invite — Join the workspace an invitation is for.
Tunnels tunnels:read / tunnels:write
  • list_tunnels — List tunnels with status and public URL.
  • get_tunnel_logs — Recent captured requests of a tunnel.
  • replay_session — Send a captured request to the tunnel again.
  • get_tunnel_share — Return the tunnel's public share link.
  • share_tunnel — Create a public link to the tunnel's traffic.
  • unshare_tunnel — Revoke the share link.
Subdomains subdomains:read / subdomains:write
  • list_subdomains — List reserved subdomains.
  • create_subdomain — Reserve a subdomain (plan limits apply).
  • delete_subdomain — Release a subdomain.
  • get_subdomain_logs — Recent requests served on a subdomain.
  • get_subdomain_tunnels — Tunnels that have served a subdomain.
  • set_subdomain_auth — Turn password protection on or off.
Custom domains domains:read / domains:write
  • list_custom_domains — List custom domains.
  • register_custom_domain — Map your domain to a subdomain; returns the CNAME.
  • delete_custom_domain — Remove a custom domain.
Billing billing:read / billing:write
  • get_subscription — Plan, limits and subscription status.
  • create_checkout_session — Stripe Checkout link for a paid plan.
  • create_portal_session — Stripe billing portal link.
  • change_plan — Switch paid plan; charges the prorated difference (needs confirm).