{"record":{"id":"a6a256b55f0b7e41","repo":"xai-org/grok-build","slug":"unexpected-arguments-after-the-url-args-http","errorCode":null,"errorMessage":"Unexpected arguments after the URL: '{args}'. HTTP and SSE servers take a single URL.","messagePattern":"Unexpected arguments after the URL: '(.+?)'\\. HTTP and SSE servers take a single URL\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/mcp_cmd.rs","lineNumber":388,"sourceCode":"                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();\n            if inferred_http {\n                warnings.push(format!(\n                    \"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.\"\n                ));\n            }\n\n            Ok(ResolvedAdd {\n                kind: transport,","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/mcp_cmd.rs#L370-L406","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"// before\ngrok mcp add acme --transport http https://acme.example.com/mcp -- npx server\n// after\ngrok mcp add acme --transport http https://acme.example.com/mcp","handlingStrategy":"validation","validationCode":"if transport_is_http_or_sse {\n    assert!(extra_args.is_empty(), \"HTTP/SSE servers accept only a single URL argument\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip `-- <command> [args...]` tails when switching from stdio to http/sse.","Templates for http/sse adds should only interpolate name and URL."],"tags":["cli","mcp","arguments","validation"],"backgroundTag":"unexpected-positional-argument","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}