Skip to main content

agent_client_protocol/mcp_server/
context.rs

1use crate::{ConnectionTo, role::Role};
2
3/// Context about the ACP and MCP connection available to an MCP server.
4#[derive(Clone, Debug)]
5pub struct McpConnectionTo<Counterpart: Role> {
6    pub(super) acp_url: String,
7    pub(super) connection: ConnectionTo<Counterpart>,
8}
9
10impl<Counterpart: Role> McpConnectionTo<Counterpart> {
11    /// The `acp:UUID` that was given.
12    pub fn acp_url(&self) -> String {
13        self.acp_url.clone()
14    }
15
16    /// The host connection context.
17    ///
18    /// If this MCP server is hosted inside of an ACP context, this will be the ACP connection context.
19    pub fn connection_to(&self) -> ConnectionTo<Counterpart> {
20        self.connection.clone()
21    }
22}