{"record":{"id":"c159ed558b2f17e4","repo":"sipeed/picoclaw","slug":"s-transport-does-not-accept-command-arguments","errorCode":null,"errorMessage":"%s transport does not accept command arguments","messagePattern":"(.+?) transport does not accept command arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/mcp/add.go","lineNumber":210,"sourceCode":"\t\treturn config.MCPServerConfig{}, err\n\t}\n\n\tserver := config.MCPServerConfig{\n\t\tEnabled:  true,\n\t\tType:     transport,\n\t\tDeferred: opts.Deferred,\n\t}\n\n\tswitch transport {\n\tcase \"http\", \"sse\":\n\t\tif len(env) > 0 {\n\t\t\treturn config.MCPServerConfig{}, fmt.Errorf(\"--env can only be used with stdio transport\")\n\t\t}\n\t\tif strings.TrimSpace(opts.EnvFile) != \"\" {\n\t\t\treturn config.MCPServerConfig{}, fmt.Errorf(\"--env-file can only be used with stdio transport\")\n\t\t}\n\t\tif len(args) > 0 {\n\t\t\treturn config.MCPServerConfig{}, fmt.Errorf(\"%s transport does not accept command arguments\", transport)\n\t\t}\n\t\tparsedURL, err := url.ParseRequestURI(target)\n\t\tif err != nil || parsedURL.Scheme == \"\" || parsedURL.Host == \"\" {\n\t\t\treturn config.MCPServerConfig{}, fmt.Errorf(\"invalid MCP URL %q\", target)\n\t\t}\n\t\tserver.URL = target\n\t\tserver.Headers = headers\n\t\treturn server, nil\n\t}\n\n\tif len(headers) > 0 {\n\t\treturn config.MCPServerConfig{}, fmt.Errorf(\"--header can only be used with http or sse transport\")\n\t}\n\n\tif looksLikeRemoteURL(target) {\n\t\treturn config.MCPServerConfig{}, fmt.Errorf(\n\t\t\t\"target %q looks like a remote MCP URL, but transport is %q. Use --transport http or --transport sse\",\n\t\t\ttarget,","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/add.go#L192-L228","documentation":"http/sse servers are URL-only in buildServerConfig: after validating the URL (url.ParseRequestURI plus scheme/host checks), any leftover command arguments are rejected. Args reach this check as positionals beyond <name> <url> or as serverArgs captured once two positionals exist.","triggerScenarios":"`picoclaw mcp add name https://host/mcp extra-arg --transport http`; or flags after the URL that the parser forwards as server arguments.","commonSituations":"Pasting a stdio command line and only changing the transport to http; trying to pass an API key as a bare positional instead of -H.","solutions":["Keep the http/sse form to exactly `<name> <url>`","Pass headers with --header/-H, e.g. `-H 'X-Api-Key: key'`","If you need a command with arguments, use stdio transport (default, or -t stdio)"],"exampleFix":"# before\npicoclaw mcp add api https://example.com/mcp -t http --api-key secret\n# after\npicoclaw mcp add api https://example.com/mcp -t http -H 'X-Api-Key: secret'","handlingStrategy":"validation","validationCode":"if [ \"$TRANSPORT\" = http ] || [ \"$TRANSPORT\" = sse ]; then [ $# -eq 2 ] || { echo \"http/sse takes only <name> <url>\"; exit 2; }; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For http/sse, stop the command line after <name> <url>","Send options as -H headers, not bare arguments","Switch to stdio when the server needs a command line"],"tags":["mcp","cli","transport","usage","validation"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}