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

Argument validation for `mcp add`: neither --command (stdio transport) nor --url (remote transport) was supplied, so the server definition has nothing to connect to. Exactly one of the two must be present.

Source

Thrown at crates/tui/src/lib.rs:8624

                        );
                    }
                }
            }
            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 0c42157ee5)

Solutions

  1. Add --command "npx -y @some/mcp-server ." for a local server, or --url https://host/sse for a remote one
  2. Check `codewhale mcp add --help` for exact flag names
  3. Quote multi-word commands as one argument

Example fix

# before
codewhale mcp add fs
# Provide either --command or --url for `mcp add`.

# after
codewhale mcp add fs --command "npx -y @modelcontextprotocol/server-filesystem $PWD"
Defensive patterns

Strategy: validation

Validate before calling

# before wrapping `codewhale mcp add` in a script:
[ -n "$SERVER_CMD" ] || [ -n "$SERVER_URL" ] || { echo 'need --command or --url'; exit 1; }

Prevention

When it happens

Trigger: `codewhale mcp add my-server` with neither --command nor --url; flags lost to shell quoting or a typo'd flag name.

Common situations: Copy/pasting multi-line examples that dropped the flag line; forgetting which field the new server needs; unquoted multi-word commands splitting into positional args.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/0a75d3c0f04f8243. Report an issue: GitHub.