サーバー
プログラム的なアクセスのために OpenCode をヘッドレスサーバーとして実行します。
サーバーの起動
opencode serveフラグ
| フラグ | 用途 |
|---|---|
--port | サーバーポート(デフォルト:4096) |
--hostname | リッスンアドレス |
--mdns | mDNS ディスカバリを有効化 |
--cors | 追加の CORS オリジン |
設定
{
"server": {
"port": 4096,
"hostname": "0.0.0.0",
"mdns": true,
"cors": ["http://localhost:5173"]
}
}Web インターフェース
Web インターフェース付きで起動:
opencode webサーバーへの接続
実行中のサーバーに TUI を接続:
opencode attach http://localhost:4096