mcpbeat Sign in

Portal Tunnel CLI Agent Skill

How the portal-tunnel client CLI (cmd/portal-tunnel) is structured and invoked — expose/agent/list/update subcommands, flags, validation rules, and x402/routing options. Use when changing or testing client-side tunnel behavior.

774 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
262
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/gosuda/portal-tunnel --skill portal-tunnel-cli

The instruction itself

6 sections, as written by the author

portal-tunnel client CLI

Entrypoint cmd/portal-tunnel/main.go. Subcommands are dispatched by the repo's own utils.RunCommands (std flag package, NOT cobra/urfave). Commands: expose, agent {run,dashboard,stop,restart}, list, update, version, help. Flags are defined in code (main.go, agent.go); --help prints usage + examples but does NOT enumerate flags — read the source for the authoritative list.

expose (main.go ~85-110)

Publishes a local service. Key flags (many have env fallbacks, shown in ENV):

  • Target: positional <target> (e.g. 3000, localhost:8080) OR --http-route "PATH=UPSTREAM[ METHOD,...:AMOUNT]" (repeatable) OR --serve <dir|file> for static.
  • Relays: --relays (extra API URLs), --discovery (default true), --max-active-relays (default 3, MAX_ACTIVE_RELAYS).
  • Multi-hop: --multi-hop (explicit ordered URLs, MULTI_HOP) OR --multi-hop-depth (default 0, MULTI_HOP_DEPTH) — mutually exclusive.
  • Identity: --identity-path (default identity.json, IDENTITY_PATH), --identity-json (IDENTITY_JSON).
  • MITM: --ban-mitm (BAN_MITM).
  • Transport: --udp/--udp-addr (UDP_ENABLED/UDP_ADDR), --tcp (TCP_ENABLED).
  • Metadata: --name --description --tags --owner --thumbnail --hide.
  • x402: --x402-pay-to, --x402-network (Sui/Casper CAIP-2), --x402-asset, --x402-testnet, --x402-endpoint (repeatable), --x402-facilitator-token (CSPR_CLOUD_API_KEY).
  • --metrics-addr. Parsed values flow into sdk.ExposeConfig (main.go ~224-281).

Validation rules (must hold; see main.go ~125-148)

  • positional target cannot combine with --http-route.
  • --serve cannot combine with target/--http-route/--udp/--tcp.
  • --http-route payment amounts require --x402-pay-to.
  • Casper networks require --x402-asset.
  • --multi-hop cannot combine with --multi-hop-depth.

Examples

portal expose 3000
portal expose localhost:8080 --name my-app
portal expose --serve ./site --name my-app
portal expose --http-route /api=http://127.0.0.1:3001 --http-route /=http://127.0.0.1:5173
portal expose 3000 --udp --udp-addr 127.0.0.1:5353
portal expose 3000 --relays https://portal.example.com --discovery=false
portal expose 3000 --multi-hop-depth 3

Other commands

  • agent run (--config default service.DefaultConfigPath(), --service, --foreground); agent dashboard/stop (--config, --state-dir); agent restart (--config). See cmd/portal-tunnel/agent.go.
  • list (--relays, --default-relays default true).
  • update (--version, empty = latest).

Defaults source

Default public relays come from embedded registry.jsontypes.BootstrapRelays; version/protocol from config.tomltypes.ReleaseVersion/SDKVersion/DiscoveryVersion (embedded via manifest.go).

How to use it

Copy the folder

Take gosuda/portal-tunnel-cli from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.