OpenClawSkills
GitHub
CLI リファレンス • 5分で読める

Gateway

openclaw gateway CLI(openclaw gateway):Gateway の起動、照会、検出。

Gateway は OpenClaw の WebSocket サーバー(チャンネル、ノード、セッション、フック)です。

このページのサブコマンドは ''openclaw gateway …'' の下にあります。

関連ドキュメント:

- ''/gateway/bonjour''

- ''/gateway/discovery''

- ''/gateway/configuration''

Tutorial.step

Gateway の実行

ローカル Gateway プロセスを実行します:

Bash
openclaw gateway

フォアグラウンドエイリアス:

Bash
openclaw gateway run

Notes:

- デフォルトでは、''~/.openclaw/openclaw.json'' で ''~/.openclaw/openclaw.json'' が設定されていない限り、Gateway は起動を拒否します。一時的/開発実行には ''--allow-unconfigured'' を使用してください。

- 認証なしでループバック外へのバインドはブロックされます(安全ガードレール)。

- ''SIGUSR1'' は、認証時にプロセス内再起動をトリガーします(''commands.restart'' を有効にするか、Gateway ツール/設定の適用/更新を使用してください)。

- ''SIGINT''/''SIGTERM'' ハンドラーは Gateway プロセスを停止しますが、カスタムターミナル状態は復元しません。CLI 用の TUI または raw モード入力ラッパーを使用する場合、終了前にターミナルを復元してください。

### オプション

- ''--port <port>'': WebSocket port (default from config/env; typically ''18789'').

- ''--bind <loopback|lan|tailnet|auto|custom>'': Listener bind mode.

- ''--auth <token|password>'': Auth mode override.

- ''--token <token>'': Token override (also sets ''OPENCLAW_GATEWAY_TOKEN'' for the process).

- ''--password <password>'': Password override (also sets ''OPENCLAW_GATEWAY_PASSWORD'' for the process).

- ''--tailscale <off|serve|funnel>'': Expose gateway via Tailscale.

- ''--tailscale-reset-on-exit'':シャットダウン時に Tailscale サービス/ファンネル設定をリセット。

- ''--allow-unconfigured'':設定に ''gateway.mode=local'' がない場合でも Gateway の起動を許可。

- ''--dev'':欠落している場合、開発設定+ワークスペースを作成(BOOTSTRAP.md をスキップ)。

- ''--reset'':開発設定+資格情報+セッション+ワークスペースをリセット(''--dev'' が必要)。

- ''--force'':開始前に選択したポートの既存のリスナーを強制終了。

- ''--verbose'':詳細ログ。

- ''--claude-cli-logs'':コンソールにのみ claude-cli ログを表示(stdout/stderr も有効化)。

- ''--ws-log <auto|full|compact>'': websocket log style (default ''auto'').

Tutorial.step

実行中の Gateway の照会

すべての照会コマンドは WebSocket RPC を使用します。

出力モード:

- デフォルト:人間が読みやすい(TTY で色付き)。

- ''--json'':機械可読 JSON(スタイル/スピナーなし)。

- ''--no-color''(または ''NO_COLOR=1''):人間のレイアウトを維持しながら ANSI を無効化。

共有オプション(サポートされている場合):

- ''--url <url>'': Gateway WebSocket URL.

- ''--token <token>'': Gateway token.

- ''--password <password>'': Gateway password.

- ''--timeout <ms>'': Timeout/budget (varies per command).

#

Tutorial.step

`gateway health`

Bash
openclaw gateway health --url ws://127.0.0.1:18789

#

Tutorial.step

`gateway status`

''gateway status'' は Gateway サービス(launchd/systemd/schtasks)およびオプションの RPC プローブを表示します。

Bash
openclaw gateway status
openclaw gateway status --json

オプション:

- ''--url <url>'': Override probe URL.

- ''--token <token>'': Token auth for probe.

- ''--password <password>'': Password auth for probe.

- ''--timeout <ms>'': Probe timeout (default ''10000'').

- ''--no-probe'':RPC プローブをスキップ(サービスビューのみ)。

- ''--deep'':システムレベルサービスもスキャン。

#

Tutorial.step

`gateway probe`

''gateway probe'' は「すべてをデバッグ」コマンドです。常にプローブします:

- 設定したリモート Gateway(設定されている場合)、および

- ローカルホスト(ループバック)リモートが設定されていても。

Bash
openclaw gateway probe
openclaw gateway probe --json

##

Tutorial.step

SSH 経由のリモート(Mac アプリ同等)

macOS app "Remote via SSH" mode uses local port forwarding, so remote gateway is accessible at ''ws://127.0.0.1:<port>'' (may only bind to loopback).

CLI equivalent:

Bash
openclaw gateway probe --ssh user@gateway-host

オプション:

- ''--ssh <target>'': ''user@host'' or ''user@host:port'' (port defaults to ''22'').

- ''--ssh-identity <path>'': Identity file.

- ''--ssh-auto'':最初に発見された Gateway ホストを SSH ターゲットとして選択(LAN/WAB のみ)。

設定(オプション、デフォルトとして使用):

- ''gateway.remote.sshTarget''

- ''gateway.remote.sshIdentity''

#

Tutorial.step

`gateway call &lt;method&gt;`

低レベル RPC ヘルパー。

Bash
openclaw gateway call status
openclaw gateway call logs.tail --params '{"sinceMs": 60000}'
Tutorial.step

Gateway サービスの管理

Bash
openclaw gateway install
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway uninstall

- ''gateway install'' は ''--port''、''--runtime''、''--token''、''--force''、''--json'' をサポート。

- ライフサイクルコマンドはスクリプト作成のために ''--json'' を受け入れます。

Tutorial.step

Gateway の発見 (Bonjour)

''gateway discover'' は Gateway ビーコン(''_openclaw-gw._tcp'')をスキャンします。

- マルチキャスト DNS-SD:''local.''

- ユニキャスト DNS-SD(Wide-Area Bonjour):ドメインを選択(例:''openclaw.internal.'')し、分割 DNS + DNS サーバーを設定;''/gateway/bonjour'' を参照

Bonjour 発見が有効になっている Gateway のみがビーコンをアドバタイズします。

広域発見レコードには (TXT) が含まれます:

- ''role''(Gateway ロールのヒント)

- ''transport''(トランスポートのヒント、例 ''gateway'')

- ''gatewayPort''(WebSocket ポート、通常 ''18789'')

- ''sshPort''(SSH ポート;存在しない場合、デフォルトは ''22'')

- ''tailnetDns''(MagicDNS ホスト名、利用可能な場合)

- ''gatewayTls'' / ''gatewayTlsSha256'' (TLS 有効 + 証明書フィンガープリント)

- ''cliPath''(リモートインストールのオプショナルヒント)

##

#

Tutorial.step

`gateway discover`

Bash
openclaw gateway discover

オプション:

- ''--timeout <ms>'': Per-command timeout (browse/resolve); default ''2000''.

- ''--json'':機械可読出力(スタイル/スピナーも無効化)。

Examples:

Bash
openclaw gateway discover --timeout 4000
openclaw gateway discover --json | jq '.beacons[].wsUrl'