pub struct Upstream { /* private fields */ }Expand description
An upstream MCP server (Streamable HTTP).
Implementations§
Source§impl Upstream
impl Upstream
Sourcepub fn new(prefix: impl Into<String>, url: impl Into<String>) -> Upstream
pub fn new(prefix: impl Into<String>, url: impl Into<String>) -> Upstream
The server at url (its MCP endpoint, e.g. https://mcp.example.com/mcp),
whose tools appear as <prefix>__<tool>. prefix is letters, digits,
- and single _s.
Sourcepub fn header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Upstream
pub fn header( self, name: impl Into<String>, value: impl Into<String>, ) -> Upstream
Send this header to the upstream on every request — its credentials,
e.g. .header("Authorization", "Bearer <upstream token>").
Sourcepub fn header_for<F>(self, name: impl Into<String>, value: F) -> Upstream
pub fn header_for<F>(self, name: impl Into<String>, value: F) -> Upstream
Send header name on each tool call with a value computed from the
caller’s verified claims (the JSON of
McpContext::auth_claims, None
for a caller without one) — e.g. each user’s own upstream token,
looked up by sub, so the upstream acts as that user. None from
value sends no header. Only tools/call carries a caller; listing
and prompts/resources use the static Self::headers.
Sourcepub fn timeout_ms(self, timeout_ms: u64) -> Upstream
pub fn timeout_ms(self, timeout_ms: u64) -> Upstream
Give up on an upstream request after this long (default 30 s).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Upstream
impl !UnwindSafe for Upstream
impl Freeze for Upstream
impl Send for Upstream
impl Sync for Upstream
impl Unpin for Upstream
impl UnsafeUnpin for Upstream
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
map-response-body only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.