pub struct SessionRpcMcpOauth<'a> { /* private fields */ }Expand description
session.mcp.oauth.* RPCs.
Implementations§
Source§impl<'a> SessionRpcMcpOauth<'a>
impl<'a> SessionRpcMcpOauth<'a>
Sourcepub async fn handle_pending_request(
&self,
params: McpOauthHandlePendingRequest,
) -> Result<McpOauthHandlePendingResult, Error>
pub async fn handle_pending_request( &self, params: McpOauthHandlePendingRequest, ) -> Result<McpOauthHandlePendingResult, Error>
Resolves a pending MCP OAuth request with a host-provided token or cancellation. The pending request is emitted as mcp.oauth_required with the data necessary to authorize the request.
Wire method: session.mcp.oauth.handlePendingRequest.
§Parameters
params- Pending MCP OAuth request ID and host-provided token or cancellation response.
§Returns
Indicates whether the pending MCP OAuth response was accepted.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn authentication_state_changed(
&self,
params: McpOauthAuthenticationStateChangedRequest,
) -> Result<(), Error>
pub async fn authentication_state_changed( &self, params: McpOauthAuthenticationStateChangedRequest, ) -> Result<(), Error>
Notifies the session that MCP OAuth authentication succeeded and updated credentials were persisted, so cached tool definitions can be refreshed.
Wire method: session.mcp.oauth.authenticationStateChanged.
§Parameters
params- Identifies the MCP server whose persisted OAuth credentials were updated.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn prepare_login(
&self,
params: SessionMcpOauthPrepareLoginParams,
) -> Result<McpOauthPrepareLoginResult, Error>
pub async fn prepare_login( &self, params: SessionMcpOauthPrepareLoginParams, ) -> Result<McpOauthPrepareLoginResult, Error>
Prepares an inert, expiring owned OAuth login bound to the original session requester and exact installation. Does not activate, connect, read credentials or open a browser.
Wire method: session.mcp.oauth.prepareLogin.
§Parameters
params- Effect-free preparation bound to the existing local session, requester and installation, with frozen options.
§Returns
An inert runtime-issued login handle. Preparation alone performs no activation or OAuth work.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn login(
&self,
params: McpOauthLoginRequest,
) -> Result<McpOauthLoginResult, Error>
pub async fn login( &self, params: McpOauthLoginRequest, ) -> Result<McpOauthLoginResult, Error>
Starts OAuth authentication for a remote MCP server. Owned servers require the original one-use prepareLogin handle and exact installation ID; manual servers retain the existing direct login behaviour.
Wire method: session.mcp.oauth.login.
§Parameters
params- Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
§Returns
OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn login_with_options(
&self,
params: McpOauthLoginOptions,
) -> Result<McpOauthLoginResult, Error>
pub async fn login_with_options( &self, params: McpOauthLoginOptions, ) -> Result<McpOauthLoginResult, Error>
Starts OAuth authentication for a remote MCP server. Owned servers require the original one-use prepareLogin handle and exact installation ID; manual servers retain the existing direct login behaviour.
Wire method: session.mcp.oauth.login.
§Parameters
params- Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
§Returns
OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Accepts McpOauthLoginOptions, including inputs added after McpOauthLoginRequest.
Sourcepub async fn probe(
&self,
params: McpOauthProbeRequest,
) -> Result<McpOauthProbeResult, Error>
pub async fn probe( &self, params: McpOauthProbeRequest, ) -> Result<McpOauthProbeResult, Error>
Passively probes a configured remote MCP server to classify whether OAuth is required or a cached/override token is accepted. Does not start OAuth, emit pending OAuth requests, or mutate MCP connection state.
Wire method: session.mcp.oauth.probe.
§Parameters
params- Remote MCP server name for a passive OAuth status probe.
§Returns
Passive MCP OAuth probe result. authenticated means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn probe_with_options(
&self,
params: McpOauthProbeOptions,
) -> Result<McpOauthProbeResult, Error>
pub async fn probe_with_options( &self, params: McpOauthProbeOptions, ) -> Result<McpOauthProbeResult, Error>
Passively probes a configured remote MCP server to classify whether OAuth is required or a cached/override token is accepted. Does not start OAuth, emit pending OAuth requests, or mutate MCP connection state.
Wire method: session.mcp.oauth.probe.
§Parameters
params- Remote MCP server name for a passive OAuth status probe.
§Returns
Passive MCP OAuth probe result. authenticated means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Accepts McpOauthProbeOptions, including inputs added after McpOauthProbeRequest.
Sourcepub async fn cancel_login(
&self,
params: SessionMcpOauthCancelLoginParams,
) -> Result<McpOauthCancelLoginResult, Error>
pub async fn cancel_login( &self, params: SessionMcpOauthCancelLoginParams, ) -> Result<McpOauthCancelLoginResult, Error>
Cancels the exact owned OAuth login issued to this original session requester, without clearing shared credentials.
Wire method: session.mcp.oauth.cancelLogin.
§Parameters
params- Targets only the original prepared/applying owned login on this exact session requester.
§Returns
Honest terminal cancellation result; persistence or recovery failures remain RPC errors.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn respond(
&self,
params: McpOauthRespondRequest,
) -> Result<McpOauthRespondResult, Error>
pub async fn respond( &self, params: McpOauthRespondRequest, ) -> Result<McpOauthRespondResult, Error>
Responds to a pending MCP OAuth authorization request by its request id.
Wire method: session.mcp.oauth.respond.
§Parameters
params- Pending MCP OAuth request id to respond to.
§Returns
Indicates whether the pending MCP OAuth response was accepted.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.