From 895d314b86d5368644cebf7370dcc3d0f95da30a Mon Sep 17 00:00:00 2001 From: ajspig Date: Tue, 21 Jul 2026 10:43:00 -0400 Subject: [PATCH] fix: scheme is case-insensitive. --- mcp/src/config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mcp/src/config.ts b/mcp/src/config.ts index 21ff96ad..98cf8760 100644 --- a/mcp/src/config.ts +++ b/mcp/src/config.ts @@ -22,13 +22,13 @@ export interface Env { */ export function parseConfig(request: Request, env: Env = {}): HonchoConfig { const authHeader = request.headers.get("Authorization"); - const trimmedAuthHeader = authHeader?.trim(); - if (!trimmedAuthHeader?.startsWith("Bearer ")) { + const bearerMatch = authHeader?.trim().match(/^Bearer\s+(.*)$/i); + if (!bearerMatch) { throw new Error( "Missing Authorization header. Provide 'Authorization: Bearer '.", ); } - const apiKey = trimmedAuthHeader.substring(7).trim(); + const apiKey = bearerMatch[1].trim(); if (!apiKey) { throw new Error("Authorization header is empty after 'Bearer '."); }