{"record":{"id":"5eb5227ebacada11","repo":"multica-ai/multica","slug":"one-of-server-config-server-config-stdin-or","errorCode":null,"errorMessage":"one of --server-config, --server-config-stdin, or --server-config-file is required","messagePattern":"one of --server-config, --server-config-stdin, or --server-config-file is required","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_workspace.go","lineNumber":648,"sourceCode":"func runWorkspaceMcpAdd(cmd *cobra.Command, args []string) error {\n\tserverName := strings.TrimSpace(args[0])\n\tif serverName == \"\" {\n\t\treturn fmt.Errorf(\"server name must not be empty\")\n\t}\n\twsID, err := resolveWorkspaceArg(cmd, args[1:])\n\tif err != nil {\n\t\treturn err\n\t}\n\tif wsID == \"\" {\n\t\treturn fmt.Errorf(\"workspace ID is required: pass an id/slug/prefix as argument or set MULTICA_WORKSPACE_ID\")\n\t}\n\n\tentry, ok, err := resolveMcpJSONObject(cmd, \"server-config\", false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"one of --server-config, --server-config-stdin, or --server-config-file is required\")\n\t}\n\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar server workspaceMcpServer\n\tbody := map[string]any{\"name\": serverName, \"config\": entry}\n\tif err := client.PostJSON(ctx, \"/api/workspaces/\"+wsID+\"/mcp-servers\", body, &server); err != nil {\n\t\treturn fmt.Errorf(\"add workspace mcp server: %w\", err)\n\t}\n\n\treturn printWorkspaceMcpServers(cmd, []workspaceMcpServer{server})\n}","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_workspace.go#L630-L666","documentation":"Local validation in `multica workspace mcp add`: the MCP server entry must be supplied as a JSON object via exactly one of --server-config (inline JSON), --server-config-stdin, or --server-config-file. None of them was provided, so there is no config to register.","triggerScenarios":"Running `multica workspace mcp add name <ws>` without any --server-config* flag; passing a flag with an empty value so resolveMcpJSONObject reports ok=false.","commonSituations":"Assuming the CLI prompts for config interactively; misspelling the flag (--config instead of --server-config); quoting the JSON incorrectly so the shell swallows it; empty file passed to --server-config-file.","solutions":["Provide inline JSON: `multica workspace mcp add name acme --server-config '{\"transport\":\"stdio\",\"command\":\"npx\",...}'`","Or pipe it: `cat server.json | multica workspace mcp add name acme --server-config-stdin`","Or point at a file: `--server-config-file ./server.json`","Single-quote inline JSON in shells to prevent interpolation"],"exampleFix":"# before\nmultica workspace mcp add github acme\n\n# after\nmultica workspace mcp add github acme --server-config-file ./github-mcp.json","handlingStrategy":"validation","validationCode":"entry, ok, err := resolveMcpJSONObject(cmd, \"server-config\", false)\nif err != nil {\n    return err\n}\nif !ok {\n    return errors.New(\"one of --server-config, --server-config-stdin, or --server-config-file is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep server configs in JSON files and pass --server-config-file for reliability","Single-quote inline JSON in shells to avoid interpolation","Pre-validate JSON with `jq . file.json` before passing it"],"tags":["cli","validation","mcp","json","flags"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}