{"record":{"id":"8dd16ee18080f9e9","repo":"abpframework/abp","slug":"please-log-in-with-your-account","errorCode":null,"errorMessage":"Please log in with your account!","messagePattern":"Please log in with your account!","errorType":"validation","errorClass":"CliUsageException","httpStatus":null,"severity":"critical","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/McpCommand.cs","lineNumber":127,"sourceCode":"        catch (Exception ex)\n        {\n            _mcpLogger.Error(LogSource, \"Error running MCP server\", ex);\n            throw;\n        }\n        finally\n        {\n            Console.CancelKeyPress -= cancelHandler;\n            cts.Dispose();\n        }\n    }\n\n    private async Task ValidateLicenseAsync()\n    {\n        var loginInfo = await _authService.GetLoginInfoAsync();\n\n        if (string.IsNullOrEmpty(loginInfo?.Organization))\n        {\n            throw new CliUsageException(\"Please log in with your account!\");\n        }\n        \n        var licenseResult = await _apiKeyService.GetApiKeyOrNullAsync();\n\n        if (licenseResult == null || !licenseResult.HasActiveLicense)\n        {\n            var errorMessage = licenseResult?.ErrorMessage ?? \"No active license found.\";\n            throw new CliUsageException(errorMessage);\n        }\n\n        if (licenseResult.LicenseEndTime.HasValue && licenseResult.LicenseEndTime.Value < DateTime.UtcNow)\n        {\n            throw new CliUsageException(\"Your license has expired. Please renew your license to use the MCP server.\");\n        }\n    }\n\n    private Task PrintConfigurationAsync()\n    {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/McpCommand.cs#L109-L145","documentation":"Thrown by McpCommand.ValidateLicenseAsync when _authService.GetLoginInfoAsync() returns null or a login info object with an empty/null Organization property. The MCP server feature requires an authenticated session with a valid organization. This check runs before license validation.","triggerScenarios":"User has not logged in via `abp login`, or the stored login session is expired/invalid, or the authenticated account has no organization associated. string.IsNullOrEmpty(loginInfo?.Organization) evaluates true.","commonSituations":"First-time MCP server setup without prior login, login token expired since last use, account that belongs to no organization, or the auth service cannot reach the ABP.IO authentication endpoint to validate the session.","solutions":["Log in first: `abp login your-email@example.com -p yourpassword`","Verify your account has an organization assigned in the ABP.IO / ABP Commercial portal","If login succeeds but the error persists, the account may lack organization membership — contact your ABP account administrator","Re-login to refresh the session if the token may have expired"],"exampleFix":"// before\nabp mcp\n\n// after\nabp login your-email@example.com -p yourpassword\nabp mcp","handlingStrategy":"validation","validationCode":"// Check login status before running MCP commands\nvar loginInfo = await authService.GetLoginInfoAsync();\nif (string.IsNullOrEmpty(loginInfo?.Organization))\n{\n    Console.Error.WriteLine(\"Error: Not logged in or no organization. Run: abp login <email>\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await mcpCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Please log in\"))\n{\n    logger.LogError(\"Authentication required. Run: abp login <email> -p <password>\");\n}","preventionTips":["Run `abp login` and verify it succeeds before using MCP features","Ensure your ABP account has an organization membership","Re-login if the session token may have expired between uses"],"tags":["cli","abp-cli","mcp","authentication","authorization","license"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}