Exception: MCPClient::Errors::InsufficientScopeError

Inherits:
ConnectionError show all
Defined in:
lib/mcp_client/errors.rb

Overview

Raised for an HTTP 403 with a WWW-Authenticate insufficient_scope challenge (MCP 2025-11-25 / SEP-835). Exposes the challenge parameters so hosts can run a step-up authorization flow with the required scopes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MCPError

#era_inconclusive?

Constructor Details

#initialize(message, scope: nil, error_description: nil) ⇒ InsufficientScopeError

Returns a new instance of InsufficientScopeError.

Parameters:

  • message (String) —

    error message

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

    scopes from the challenge's scope parameter

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

    challenge error_description



67
68
69
70
71
# File 'lib/mcp_client/errors.rb', line 67

def initialize(message, scope: nil, error_description: nil)
  super(message)
  @scope = scope
  @error_description = error_description
end

Instance Attribute Details

#error_description ⇒ String? (readonly)

Returns the challenge's human-readable error description.

Returns:

  • (String, nil) —

    the challenge's human-readable error description



62
63
64
# File 'lib/mcp_client/errors.rb', line 62

def error_description
  @error_description
end

#scope ⇒ String? (readonly)

Returns the scopes required by the server's challenge.

Returns:

  • (String, nil) —

    the scopes required by the server's challenge



60
61
62
# File 'lib/mcp_client/errors.rb', line 60

def scope
  @scope
end