pub struct McpHttpClientBuilder { /* private fields */ }Expand description
Builder for HTTP-based MCP connections.
This builder creates connections to remote MCP servers using the streamable HTTP transport (SEP-1686 compliant).
§Example
ⓘ
use adk_tool::mcp::{McpHttpClientBuilder, McpAuth, OAuth2Config};
// Simple connection
let toolset = McpHttpClientBuilder::new("https://mcp.example.com/v1")
.connect()
.await?;
// With OAuth2 authentication
let toolset = McpHttpClientBuilder::new("https://mcp.example.com/v1")
.with_auth(McpAuth::oauth2(
OAuth2Config::new("client-id", "https://auth.example.com/token")
.with_secret("client-secret")
.with_scopes(vec!["mcp:read".into()])
))
.timeout(Duration::from_secs(60))
.connect()
.await?;Implementations§
Source§impl McpHttpClientBuilder
impl McpHttpClientBuilder
Sourcepub fn new(endpoint: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>) -> Self
Create a new HTTP client builder for the given endpoint.
§Arguments
endpoint- The MCP server URL (e.g., “https://mcp.example.com/v1”)
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the request timeout.
Default is 30 seconds.
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a custom header to all requests.
Sourcepub fn get_timeout(&self) -> Duration
pub fn get_timeout(&self) -> Duration
Get the configured timeout.
Trait Implementations§
Source§impl Clone for McpHttpClientBuilder
impl Clone for McpHttpClientBuilder
Source§fn clone(&self) -> McpHttpClientBuilder
fn clone(&self) -> McpHttpClientBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for McpHttpClientBuilder
impl !RefUnwindSafe for McpHttpClientBuilder
impl Send for McpHttpClientBuilder
impl Sync for McpHttpClientBuilder
impl Unpin for McpHttpClientBuilder
impl UnsafeUnpin for McpHttpClientBuilder
impl !UnwindSafe for McpHttpClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request