pub fn server_context_mw(
app_name: String,
app_version: String,
custom: Vec<(String, String)>,
enabled: bool,
) -> impl Fn(Request, Next) -> Pin<Box<dyn Future<Output = Response> + Send + 'static>> + Clone + Send + 'staticExpand description
组装完整中间件链(由外到内):CORS → Bearer → Gzip → 路由。 tower 的 layer 语义是「先 add 的靠内」,所以按 内→外 顺序加。 服务器上下文头(spec §11.6):X-App-Name / X-App-Version / X-XYZ-Version 三个身份头(enabled 时)+ 用户自定义静态头(始终写)。 覆盖全部路由(含 /healthz、/openapi.json 与挂载的 /mcp);命令/耗时头 是每路由的,在 EntryHandler 里写。