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, application_type: nil) ⇒ ClientMetadata

Returns a new instance of ClientMetadata.

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

  • application_type (String, nil) (defaults to: nil) —

    OIDC application type ('native' or 'web'), required in Dynamic Client Registration by MCP 2026-07-28



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/mcp_client/auth.rb', line 186

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, application_type: nil)
  @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
  @application_type = application_type
end

Instance Attribute Details

#application_type ⇒ Object (readonly)

Returns the value of attribute application_type.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def application_type
  @application_type
end

#client_name ⇒ Object (readonly)

Returns the value of attribute client_name.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def client_name
  @client_name
end

#client_uri ⇒ Object (readonly)

Returns the value of attribute client_uri.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def client_uri
  @client_uri
end

#contacts ⇒ Object (readonly)

Returns the value of attribute contacts.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def contacts
  @contacts
end

#grant_types ⇒ Object (readonly)

Returns the value of attribute grant_types.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def grant_types
  @grant_types
end

#logo_uri ⇒ Object (readonly)

Returns the value of attribute logo_uri.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def logo_uri
  @logo_uri
end

#policy_uri ⇒ Object (readonly)

Returns the value of attribute policy_uri.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def policy_uri
  @policy_uri
end

#redirect_uris ⇒ Object (readonly)

Returns the value of attribute redirect_uris.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def redirect_uris
  @redirect_uris
end

#response_types ⇒ Object (readonly)

Returns the value of attribute response_types.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def response_types
  @response_types
end

#scope ⇒ Object (readonly)

Returns the value of attribute scope.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def scope
  @scope
end

#token_endpoint_auth_method ⇒ Object (readonly)

Returns the value of attribute token_endpoint_auth_method.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def token_endpoint_auth_method
  @token_endpoint_auth_method
end

#tos_uri ⇒ Object (readonly)

Returns the value of attribute tos_uri.



170
171
172
# File 'lib/mcp_client/auth.rb', line 170

def tos_uri
  @tos_uri
end

Instance Method Details

#to_h ⇒ Hash

Convert to hash for HTTP requests

Returns:

  • (Hash) —

    Hash representation



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/mcp_client/auth.rb', line 207

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,
    application_type: @application_type
  }.compact
end