{"record":{"id":"f3767764eb70427f","repo":"xai-org/grok-build","slug":"a-url-is-required-for-label-servers-usage-grok","errorCode":null,"errorMessage":"A URL is required for {label} servers. Usage: grok mcp add --transport {label} <name> <url>","messagePattern":"A URL is required for (.+?) servers\\. Usage: grok mcp add --transport (.+?) <name> <url>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/mcp_cmd.rs","lineNumber":380,"sourceCode":"            Ok(ResolvedAdd {\n                kind: McpTransport::Stdio,\n                transport: McpServerTransportConfig::Stdio {\n                    command: command.to_string(),\n                    args: server_args.clone(),\n                    env: (!env.is_empty()).then_some(env),\n                    cwd: None,\n                },\n                warnings,\n            })\n        }\n        McpTransport::Http | McpTransport::Sse => {\n            let label = if transport == McpTransport::Sse {\n                \"sse\"\n            } else {\n                \"http\"\n            };\n            let Some(url) = source else {\n                bail!(\n                    \"A URL is required for {label} servers. Usage: grok mcp add --transport {label} <name> <url>\"\n                );\n            };\n            if !url.starts_with(\"http://\") && !url.starts_with(\"https://\") {\n                bail!(\"Invalid URL '{url}'. Server URLs must start with http:// or https://.\");\n            }\n            if !server_args.is_empty() {\n                bail!(\n                    \"Unexpected arguments after the URL: '{}'. HTTP and SSE servers take a single URL.\",\n                    server_args.join(\" \")\n                );\n            }\n            if !args.env.is_empty() {\n                bail!(\"--env can only be used with stdio servers.\");\n            }\n            let headers = parse_headers(&args.header)?;\n\n            let mut warnings = Vec::new();","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/mcp_cmd.rs#L362-L398","documentation":"For `--transport http` or `--transport sse`, the resolver requires a URL as the positional source argument. If none is present after the server name, it bails with transport-specific usage text. This is an upfront argument-validation error for remote MCP servers.","triggerScenarios":"`grok mcp add <name> --transport http` (or sse) with no URL argument; e.g. only flags and the name were given, or the URL was swallowed by quoting/`--` handling.","commonSituations":"Copy-pasting a stdio-style command into an HTTP server entry, shell splitting removing an empty quoted URL, forgetting the URL when converting an existing server config to http transport.","solutions":["Append the server URL: grok mcp add <name> --transport http <url>.","Use --transport stdio (or omit it) if you intended to run a local command rather than connect to a URL.","Quote the URL if your shell or script may be splitting it."],"exampleFix":"// before\ngrok mcp add acme --transport sse\n// after\ngrok mcp add acme --transport sse https://acme.example.com/mcp","handlingStrategy":"validation","validationCode":"if transport == \"http\" || transport == \"sse\" {\n    assert!(!url.is_empty(), \"--transport {transport} requires a <url> argument\");\n}","typeGuard":"fn takes_url(transport: &str) -> bool { matches!(transport, \"http\" | \"sse\") }","tryCatchPattern":null,"preventionTips":["Supply the URL right after the server name for http/sse transports.","Check the generated command in scripts before executing.","Don't mix stdio-style positional commands with remote transports."],"tags":["cli","mcp","validation","url"],"backgroundTag":"missing-required-argument","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}