feat(examples): add streamable HTTP section in configs (#296)
This commit is contained in:
parent
ee80903091
commit
31155a440c
1 changed files with 18 additions and 0 deletions
|
|
@ -14,6 +14,9 @@ pub struct McpServerConfig {
|
|||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(tag = "protocol", rename_all = "lowercase")]
|
||||
pub enum McpServerTransportConfig {
|
||||
Streamable {
|
||||
url: String,
|
||||
},
|
||||
Sse {
|
||||
url: String,
|
||||
},
|
||||
|
|
@ -60,6 +63,11 @@ impl McpConfig {
|
|||
impl McpServerTransportConfig {
|
||||
pub async fn start(&self) -> anyhow::Result<RunningService<RoleClient, ()>> {
|
||||
let client = match self {
|
||||
McpServerTransportConfig::Streamable { url } => {
|
||||
let transport =
|
||||
rmcp::transport::StreamableHttpClientTransport::from_uri(url.to_string());
|
||||
().serve(transport).await?
|
||||
}
|
||||
McpServerTransportConfig::Sse { url } => {
|
||||
let transport = rmcp::transport::SseClientTransport::start(url.to_string()).await?;
|
||||
().serve(transport).await?
|
||||
|
|
|
|||
Loading…
Reference in a new issue