McpOAuthOptions constructor

McpOAuthOptions({
  1. required String redirectUri,
  2. String clientName = 'MCP client',
  3. String? clientIdMetadataUrl,
  4. Map<String, OAuthClientRegistration> preRegistered = const {},
  5. OAuthStore? store,
  6. Future<Uri> authorize(
    1. Uri url
    )?,
  7. String? applicationType,
  8. int maxStepUps = 2,
})

Implementation

McpOAuthOptions({
  required this.redirectUri,
  this.clientName = 'MCP client',
  this.clientIdMetadataUrl,
  this.preRegistered = const {},
  OAuthStore? store,
  this.authorize,
  this.applicationType,
  this.maxStepUps = 2,
}) : store = store ?? MemoryOAuthStore() {
  final redirect = Uri.parse(redirectUri);
  if (!(redirect.scheme == 'https' || (redirect.scheme == 'http' && _isLoopback(redirect)))) {
    throw ArgumentError.value(redirectUri, 'redirectUri', 'must be https or a localhost URL');
  }
  final cimd = clientIdMetadataUrl;
  if (cimd != null) {
    final u = Uri.parse(cimd);
    if (u.scheme != 'https' || u.path.isEmpty || u.path == '/') {
      throw ArgumentError.value(cimd, 'clientIdMetadataUrl', 'must be an https URL with a path');
    }
  }
}