xai-org/grok-build · error
Unexpected arguments after the URL: '{args}'. HTTP and SSE s
Error message
Unexpected arguments after the URL: '{args}'. HTTP and SSE servers take a single URL. What it means
HTTP and SSE MCP servers accept exactly one positional argument: the URL. If extra positional arguments remain after the URL (they were not consumed as flags), the resolver rejects the invocation because remote servers take no command or args.
Source
Thrown at crates/codegen/xai-grok-pager/src/mcp_cmd.rs:388
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();
if inferred_http {
warnings.push(format!(
"No --transport given; '{url}' starts with http(s)://, adding as an HTTP server. Use --transport sse for an SSE server, or --transport stdio to force a stdio command."
));
}
Ok(ResolvedAdd {
kind: transport,View on GitHub (pinned to bc7f02eddd)
Solutions
- Remove everything after the URL — HTTP/SSE servers take only the URL.
- Drop the `-- <command> [args...]` tail if you migrated from a stdio invocation.
- If you need command arguments, you likely want --transport stdio, not http/sse.
Example fix
// before grok mcp add acme --transport http https://acme.example.com/mcp -- npx server // after grok mcp add acme --transport http https://acme.example.com/mcp
Defensive patterns
Strategy: validation
Validate before calling
if transport_is_http_or_sse {
assert!(extra_args.is_empty(), "HTTP/SSE servers accept only a single URL argument");
} Prevention
- Strip `-- <command> [args...]` tails when switching from stdio to http/sse.
- Templates for http/sse adds should only interpolate name and URL.
When it happens
Trigger: `grok mcp add <name> --transport http <url> extra args...`; e.g. leftover stdio-style command tokens, or a `-- <command> [args...]` tail left in when switching transport to http.
Common situations: Converting a stdio server entry to http and forgetting to delete the command and its arguments; scripts parameterizing both command and URL where only one applies.
Related errors
- --header can only be used with HTTP or SSE servers.
- Invalid command '{command}': it looks like an environment va
- A URL is required for {label} servers. Usage: grok mcp add -
- Invalid URL '{url}'. Server URLs must start with http:// or
- Invalid name '{name}'. Names can only contain letters, numbe
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/a6a256b55f0b7e41.
Report an issue: GitHub.