Skip to content

Commit 00789ac

Browse files
chore(mcp): clarify http auth error
1 parent 662aa87 commit 00789ac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/mcp-server/src/headers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> =
1515
password: rawValue.slice(rawValue.search(':') + 1),
1616
};
1717
default:
18-
throw new Error(`Unsupported authorization scheme`);
18+
throw new Error(
19+
'Unsupported authorization scheme. Expected the "Authorization" header to be a supported scheme (Basic).',
20+
);
1921
}
2022
}
2123

packages/mcp-server/src/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ const newServer = ({
4646
},
4747
mcpOptions,
4848
});
49-
} catch {
49+
} catch (error) {
5050
res.status(401).json({
5151
jsonrpc: '2.0',
5252
error: {
5353
code: -32000,
54-
message: 'Unauthorized',
54+
message: `Unauthorized: ${error instanceof Error ? error.message : error}`,
5555
},
5656
});
5757
return null;

0 commit comments

Comments
 (0)