Expand description
A type-safe Claude Code CLI wrapper for Rust.
claude-wrapper provides a builder-pattern interface for invoking the
claude CLI programmatically. It follows the same design philosophy as
docker-wrapper and
terraform-wrapper:
each CLI subcommand is a builder struct that produces typed output.
§Quick Start
use claude_wrapper::{Claude, ClaudeCommand, QueryCommand, OutputFormat};
let claude = Claude::builder().build()?;
// Simple oneshot query
let output = QueryCommand::new("explain this error: file not found")
.model("sonnet")
.output_format(OutputFormat::Json)
.execute(&claude)
.await?;
println!("{}", output.stdout);§MCP Config Generation
use claude_wrapper::McpConfigBuilder;
let config = McpConfigBuilder::new()
.http_server("my-hub", "http://127.0.0.1:9090")
.write_to("/tmp/my-project/.mcp.json")?;Re-exports§
pub use command::ClaudeCommand;pub use command::agents::AgentsCommand;pub use command::auth::AuthStatusCommand;pub use command::doctor::DoctorCommand;pub use command::marketplace::MarketplaceAddCommand;pub use command::marketplace::MarketplaceListCommand;pub use command::marketplace::MarketplaceRemoveCommand;pub use command::marketplace::MarketplaceUpdateCommand;pub use command::mcp::McpAddCommand;pub use command::mcp::McpAddFromDesktopCommand;pub use command::mcp::McpAddJsonCommand;pub use command::mcp::McpGetCommand;pub use command::mcp::McpListCommand;pub use command::mcp::McpRemoveCommand;pub use command::mcp::McpResetProjectChoicesCommand;pub use command::plugin::PluginDisableCommand;pub use command::plugin::PluginEnableCommand;pub use command::plugin::PluginInstallCommand;pub use command::plugin::PluginListCommand;pub use command::plugin::PluginUninstallCommand;pub use command::plugin::PluginUpdateCommand;pub use command::plugin::PluginValidateCommand;pub use command::query::QueryCommand;pub use command::raw::RawCommand;pub use command::version::VersionCommand;pub use error::Error;pub use error::Result;pub use exec::CommandOutput;pub use mcp_config::McpConfigBuilder;pub use mcp_config::McpServerConfig;pub use types::*;
Modules§
Structs§
- Claude
- The Claude CLI client. Holds shared configuration applied to all commands.
- Claude
Builder - Builder for creating a
Claudeclient.