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(test)]
26pub mod test_support;
27#[cfg(feature = "triggers")]
28pub mod triggers;
29#[cfg(feature = "serve-ui")]
30pub mod ui_assets;
31
32pub use config::ServeConfig;
33
34use crate::error::CliResult;
35
36/// MCP endpoint settings for `faucet serve --mcp` (#420). Threaded to
37/// [`server::build_router`] so the `/mcp` route mounts only on opt-in. Kept
38/// separate from [`ServeConfig`] so the many `ServeConfig` test builders are
39/// untouched. `Default` = disabled.
40#[derive(Debug, Clone, Default)]
41pub struct McpServeSettings {
42    /// Mount the `/mcp` route.
43    pub enabled: bool,
44    /// Expose the mutating MCP tools (still gated by the caller's RBAC scope).
45    pub allow_mutations: bool,
46}
47
48/// Boot the HTTP control plane and serve until SIGTERM/SIGINT.
49pub async fn run_server(config: ServeConfig, mcp: McpServeSettings) -> CliResult<()> {
50    server::serve(config, mcp).await
51}