cloudiful-server
Small Rust server bootstrap crate for Cloud1ful services. It centralizes shared listen address, CORS, TLS, Axum, Actix, and MCP transport setup without owning application routing.
Features
- Default:
actix axum: AxumRouterstartup with optional shared statemcp: rmcp stdio helpers plus Streamable HTTP service, router, and server helperstls: omittlsfor plain HTTP, setcert_path+cert_key_pathfor server TLS, and addclient_cafor mTLS
Core Config
use ;
let config = new
.with_listen_addr
.with_cors
.build?;
Listen addresses like :8080 are normalized to 0.0.0.0:8080.
TLS is opt-in:
use ;
let config = new
.with_tls
.build?;
mTLS uses the same TlsConfig with an extra client CA bundle:
use ;
let config = new
.with_tls
.build?;
When client_ca is not configured, startup keeps the existing server-only TLS behavior.
When client_ca is configured, the server requests and verifies client certificates
against that CA bundle.
Actix
Enabled by default.
use ;
use ;
let config = new.build?;
new
.start
.await?;
Axum
Enable with features = ["axum"].
use ;
use ServerConfig;
let config = new
.with_app_data
.build?;
let app = new.route;
new_with_state
.start
.await?;
MCP
Enable with features = ["mcp"].
use ;
;
Run over stdio:
let server = serve_stdio.await?;
server.waiting.await?;
Run as a standalone Streamable HTTP server:
use ServerConfig;
let http = new
.with_listen_addr
.build?;
new
.with_server_config
.start
.await?;
Embed into an existing Axum router:
use ;
let mcp_service = service?;
let app = new
.route
.nest_service;
Build an MCP-only router:
let app = router?;
mcp::service is the shared construction path. mcp::router and
mcp::Server build on top of it.
Testing