pub struct VictauriBuilder { /* private fields */ }Expand description
Builder for configuring the Victauri plugin before adding it to a Tauri app.
Supports port selection, authentication, privacy controls, output redaction, and capacity tuning. All settings have sensible defaults and can be overridden via environment variables.
Authentication is enabled by default. If no explicit token is set and no
VICTAURI_AUTH_TOKEN env var exists, a random UUID token is auto-generated
and printed to the log. Call auth_disabled()
to explicitly opt out of authentication.
Implementations§
Source§impl VictauriBuilder
impl VictauriBuilder
Sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Set the TCP port for the MCP server (default: 7373, env: VICTAURI_PORT).
Sourcepub fn event_capacity(self, capacity: usize) -> Self
pub fn event_capacity(self, capacity: usize) -> Self
Set the maximum number of events in the ring-buffer log (default: 10,000).
Sourcepub fn recorder_capacity(self, capacity: usize) -> Self
pub fn recorder_capacity(self, capacity: usize) -> Self
Set the maximum events kept during session recording (default: 50,000).
Sourcepub fn eval_timeout(self, timeout: Duration) -> Self
pub fn eval_timeout(self, timeout: Duration) -> Self
Set the timeout for JavaScript eval operations (default: 30s, env: VICTAURI_EVAL_TIMEOUT).
Sourcepub fn auth_token(self, token: impl Into<String>) -> Self
pub fn auth_token(self, token: impl Into<String>) -> Self
Set an explicit auth token for the MCP server (env: VICTAURI_AUTH_TOKEN).
Sourcepub fn generate_auth_token(self) -> Self
pub fn generate_auth_token(self) -> Self
Generate a random UUID v4 auth token.
Sourcepub fn auth_disabled(self) -> Self
pub fn auth_disabled(self) -> Self
Explicitly disable authentication. By default, Victauri auto-generates a token if none is provided. Call this method to opt out of auth entirely.
Warning: Without authentication, any process on localhost can access the MCP server. Only use this in trusted environments.
Sourcepub fn disable_tools(self, tools: &[&str]) -> Self
pub fn disable_tools(self, tools: &[&str]) -> Self
Disable specific MCP tools by name (e.g., ["eval_js", "screenshot"]).
Sourcepub fn command_allowlist(self, commands: &[&str]) -> Self
pub fn command_allowlist(self, commands: &[&str]) -> Self
Only allow these Tauri commands to be invoked via MCP (positive allowlist).
Sourcepub fn command_blocklist(self, commands: &[&str]) -> Self
pub fn command_blocklist(self, commands: &[&str]) -> Self
Block specific Tauri commands from being invoked via MCP.
Sourcepub fn add_redaction_pattern(self, pattern: impl Into<String>) -> Self
pub fn add_redaction_pattern(self, pattern: impl Into<String>) -> Self
Add a regex pattern for output redaction (e.g., r"SECRET_\w+").
Sourcepub fn enable_redaction(self) -> Self
pub fn enable_redaction(self) -> Self
Enable output redaction with built-in patterns (API keys, emails, tokens).
Sourcepub fn strict_privacy_mode(self) -> Self
pub fn strict_privacy_mode(self) -> Self
Enable strict privacy mode (equivalent to PrivacyProfile::Observe).
Disables all mutation tools (eval_js, screenshot, interactions, input,
storage writes, navigation, CSS injection) and enables output redaction.
Prefer privacy_profile() for finer control.
Sourcepub fn privacy_profile(self, profile: PrivacyProfile) -> Self
pub fn privacy_profile(self, profile: PrivacyProfile) -> Self
Set the privacy profile tier.
Observe— read-only (snapshots, logs, registry)Test— observe + interactions + input + storage writes + recordingFullControl— everything (default)
Profiles automatically enable redaction for Observe and Test.
Use disable_tools() to apply overrides on top of a profile.
Sourcepub fn console_log_capacity(self, capacity: usize) -> Self
pub fn console_log_capacity(self, capacity: usize) -> Self
Set the maximum console log entries kept in the JS bridge (default: 1000).
Sourcepub fn network_log_capacity(self, capacity: usize) -> Self
pub fn network_log_capacity(self, capacity: usize) -> Self
Set the maximum network log entries kept in the JS bridge (default: 1000).
Set the maximum navigation log entries kept in the JS bridge (default: 200).
Sourcepub fn commands(self, schemas: &[CommandInfo]) -> Self
pub fn commands(self, schemas: &[CommandInfo]) -> Self
Pre-register command schemas so get_registry, resolve_command, and
detect_ghost_commands return real results from the moment the server starts.
Pass the __schema() functions generated by #[inspectable].
VictauriBuilder::new()
.commands(&[
greet__schema(),
increment__schema(),
add_todo__schema(),
])
.build()Sourcepub fn auto_discover(self) -> Self
pub fn auto_discover(self) -> Self
Auto-discover all #[inspectable] commands in the binary.
Uses inventory to collect every command marked with #[inspectable]
at link time — no manual listing required. This replaces both
.commands(&[...]) and register_commands!().
tauri::Builder::default()
.plugin(
VictauriBuilder::new()
.auto_discover()
.build()
.unwrap(),
)Allow file: URLs in the navigate tool’s go_to action.
By default, only http and https schemes are permitted. Calling this
method opts in to file: navigation, which grants the MCP client access
to local filesystem paths via the webview.
Warning: Enabling this in untrusted environments exposes local files to any process that can reach the MCP server.
Sourcepub fn on_ready(self, f: impl FnOnce(u16) + Send + 'static) -> Self
pub fn on_ready(self, f: impl FnOnce(u16) + Send + 'static) -> Self
Register a callback invoked once the MCP server is listening. The callback receives the port number.
Sourcepub fn build<R: Runtime>(self) -> Result<TauriPlugin<R>, BuilderError>
pub fn build<R: Runtime>(self) -> Result<TauriPlugin<R>, BuilderError>
Consume the builder and produce a Tauri plugin.
In release builds this always succeeds. In debug builds the builder configuration is validated first.
§Errors
Returns BuilderError if the port, event capacity, recorder capacity, or eval
timeout are outside their valid ranges (debug builds only).