xai-org/grok-build · error
A URL is required for {label} servers. Usage: grok mcp add -
Error message
A URL is required for {label} servers. Usage: grok mcp add --transport {label} <name> <url> What it means
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.
Source
Thrown at crates/codegen/xai-grok-pager/src/mcp_cmd.rs:380
Ok(ResolvedAdd {
kind: McpTransport::Stdio,
transport: McpServerTransportConfig::Stdio {
command: command.to_string(),
args: server_args.clone(),
env: (!env.is_empty()).then_some(env),
cwd: None,
},
warnings,
})
}
McpTransport::Http | McpTransport::Sse => {
let label = if transport == McpTransport::Sse {
"sse"
} else {
"http"
};
let Some(url) = source else {
bail!(
"A URL is required for {label} servers. Usage: grok mcp add --transport {label} <name> <url>"
);
};
if !url.starts_with("http://") && !url.starts_with("https://") {
bail!("Invalid URL '{url}'. Server URLs must start with http:// or https://.");
}
if !server_args.is_empty() {
bail!(
"Unexpected arguments after the URL: '{}'. HTTP and SSE servers take a single URL.",
server_args.join(" ")
);
}
if !args.env.is_empty() {
bail!("--env can only be used with stdio servers.");
}
let headers = parse_headers(&args.header)?;
let mut warnings = Vec::new();View on GitHub (pinned to bc7f02eddd)
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.
Example fix
// before grok mcp add acme --transport sse // after grok mcp add acme --transport sse https://acme.example.com/mcp
Defensive patterns
Strategy: validation
Validate before calling
if transport == "http" || transport == "sse" {
assert!(!url.is_empty(), "--transport {transport} requires a <url> argument");
} Type guard
fn takes_url(transport: &str) -> bool { matches!(transport, "http" | "sse") } Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
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
- Invalid URL '{url}'. Server URLs must start with http:// or
- --header can only be used with HTTP or SSE servers.
- Unexpected arguments after the URL: '{args}'. HTTP and SSE s
- Invalid name '{name}'. Names can only contain letters, numbe
- Invalid header: '{header}'. Header name cannot be empty.
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/f3767764eb70427f.
Report an issue: GitHub.