http_bearer_token

Function http_bearer_token 

Source
fn http_bearer_token(ctx: &RequestContext<RoleServer>) -> Option<String>
Expand description

从 rmcp RequestContext 提取 HTTP Authorization: Bearer <token> —— 仅 HTTP transport 有效(streamable_http_server 把 http::request::Parts 塞进 ctx.extensions)。stdio 下 Parts 不存在 → 返回 None。

优先级:tool args 里的 api_key 字段 > HTTP Bearer header > startup key。 这里只负责提取 header 部分;调用方用 req.api_key.as_deref().or(header) 决定最终 override_key。