Class: MCPClient::Auth::ServerMetadata
- Inherits:
-
Object
- Object
- MCPClient::Auth::ServerMetadata
- Defined in:
- lib/mcp_client/auth.rb
Overview
OAuth authorization server metadata
Instance Attribute Summary collapse
-
#authorization_endpoint ⇒ Object
readonly
Returns the value of attribute authorization_endpoint.
-
#client_id_metadata_document_supported ⇒ Object
readonly
Returns the value of attribute client_id_metadata_document_supported.
-
#code_challenge_methods_supported ⇒ Object
readonly
Returns the value of attribute code_challenge_methods_supported.
-
#grant_types_supported ⇒ Object
readonly
Returns the value of attribute grant_types_supported.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#registration_endpoint ⇒ Object
readonly
Returns the value of attribute registration_endpoint.
-
#response_types_supported ⇒ Object
readonly
Returns the value of attribute response_types_supported.
-
#scopes_supported ⇒ Object
readonly
Returns the value of attribute scopes_supported.
-
#token_endpoint ⇒ Object
readonly
Returns the value of attribute token_endpoint.
Class Method Summary collapse
-
.from_h(data) ⇒ ServerMetadata
Create server metadata from hash.
Instance Method Summary collapse
-
#initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil, code_challenge_methods_supported: nil, client_id_metadata_document_supported: nil) ⇒ ServerMetadata
constructor
rubocop:disable Metrics/ParameterLists.
-
#supports_client_id_metadata_documents? ⇒ Boolean
Check if the server accepts clients using Client ID Metadata Documents (MCP 2025-11-25 / SEP-991), i.e.
-
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported.
-
#to_h ⇒ Hash
Convert to hash.
Constructor Details
#initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil, code_challenge_methods_supported: nil, client_id_metadata_document_supported: nil) ⇒ ServerMetadata
rubocop:disable Metrics/ParameterLists
242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/mcp_client/auth.rb', line 242 def initialize(issuer:, authorization_endpoint:, token_endpoint:, registration_endpoint: nil, scopes_supported: nil, response_types_supported: nil, grant_types_supported: nil, code_challenge_methods_supported: nil, client_id_metadata_document_supported: nil) # rubocop:enable Metrics/ParameterLists @issuer = issuer @authorization_endpoint = @token_endpoint = token_endpoint @registration_endpoint = registration_endpoint @scopes_supported = scopes_supported @response_types_supported = response_types_supported @grant_types_supported = grant_types_supported @code_challenge_methods_supported = code_challenge_methods_supported @client_id_metadata_document_supported = end |
Instance Attribute Details
#authorization_endpoint ⇒ Object (readonly)
Returns the value of attribute authorization_endpoint.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def @authorization_endpoint end |
#client_id_metadata_document_supported ⇒ Object (readonly)
Returns the value of attribute client_id_metadata_document_supported.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def @client_id_metadata_document_supported end |
#code_challenge_methods_supported ⇒ Object (readonly)
Returns the value of attribute code_challenge_methods_supported.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def code_challenge_methods_supported @code_challenge_methods_supported end |
#grant_types_supported ⇒ Object (readonly)
Returns the value of attribute grant_types_supported.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def grant_types_supported @grant_types_supported end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def issuer @issuer end |
#registration_endpoint ⇒ Object (readonly)
Returns the value of attribute registration_endpoint.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def registration_endpoint @registration_endpoint end |
#response_types_supported ⇒ Object (readonly)
Returns the value of attribute response_types_supported.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def response_types_supported @response_types_supported end |
#scopes_supported ⇒ Object (readonly)
Returns the value of attribute scopes_supported.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def scopes_supported @scopes_supported end |
#token_endpoint ⇒ Object (readonly)
Returns the value of attribute token_endpoint.
227 228 229 |
# File 'lib/mcp_client/auth.rb', line 227 def token_endpoint @token_endpoint end |
Class Method Details
.from_h(data) ⇒ ServerMetadata
Create server metadata from hash
289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/mcp_client/auth.rb', line 289 def self.from_h(data) new( issuer: data[:issuer] || data['issuer'], authorization_endpoint: data[:authorization_endpoint] || data['authorization_endpoint'], token_endpoint: data[:token_endpoint] || data['token_endpoint'], registration_endpoint: data[:registration_endpoint] || data['registration_endpoint'], scopes_supported: data[:scopes_supported] || data['scopes_supported'], response_types_supported: data[:response_types_supported] || data['response_types_supported'], grant_types_supported: data[:grant_types_supported] || data['grant_types_supported'], code_challenge_methods_supported: data[:code_challenge_methods_supported] || data['code_challenge_methods_supported'], client_id_metadata_document_supported: fetch_boolean(data, :client_id_metadata_document_supported) ) end |
Instance Method Details
#supports_client_id_metadata_documents? ⇒ Boolean
Check if the server accepts clients using Client ID Metadata Documents (MCP 2025-11-25 / SEP-991), i.e. HTTPS URLs as client identifiers
266 267 268 |
# File 'lib/mcp_client/auth.rb', line 266 def @client_id_metadata_document_supported == true end |
#supports_registration? ⇒ Boolean
Check if dynamic client registration is supported
259 260 261 |
# File 'lib/mcp_client/auth.rb', line 259 def supports_registration? !@registration_endpoint.nil? end |
#to_h ⇒ Hash
Convert to hash
272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/mcp_client/auth.rb', line 272 def to_h { issuer: @issuer, authorization_endpoint: @authorization_endpoint, token_endpoint: @token_endpoint, registration_endpoint: @registration_endpoint, scopes_supported: @scopes_supported, response_types_supported: @response_types_supported, grant_types_supported: @grant_types_supported, code_challenge_methods_supported: @code_challenge_methods_supported, client_id_metadata_document_supported: @client_id_metadata_document_supported }.compact end |