abpframework/abp · critical · CliUsageException

Please log in with your account!

Error message

Please log in with your account!

What it means

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.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/McpCommand.cs:127

        catch (Exception ex)
        {
            _mcpLogger.Error(LogSource, "Error running MCP server", ex);
            throw;
        }
        finally
        {
            Console.CancelKeyPress -= cancelHandler;
            cts.Dispose();
        }
    }

    private async Task ValidateLicenseAsync()
    {
        var loginInfo = await _authService.GetLoginInfoAsync();

        if (string.IsNullOrEmpty(loginInfo?.Organization))
        {
            throw new CliUsageException("Please log in with your account!");
        }
        
        var licenseResult = await _apiKeyService.GetApiKeyOrNullAsync();

        if (licenseResult == null || !licenseResult.HasActiveLicense)
        {
            var errorMessage = licenseResult?.ErrorMessage ?? "No active license found.";
            throw new CliUsageException(errorMessage);
        }

        if (licenseResult.LicenseEndTime.HasValue && licenseResult.LicenseEndTime.Value < DateTime.UtcNow)
        {
            throw new CliUsageException("Your license has expired. Please renew your license to use the MCP server.");
        }
    }

    private Task PrintConfigurationAsync()
    {

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Log in first: `abp login your-email@example.com -p yourpassword`
  2. Verify your account has an organization assigned in the ABP.IO / ABP Commercial portal
  3. If login succeeds but the error persists, the account may lack organization membership — contact your ABP account administrator
  4. Re-login to refresh the session if the token may have expired

Example fix

// before
abp mcp

// after
abp login your-email@example.com -p yourpassword
abp mcp
Defensive patterns

Strategy: validation

Validate before calling

// Check login status before running MCP commands
var loginInfo = await authService.GetLoginInfoAsync();
if (string.IsNullOrEmpty(loginInfo?.Organization))
{
    Console.Error.WriteLine("Error: Not logged in or no organization. Run: abp login <email>");
    return;
}

Try / catch

try
{
    await mcpCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Please log in"))
{
    logger.LogError("Authentication required. Run: abp login <email> -p <password>");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/8dd16ee18080f9e9. Report an issue: GitHub.