Skip to repository content37 lines · 1.3 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:57:14.582Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
transport.rs
1pub mod http;
2mod stdio_transport;
3
4use anyhow::Result;
5use async_trait::async_trait;
6use futures::Stream;
7use std::pin::Pin;
8
9use crate::oauth::WwwAuthenticate;
10
11pub use http::*;
12pub use stdio_transport::*;
13
14#[async_trait]
15pub trait Transport: Send + Sync {
16 async fn send(&self, message: String) -> Result<()>;
17 fn receive(&self) -> Pin<Box<dyn Stream<Item = String> + Send>>;
18 fn receive_err(&self) -> Pin<Box<dyn Stream<Item = String> + Send>>;
19
20 /// Called after the MCP initialize handshake completes so transports that
21 /// need the negotiated version (currently only HTTP, which must attach an
22 /// `MCP-Protocol-Version` header from 2025-06-18 onward) can pick it up.
23 fn set_protocol_version(&self, _version: &str) {}
24
25 /// The authentication challenge from the last `401 Unauthorized` response
26 /// this transport gave up on, if any (currently only set by the HTTP
27 /// transport).
28 ///
29 /// The challenge is recorded right before the failed send tears down the
30 /// client's output loop. Observers of the client's shutdown read it from
31 /// here, so a 401 can initiate the OAuth flow even when it arrived on a
32 /// notification, with no request in flight to carry a typed error.
33 fn auth_challenge(&self) -> Option<WwwAuthenticate> {
34 None
35 }
36}
37