fix(cli): update environment variable handling for server URL
Some checks failed
CI / build-and-test (push) Failing after -32m44s
Some checks failed
CI / build-and-test (push) Failing after -32m44s
This commit is contained in:
@@ -572,7 +572,7 @@ server: https://your-amcs-server
|
|||||||
token: your-bearer-token
|
token: your-bearer-token
|
||||||
```
|
```
|
||||||
|
|
||||||
Env vars override the config file: `AMCS_URL`, `AMCS_TOKEN`. Flags `--server` and `--token` override env vars.
|
Env vars override the config file: `AMCS_SERVER` (preferred), `AMCS_URL` (legacy alias), and `AMCS_TOKEN`. Flags `--server` and `--token` override env vars.
|
||||||
|
|
||||||
### stdio MCP client setup
|
### stdio MCP client setup
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@ With inline credentials (no config file):
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
claude mcp add --transport stdio amcs amcs-cli stdio \
|
claude mcp add --transport stdio amcs amcs-cli stdio \
|
||||||
--env AMCS_URL=https://your-amcs-server \
|
--env AMCS_SERVER=https://your-amcs-server \
|
||||||
--env AMCS_TOKEN=your-bearer-token
|
--env AMCS_TOKEN=your-bearer-token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ func loadConfig() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cfg = loaded
|
cfg = loaded
|
||||||
|
if v := strings.TrimSpace(os.Getenv("AMCS_SERVER")); v != "" {
|
||||||
|
cfg.Server = v
|
||||||
|
}
|
||||||
if v := strings.TrimSpace(os.Getenv("AMCS_URL")); v != "" {
|
if v := strings.TrimSpace(os.Getenv("AMCS_URL")); v != "" {
|
||||||
cfg.Server = v
|
cfg.Server = v
|
||||||
}
|
}
|
||||||
@@ -75,7 +78,7 @@ func loadConfig() error {
|
|||||||
|
|
||||||
func requireServer() error {
|
func requireServer() error {
|
||||||
if strings.TrimSpace(cfg.Server) == "" {
|
if strings.TrimSpace(cfg.Server) == "" {
|
||||||
return fmt.Errorf("server URL is required; set --server, AMCS_URL, or config server")
|
return fmt.Errorf("server URL is required; set --server, AMCS_SERVER, AMCS_URL, or config server")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user