Tauri Plugin

relay-core-tauri is RelayCore's Tauri v2 host adapter. It embeds CoreState inside your desktop app and exposes proxy lifecycle, flow inspection, intercept control, and CA management through Tauri commands. The RelayCraft desktop app is built on this plugin; you can integrate the same surface in your own Tauri host.

When to use it

  • Run MITM proxy inside a desktop app instead of a separate CLI process
  • Drive flow queries, breakpoints, and policy from your frontend via invoke
  • Share the same runtime behavior as CLI, HTTP API, and MCP adapters

Where it sits

  • Data plane: relay-core-lib — capture and MITM
  • Orchestration: relay-core-runtimeCoreState
  • Host adapter: relay-core-tauri — Tauri IPC and flow event bridge

Quick integration

1. Add dependency

In your Tauri app's src-tauri/Cargo.toml (pin the same version as RelayCore):

[dependencies]
relay-core-tauri = { git = "https://github.com/relaycraft/relay-core", tag = "v0.5.2" }
tauri = { version = "2", features = [] }

2. Register the plugin

// src-tauri/src/lib.rs
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .plugin(relay_core_tauri::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Plugin ID: relay-core-tauri. Setup creates RelayCoreState (wrapping CoreState and TauriContext) and registers it with Tauri state.

3. Capabilities (Tauri v2)

The default permission set only allows start_core_proxy. For a full desktop workflow, allow the commands you need explicitly:

{
  "identifier": "main-capability",
  "windows": ["main"],
  "permissions": [
    "relay-core-tauri:allow-start-core-proxy",
    "relay-core-tauri:allow-stop-core-proxy",
    "relay-core-tauri:allow-get-core-status",
    "relay-core-tauri:allow-get-flow-detail",
    "relay-core-tauri:allow-get-pending-intercepts",
    "relay-core-tauri:allow-resume-flow",
    "relay-core-tauri:allow-install-ca-cert"
  ]
}

4. Start proxy from the frontend

import { invoke } from "@tauri-apps/api/core";

// Default port 8080; CA is written under app_data_dir
await invoke("plugin:relay-core-tauri|start_core_proxy", { port: 8080 });

const status = await invoke("plugin:relay-core-tauri|get_core_status");
console.log(status);

For HTTPS interception, trust the CA first: start_core_proxy generates certificates in the app data directory, then call install_ca_cert to open the OS trust prompt (macOS / Windows).

Available commands

CommandDescription
start_core_proxyStart embedded proxy (optional port, default 8080)
stop_core_proxyStop proxy
get_core_statusRuntime status snapshot
get_core_metricsPrometheus-compatible metrics
get_flow_detailFlow detail by ID
get_pending_interceptsList pending intercepts
resume_flowResume or drop paused traffic
set_intercept_ruleSet intercept rule
get_policy / update_policy / patch_policyProxy policy read/write
load_scriptHot-load Deno script
get_ca_cert_pathCA certificate path (proxy must be running)
install_ca_certOpen OS CA install prompt
get_recent_auditRecent control-plane audit events

Typical workflow

// 1. Start proxy
await invoke("plugin:relay-core-tauri|start_core_proxy", { port: 8080 });

// 2. Install CA (user confirms trust in the OS dialog)
await invoke("plugin:relay-core-tauri|install_ca_cert");

// 3. Inspect and resume pending intercepts
const pending = await invoke("plugin:relay-core-tauri|get_pending_intercepts");
await invoke("plugin:relay-core-tauri|resume_flow", { id: "flow-id:request", action: "continue" });

CLI / MCP / Tauri

HostBest for
relay-core-cliTerminal debugging, script dev, CI
relay-core-probe (@relay-core/mcp)AI agents and IDE integration
relay-core-tauriEmbedded desktop apps with native UI

All three share the same runtime capability surface. See Quick Start for CLI and HTTP API for the REST control plane.

See also