pub struct McpServer {
pub name: String,
pub server_type: McpServerType,
pub command: Option<String>,
pub args: Vec<String>,
pub env: Vec<(String, String)>,
pub url: Option<String>,
pub enabled: bool,
}Expand description
MCP server configuration.
This represents a single MCP server that can be connected to.
Fields§
§name: StringServer name/identifier
server_type: McpServerTypeTransport type
command: Option<String>Command to run (for stdio transport)
args: Vec<String>Command arguments
env: Vec<(String, String)>Environment variables to set
url: Option<String>URL for SSE/WebSocket transports
enabled: boolWhether this server is enabled
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn stdio(
name: impl Into<String>,
command: impl Into<String>,
args: Vec<&str>,
) -> McpServer
pub fn stdio( name: impl Into<String>, command: impl Into<String>, args: Vec<&str>, ) -> McpServer
Create a new stdio MCP server.
§Example
use spn_core::McpServer;
let server = McpServer::stdio("neo4j", "npx", vec!["-y", "@anthropic/mcp-neo4j"]);
assert_eq!(server.name, "neo4j");
assert!(server.enabled);Sourcepub fn sse(name: impl Into<String>, url: impl Into<String>) -> McpServer
pub fn sse(name: impl Into<String>, url: impl Into<String>) -> McpServer
Create a new SSE MCP server.
§Example
use spn_core::McpServer;
let server = McpServer::sse("remote", "http://localhost:3000/mcp");
assert_eq!(server.name, "remote");Sourcepub fn with_env(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> McpServer
pub fn with_env( self, key: impl Into<String>, value: impl Into<String>, ) -> McpServer
Add an environment variable.
Sourcepub fn with_enabled(self, enabled: bool) -> McpServer
pub fn with_enabled(self, enabled: bool) -> McpServer
Set enabled state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpServer
impl RefUnwindSafe for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl UnsafeUnpin for McpServer
impl UnwindSafe for McpServer
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