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 callback;
9pub mod cluster;
10pub mod config;
11pub mod error;
12pub mod handlers;
13pub mod history;
14pub mod idempotency;
15pub mod load;
16pub mod logs;
17#[cfg(feature = "mcp")]
18pub mod mcp_route;
19pub mod metrics;
20pub mod observability;
21pub mod rbac;
22pub mod registry;
23pub mod runner;
24pub mod server;
25pub mod state;
26#[cfg(test)]
27pub mod test_support;
28#[cfg(feature = "triggers")]
29pub mod triggers;
30#[cfg(feature = "serve-ui")]
31pub mod ui_assets;
32
33pub use config::ServeConfig;
34
35use crate::error::CliResult;
36
37/// MCP endpoint settings for `faucet serve --mcp` (#420). Threaded to
38/// [`server::build_router`] so the `/mcp` route mounts only on opt-in. Kept
39/// separate from [`ServeConfig`] so the many `ServeConfig` test builders are
40/// untouched. `Default` = disabled.
41#[derive(Debug, Clone, Default)]
42pub struct McpServeSettings {
43    /// Mount the `/mcp` route.
44    pub enabled: bool,
45    /// Expose the mutating MCP tools (still gated by the caller's RBAC scope).
46    pub allow_mutations: bool,
47}
48
49/// Boot the HTTP control plane and serve until SIGTERM/SIGINT.
50pub async fn run_server(config: ServeConfig, mcp: McpServeSettings) -> CliResult<()> {
51    server::serve(config, mcp).await
52}