{"record":{"id":"1c7b673c6e53903e","repo":"multica-ai/multica","slug":"update-agent-mcp-server-w","errorCode":null,"errorMessage":"update agent mcp server: %w","messagePattern":"update agent mcp server: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent_mcp.go","lineNumber":147,"sourceCode":"}\n\nfunc runAgentMcpDisable(cmd *cobra.Command, args []string) error {\n\treturn setAgentMcpEnabled(cmd, args, false)\n}\n\nfunc setAgentMcpEnabled(cmd *cobra.Command, args []string, enabled bool) error {\n\tagentID, serverID := strings.TrimSpace(args[0]), strings.TrimSpace(args[1])\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar servers []workspaceMcpServer\n\tbody := map[string]any{\"enabled\": enabled}\n\tif err := client.PutJSON(ctx, agentMcpPath(agentID, serverID, \"enabled\"), body, &servers); err != nil {\n\t\treturn fmt.Errorf(\"update agent mcp server: %w\", err)\n\t}\n\treturn printWorkspaceMcpServers(cmd, servers)\n}\n\nfunc runAgentMcpRemove(cmd *cobra.Command, args []string) error {\n\tagentID, serverID := strings.TrimSpace(args[0]), strings.TrimSpace(args[1])\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar servers []workspaceMcpServer\n\tif err := client.DeleteJSONResponse(ctx, agentMcpPath(agentID, serverID), &servers); err != nil {\n\t\treturn fmt.Errorf(\"remove agent mcp server: %w\", err)\n\t}\n\treturn printWorkspaceMcpServers(cmd, servers)","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent_mcp.go#L129-L165","documentation":"Thrown by `multica agent mcp enable|disable <agentID> <serverID>` when PUT /api/agents/{id}/mcp-servers/{serverID}/enabled with {enabled: bool} fails. The wrapped error usually means the agent-server pair does not exist (the server was never attached to this agent), or an auth/connectivity failure.","triggerScenarios":"Running enable/disable on a serverID that was never added to the agent; agent or server deleted after attachment; expired token or unreachable API.","commonSituations":"Toggling a workspace-level server ID forgetting it must first be attached per-agent; state drift between what a script assumes is attached and what the API has.","solutions":["Check current attachments: multica agent mcp list <agent-id>","Attach first if missing: multica agent mcp add <agent-id> <server-id>, then enable/disable","Fix auth/connectivity if the wrapped error indicates 401/403 or network failure"],"exampleFix":"# before\nmultica agent mcp enable <agent-id> <server-id>   # not attached\n# after\nmultica agent mcp add <agent-id> <server-id>\nmultica agent mcp enable <agent-id> <server-id>","handlingStrategy":"validation","validationCode":"multica agent mcp list \"$AGENT_ID\" --output json | jq -e --arg s \"$SERVER_ID\" 'map(.id) | index($s)' >/dev/null \\\n  || { echo \"server not attached; add it first\" >&2; exit 1; }\nmultica agent mcp enable \"$AGENT_ID\" \"$SERVER_ID\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add before enable/disable — the pair must already exist","List attachments before toggling in scripts","Treat workspace-level server IDs and per-agent attachments as distinct concepts"],"tags":["cli","api","http","mcp","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}