Skip to content

Commit 2837aac

Browse files
chore(mcp): clarify http auth error
1 parent 3591d14 commit 2837aac

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
@@ -17,7 +17,9 @@ export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> =
1717
clientSecret: rawValue.slice(rawValue.search(':') + 1),
1818
};
1919
default:
20-
throw new Error(`Unsupported authorization scheme`);
20+
throw new Error(
21+
'Unsupported authorization scheme. Expected the "Authorization" header to be a supported scheme (Bearer, Basic).',
22+
);
2123
}
2224
}
2325

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)