Class: ClaudeSDK::McpServerConfig::SSEServer

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_sdk/types.rb

Overview

MCP SSE server configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, headers: {}) ⇒ SSEServer

Returns a new instance of SSEServer.

Parameters:

  • url (String)

    the server URL

  • headers (Hash<String, String>) (defaults to: {})

    HTTP headers



76
77
78
79
80
# File 'lib/claude_sdk/types.rb', line 76

def initialize(url:, headers: {})
  @type = :sse
  @url = url
  @headers = headers
end

Instance Attribute Details

#headersObject

HTTP headers



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/claude_sdk/types.rb', line 70

class SSEServer
  attr_accessor :url, :headers
  attr_reader :type

  # @param url [String] the server URL
  # @param headers [Hash<String, String>] HTTP headers
  def initialize(url:, headers: {})
    @type = :sse
    @url = url
    @headers = headers
  end

  # Convert to hash for JSON serialization
  #
  # @return [Hash]
  def to_h
    hash = { type: type.to_s, url: url }
    hash[:headers] = headers unless headers.empty?
    hash
  end
end

#typeObject

Returns the value of attribute type.



72
73
74
# File 'lib/claude_sdk/types.rb', line 72

def type
  @type
end

#urlObject

the server URL



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/claude_sdk/types.rb', line 70

class SSEServer
  attr_accessor :url, :headers
  attr_reader :type

  # @param url [String] the server URL
  # @param headers [Hash<String, String>] HTTP headers
  def initialize(url:, headers: {})
    @type = :sse
    @url = url
    @headers = headers
  end

  # Convert to hash for JSON serialization
  #
  # @return [Hash]
  def to_h
    hash = { type: type.to_s, url: url }
    hash[:headers] = headers unless headers.empty?
    hash
  end
end

Instance Method Details

#to_hHash

Convert to hash for JSON serialization

Returns:

  • (Hash)


85
86
87
88
89
# File 'lib/claude_sdk/types.rb', line 85

def to_h
  hash = { type: type.to_s, url: url }
  hash[:headers] = headers unless headers.empty?
  hash
end