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) ⇒ 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



96
97
98
99
100
101
102
103
104
# File 'lib/mcp_client/auth.rb', line 96

def initialize(redirect_uris:, token_endpoint_auth_method: 'none',
               grant_types: %w[authorization_code refresh_token],
               response_types: ['code'], scope: nil)
  @redirect_uris = redirect_uris
  @token_endpoint_auth_method = token_endpoint_auth_method
  @grant_types = grant_types
  @response_types = response_types
  @scope = scope
end

Instance Attribute Details

#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

#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

Instance Method Details

#to_hHash

Convert to hash for HTTP requests

Returns:

  • (Hash)

    Hash representation



108
109
110
111
112
113
114
115
116
# File 'lib/mcp_client/auth.rb', line 108

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
  }.compact
end