Hmbown/CodeWhale · error · anyhow::Error
Provide either --command or --url for `mcp add`.
Error message
Provide either --command or --url for `mcp add`.
What it means
`codewhale mcp add` requires the MCP server to be defined either as a local command (--command) or a remote URL (--url). If both are absent, the configuration would be meaningless, so the CLI bails with this validation error.
Solutions
- Add `--command <cmd> [args...]` for a stdio MCP server
- Add `--url <https://...>` for a remote (SSE) MCP server
- Re-check the intended server config and pass exactly one of the two
Example fix
// before codewhale mcp add myserver // after codewhale mcp add myserver --command npx -- some-mcp-server
Defensive patterns
Strategy: validation
Validate before calling
if command.is_none() && url.is_none() {
eprintln!("mcp add needs --command or --url");
std::process::exit(2);
} Prevention
- Treat --command or --url as required for `mcp add` in scripts and docs
- Use shell completion/help text to discover required flags
- Validate the constructed CLI args in CI scripts before invoking
When it happens
Trigger: Running `codewhale mcp add <name>` (with only a name and possibly env/scopes) without --command or --url.
Common situations: Copy-pasting an add command from docs and dropping the flags; assuming a name alone is enough; writing a script that builds the command conditionally and skips both options.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- --attempts must be an integer from 1 to 20
- --channel, --version and --reason are required
- Choose one Runtime --thread ID.
- Command is required
- Invalid pet recording segment limit.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/0a75d3c0f04f8243.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:10130
);
}
}
}
Ok(())
}
McpCommand::Add {
name,
command,
url,
transport,
bearer_token_env_var,
oauth_client_id,
oauth_resource,
scopes,
args,
} => {
if command.is_none() && url.is_none() {
bail!("Provide either --command or --url for `mcp add`.");
}
if let Some(transport) = transport.as_deref()
&& !transport.trim().eq_ignore_ascii_case("sse")
{
bail!("Unsupported MCP transport '{transport}'. Supported values: sse");
}
let added_server = McpServerConfig {
command,
args,
env: std::collections::HashMap::new(),
cwd: None,
url,
transport,
connect_timeout: None,
execute_timeout: None,
read_timeout: None,
disabled: false,
enabled: true,View on GitHub (pinned to 73e0f67d83)