{"record":{"id":"9ef4ef2281118a1e","repo":"Hmbown/CodeWhale","slug":"provide-either-a-command-or-url-for-mcp-server-n","errorCode":null,"errorMessage":"Provide either a command or URL for MCP server '{name}'.","messagePattern":"Provide either a command or URL for MCP server '(.+?)'\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":5937,"sourceCode":"        write_atomic(path, template.as_bytes())?;\n        Ok(if original.is_some() {\n            McpWriteStatus::Overwritten\n        } else {\n            McpWriteStatus::Created\n        })\n    })\n}\n\npub fn add_server_config(\n    path: &Path,\n    name: String,\n    command: Option<String>,\n    url: Option<String>,\n    args: Vec<String>,\n    transport: Option<String>,\n) -> Result<()> {\n    if command.is_none() && url.is_none() {\n        anyhow::bail!(\"Provide either a command or URL for MCP server '{name}'.\");\n    }\n    validate_mcp_transport(transport.as_deref())?;\n    mutate_config(path, None, |cfg| {\n        cfg.servers.insert(\n            name,\n            McpServerConfig {\n                command,\n                args,\n                env: HashMap::new(),\n                cwd: None,\n                url,\n                transport,\n                connect_timeout: None,\n                execute_timeout: None,\n                read_timeout: None,\n                disabled: false,\n                enabled: true,\n                required: false,","sourceCodeStart":5919,"sourceCodeEnd":5955,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L5919-L5955","documentation":"MCP server entries must specify how to connect: either a `command` (stdio transport) or a `url` (HTTP/SSE transport). When adding a server via the config mutation API with both fields absent, the library rejects the entry with this error since the resulting server definition would be unstartable.","triggerScenarios":"Calling the add-server config function (crates/tui/src/mcp.rs:5937) with `command: None` and `url: None` — e.g. a CLI invocation like `codewhale mcp add myserver --arg x` that supplies args or transport but no command/url.","commonSituations":"Typing `mcp add name --args ...` forgetting `--command` or `--url`; generating server entries programmatically from templates where both optional fields were left empty; copying a config snippet and deleting the command line.","solutions":["Add `--command <executable>` for a stdio server, or `--url <http(s)://...>` for a remote server","If the server should be remote, set `url`; if local, set `command` (optionally with `args` and `transport`)","Fix the programmatic caller so it populates exactly one of command/url before inserting"],"exampleFix":"// before\ncodewhale mcp add docs --args serve --transport stdio\n// after\ncodewhale mcp add docs --command mkdocs --args serve --transport stdio","handlingStrategy":"validation","validationCode":"if command.is_none() && url.is_none() {\n    return Err(anyhow::anyhow!(\"MCP server '{name}' needs --command or --url\"));\n}","typeGuard":"fn has_endpoint(cmd: &Option<String>, url: &Option<String>) -> bool {\n    cmd.as_ref().map_or(false, |c| !c.trim().is_empty())\n        || url.as_ref().map_or(false, |u| !u.trim().is_empty())\n}","tryCatchPattern":null,"preventionTips":["Always pass --command (stdio) or --url (remote) with `mcp add`","Validate template-generated server entries before insertion","Never delete the command line when copying config snippets"],"tags":["mcp","validation","config","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}