pub struct McpAddCommand { /* private fields */ }Expand description
Add an MCP server.
§Example
use claude_wrapper::{Claude, ClaudeCommand, McpAddCommand, Scope};
let claude = Claude::builder().build()?;
// Add an HTTP MCP server
McpAddCommand::new("sentry", "https://mcp.sentry.dev/mcp")
.transport("http")
.scope(Scope::User)
.execute(&claude)
.await?;
// Add a stdio MCP server with env vars
McpAddCommand::new("my-server", "npx")
.server_args(["my-mcp-server"])
.env("API_KEY", "xxx")
.scope(Scope::Local)
.execute(&claude)
.await?;Implementations§
Source§impl McpAddCommand
impl McpAddCommand
Sourcepub fn new(name: impl Into<String>, command_or_url: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, command_or_url: impl Into<String>) -> Self
Create a new MCP add command.
Sourcepub fn transport(self, transport: impl Into<String>) -> Self
pub fn transport(self, transport: impl Into<String>) -> Self
Set the transport type (stdio, sse, http).
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable.
Sourcepub fn server_args(
self,
args: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn server_args( self, args: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Set additional arguments for the server command.
Trait Implementations§
Source§impl ClaudeCommand for McpAddCommand
impl ClaudeCommand for McpAddCommand
Source§impl Clone for McpAddCommand
impl Clone for McpAddCommand
Source§fn clone(&self) -> McpAddCommand
fn clone(&self) -> McpAddCommand
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 McpAddCommand
impl RefUnwindSafe for McpAddCommand
impl Send for McpAddCommand
impl Sync for McpAddCommand
impl Unpin for McpAddCommand
impl UnsafeUnpin for McpAddCommand
impl UnwindSafe for McpAddCommand
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