pub struct McpServerConfig {
pub id: McpServerId,
pub transport: McpTransportBinding,
pub metadata: MetadataMap,
}Expand description
Full configuration for a single MCP server, combining an identifier, a transport binding, and optional metadata.
Register one or more of these with McpServerManager to manage the lifecycle
of MCP servers in an agentkit runtime.
§Example
use agentkit_mcp::{McpServerConfig, McpTransportBinding, StdioTransportConfig};
let config = McpServerConfig::new(
"filesystem",
McpTransportBinding::Stdio(
StdioTransportConfig::new("npx")
.with_arg("-y")
.with_arg("@modelcontextprotocol/server-filesystem"),
),
);Fields§
§id: McpServerIdUnique identifier for this server.
transport: McpTransportBindingTransport binding that determines how communication happens.
metadata: MetadataMapArbitrary metadata attached to this server configuration.
Implementations§
Source§impl McpServerConfig
impl McpServerConfig
Sourcepub fn new(id: impl Into<String>, transport: McpTransportBinding) -> Self
pub fn new(id: impl Into<String>, transport: McpTransportBinding) -> Self
Creates a new server configuration with the given identifier and transport.
§Arguments
id- A unique name for this server (e.g."filesystem").transport- TheMcpTransportBindingthat determines how to connect.
Sourcepub fn stdio(id: impl Into<String>, command: impl Into<String>) -> Self
pub fn stdio(id: impl Into<String>, command: impl Into<String>) -> Self
Creates a stdio-backed server configuration.
Sourcepub fn sse(id: impl Into<String>, url: impl Into<String>) -> Self
pub fn sse(id: impl Into<String>, url: impl Into<String>) -> Self
Creates an SSE-backed server configuration.
Sourcepub fn with_metadata(self, metadata: MetadataMap) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Replaces the configuration metadata.
Trait Implementations§
Source§impl Clone for McpServerConfig
impl Clone for McpServerConfig
Source§fn clone(&self) -> McpServerConfig
fn clone(&self) -> McpServerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for McpServerConfig
impl !RefUnwindSafe for McpServerConfig
impl Send for McpServerConfig
impl Sync for McpServerConfig
impl Unpin for McpServerConfig
impl UnsafeUnpin for McpServerConfig
impl !UnwindSafe for McpServerConfig
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
Mutably borrows from an owned value. Read more