Hmbown/CodeWhale · error
Provide either a command or URL for MCP server '{name}'.
Error message
Provide either a command or URL for MCP server '{name}'. What it means
add_server_config (backing the 'add MCP server' flow) requires exactly one launch style: a local command (stdio) or a URL (HTTP/SSE). Passing neither would create a server entry that can never start, so it fails fast with this message before the config file is read or written.
Source
Thrown at crates/tui/src/mcp.rs:4022
format!("Failed to create MCP config directory {}", parent.display())
})?;
}
let template = mcp_template_json()?;
write_atomic(path, template.as_bytes())
.with_context(|| format!("Failed to write MCP config {}", path.display()))?;
Ok(status)
}
pub fn add_server_config(
path: &Path,
name: String,
command: Option<String>,
url: Option<String>,
args: Vec<String>,
transport: Option<String>,
) -> Result<()> {
if command.is_none() && url.is_none() {
anyhow::bail!("Provide either a command or URL for MCP server '{name}'.");
}
validate_mcp_transport(transport.as_deref())?;
let mut cfg = load_config(path)?;
cfg.servers.insert(
name,
McpServerConfig {
command,
args,
env: HashMap::new(),
cwd: None,
url,
transport,
connect_timeout: None,
execute_timeout: None,
read_timeout: None,
disabled: false,
enabled: true,
required: false,View on GitHub (pinned to 8880682c63)
Solutions
- Provide either a command (stdio server) or a URL (remote HTTP/SSE server) for the add operation
- For remote servers pass the URL plus the correct transport; for local servers pass command and args
- Fix the CLI/UI code path that collects the fields before calling add_server_config
Example fix
# before $ codewhale mcp add my-server # after $ codewhale mcp add my-server --command npx --args -y --args some-server
Defensive patterns
Strategy: validation
Validate before calling
// Validate before calling add_server_config:
anyhow::ensure!(command.is_some() || url.is_some(), "supply --command or --url for '{name}'");
add_server_config(&path, name, command, url, args, transport)?; Type guard
fn has_launch_method(command: &Option<String>, url: &Option<String>) -> bool {
command.is_some() || url.is_some()
} Prevention
- Validate the add-server form/CLI arguments client-side before submission
- Map empty strings to explicit errors at the UI boundary instead of None
- Document that exactly one of command (stdio) or url (HTTP/SSE) is required
When it happens
Trigger: Calling add_server_config with both command and url as None; a CLI add invoked without --command or --url; a form/UI submission that drops empty-string fields into None.
Common situations: Scripting the CLI and forgetting the launch flag; UI wiring that maps empty inputs to None; typos in flag names so values never reach the call.
Related errors
- MCP config path cannot be empty
- MCP config path cannot contain '..' components
- invalid environment placeholder in MCP config value
- Unsupported MCP transport '{transport}'. Supported values: s
- MCP server '{name}' config must have either 'command' or 'ur
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/9ef4ef2281118a1e.
Report an issue: GitHub.