You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ Your Application
45
45
Copilot CLI (server mode)
46
46
```
47
47
48
-
The SDK manages the CLI process lifecycle automatically. You can also connect to an external CLI server—see individual SDK docs for details.
48
+
The SDK manages the CLI process lifecycle automatically. You can also connect to an external CLI server—see the [Getting Started Guide](./docs/getting-started.md#connecting-to-an-external-cli-server) for details on running the CLI in server mode.
By default, the SDK automatically manages the Copilot CLI process lifecycle—starting and stopping the CLI as needed. However, you can also run the CLI in server mode separately and have the SDK connect to it. This can be useful for:
870
+
871
+
-**Debugging**: Keep the CLI running between SDK restarts to inspect logs
872
+
-**Resource sharing**: Multiple SDK clients can connect to the same CLI server
873
+
-**Development**: Run the CLI with custom settings or in a different environment
874
+
875
+
### Running the CLI in Server Mode
876
+
877
+
Start the CLI in server mode using the `--server` flag and optionally specify a port:
878
+
879
+
```bash
880
+
copilot --server --port 4321
881
+
```
882
+
883
+
If you don't specify a port, the CLI will choose a random available port.
884
+
885
+
### Connecting the SDK to the External Server
886
+
887
+
Once the CLI is running in server mode, configure your SDK client to connect to it using the `cli_url` option:
**Note:** When `cli_url` / `cliUrl` / `CLIUrl` is provided, the SDK will not spawn or manage a CLI process—it will only connect to the existing server at the specified URL.
0 commit comments