Class: MCPClient::Auth::ClientMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/mcp_client/auth.rb

Overview

OAuth client metadata for registration and authorization

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redirect_uris:, token_endpoint_auth_method: 'none', grant_types: %w[authorization_code refresh_token],, response_types: ['code'], scope: nil, client_name: nil, client_uri: nil, logo_uri: nil, tos_uri: nil, policy_uri: nil, contacts: nil) ⇒ ClientMetadata

rubocop:disable Metrics/ParameterLists

Parameters:

  • redirect_uris (Array<String>)

    List of valid redirect URIs

  • token_endpoint_auth_method (String) (defaults to: 'none')

    Authentication method for token endpoint

  • grant_types (Array<String>) (defaults to: %w[authorization_code refresh_token],)

    Supported grant types

  • response_types (Array<String>) (defaults to: ['code'])

    Supported response types

  • scope (String, nil) (defaults to: nil)

    Requested scope

  • client_name (String, nil) (defaults to: nil)

    Human-readable client name

  • client_uri (String, nil) (defaults to: nil)

    URL of the client home page

  • logo_uri (String, nil) (defaults to: nil)

    URL of the client logo

  • tos_uri (String, nil) (defaults to: nil)

    URL of the client terms of service

  • policy_uri (String, nil) (defaults to: nil)

    URL of the client privacy policy

  • contacts (Array<String>, nil) (defaults to: nil)

    List of contact emails for the client



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/mcp_client/auth.rb', line 104

def initialize(redirect_uris:, token_endpoint_auth_method: 'none',
               grant_types: %w[authorization_code refresh_token],
               response_types: ['code'], scope: nil,
               client_name: nil, client_uri: nil, logo_uri: nil,
               tos_uri: nil, policy_uri: nil, contacts: nil)
  # rubocop:enable Metrics/ParameterLists
  @redirect_uris = redirect_uris
  @token_endpoint_auth_method = token_endpoint_auth_method
  @grant_types = grant_types
  @response_types = response_types
  @scope = scope
  @client_name = client_name
  @client_uri = client_uri
  @logo_uri = logo_uri
  @tos_uri = tos_uri
  @policy_uri = policy_uri
  @contacts = contacts
end

Instance Attribute Details

#client_nameObject (readonly)

Returns the value of attribute client_name.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def client_name
  @client_name
end

#client_uriObject (readonly)

Returns the value of attribute client_uri.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def client_uri
  @client_uri
end

#contactsObject (readonly)

Returns the value of attribute contacts.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def contacts
  @contacts
end

#grant_typesObject (readonly)

Returns the value of attribute grant_types.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def grant_types
  @grant_types
end

#logo_uriObject (readonly)

Returns the value of attribute logo_uri.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def logo_uri
  @logo_uri
end

#policy_uriObject (readonly)

Returns the value of attribute policy_uri.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def policy_uri
  @policy_uri
end

#redirect_urisObject (readonly)

Returns the value of attribute redirect_uris.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def redirect_uris
  @redirect_uris
end

#response_typesObject (readonly)

Returns the value of attribute response_types.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def response_types
  @response_types
end

#scopeObject (readonly)

Returns the value of attribute scope.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def scope
  @scope
end

#token_endpoint_auth_methodObject (readonly)

Returns the value of attribute token_endpoint_auth_method.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def token_endpoint_auth_method
  @token_endpoint_auth_method
end

#tos_uriObject (readonly)

Returns the value of attribute tos_uri.



89
90
91
# File 'lib/mcp_client/auth.rb', line 89

def tos_uri
  @tos_uri
end

Instance Method Details

#to_hHash

Convert to hash for HTTP requests

Returns:

  • (Hash)

    Hash representation



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/mcp_client/auth.rb', line 125

def to_h
  {
    redirect_uris: @redirect_uris,
    token_endpoint_auth_method: @token_endpoint_auth_method,
    grant_types: @grant_types,
    response_types: @response_types,
    scope: @scope,
    client_name: @client_name,
    client_uri: @client_uri,
    logo_uri: @logo_uri,
    tos_uri: @tos_uri,
    policy_uri: @policy_uri,
    contacts: @contacts
  }.compact
end