Merge pull request #306 from koic/support_customizing_faraday_client_in_mcp_client_http

Support customizing the Faraday client in `MCP::Client::HTTP`
This commit is contained in:
Koichi ITO 2026-04-10 13:42:41 +09:00 • committed by GitHub
commit a05d941edd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,9 +7,10 @@ module MCP
attr_reader :url
def initialize(url:, headers: {})
def initialize(url:, headers: {}, &block)
@url = url
@headers = headers
@faraday_customizer = block
end
def send_request(request:)
@ -78,6 +79,8 @@ module MCP
headers.each do |key, value|
faraday.headers[key] = value
end
@faraday_customizer&.call(faraday)
end
end