Skip to main content

faucet_cli/serve/
mod.rs

1//! `faucet serve` — HTTP control plane (#127). Runs pipeline configs submitted
2//! over HTTP, reusing `executor::run_expanded`. Feature-gated on `serve`;
3//! structured like `cli/src/schedule/`. See
4//! `docs/superpowers/specs/2026-05-30-faucet-serve-design.md`.
5
6pub mod audit;
7pub mod auth;
8pub mod cluster;
9pub mod config;
10pub mod error;
11pub mod handlers;
12pub mod history;
13pub mod idempotency;
14pub mod load;
15pub mod logs;
16#[cfg(feature = "mcp")]
17pub mod mcp_route;
18pub mod metrics;
19pub mod observability;
20pub mod rbac;
21pub mod registry;
22pub mod runner;
23pub mod server;
24pub mod state;
25#[cfg(feature = "triggers")]
26pub mod triggers;
27#[cfg(feature = "serve-ui")]
28pub mod ui_assets;
29
30pub use config::ServeConfig;
31
32use crate::error::CliResult;
33
34/// MCP endpoint settings for `faucet serve --mcp` (#420). Threaded to
35/// [`server::build_router`] so the `/mcp` route mounts only on opt-in. Kept
36/// separate from [`ServeConfig`] so the many `ServeConfig` test builders are
37/// untouched. `Default` = disabled.
38#[derive(Debug, Clone, Default)]
39pub struct McpServeSettings {
40    /// Mount the `/mcp` route.
41    pub enabled: bool,
42    /// Expose the mutating MCP tools (still gated by the caller's RBAC scope).
43    pub allow_mutations: bool,
44}
45
46/// Boot the HTTP control plane and serve until SIGTERM/SIGINT.
47pub async fn run_server(config: ServeConfig, mcp: McpServeSettings) -> CliResult<()> {
48    server::serve(config, mcp).await
49}