Skip to content

Commit 7f44387

Browse files
authored
[RHIDP-12903] Remove Bearer From MCP HEADERS for Lightspeed (#2621)
* remove Bearer from MCP header Signed-off-by: Jordan Dubrick <jdubrick@redhat.com> * add changeset Signed-off-by: Jordan Dubrick <jdubrick@redhat.com> * remove existing Bearer prefixes after rebase Signed-off-by: Jordan Dubrick <jdubrick@redhat.com> --------- Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
1 parent 0094109 commit 7f44387

5 files changed

Lines changed: 12 additions & 7 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-lightspeed-backend': patch
3+
---
4+
5+
remove bearer from mcp header to adhere to LCORE standard

workspaces/lightspeed/plugins/lightspeed-backend/__fixtures__/mcpHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const MOCK_TOOLS = [
2828
export const mcpHandlers: HttpHandler[] = [
2929
http.post(MOCK_MCP_ADDR, async ({ request }) => {
3030
const auth = request.headers.get('Authorization');
31-
if (auth !== `Bearer ${MOCK_MCP_VALID_TOKEN}`) {
31+
if (auth !== `${MOCK_MCP_VALID_TOKEN}`) {
3232
return HttpResponse.json({ error: 'Unauthorized' }, { status: 401 });
3333
}
3434

workspaces/lightspeed/plugins/lightspeed-backend/src/service/mcp-server-validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class McpServerValidator {
3434
async validate(url: string, token: string): Promise<McpValidationResult> {
3535
const headers: Record<string, string> = {
3636
'Content-Type': 'application/json',
37-
Authorization: `Bearer ${token}`,
37+
Authorization: `${token}`,
3838
Accept: 'application/json, text/event-stream',
3939
};
4040

workspaces/lightspeed/plugins/lightspeed-backend/src/service/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ describe('lightspeed router tests', () => {
514514

515515
const parsedHeaders = JSON.parse(capturedMcpHeaders!);
516516
expect(parsedHeaders).toEqual({
517-
'mcp-server-1': { Authorization: 'Bearer token-1' },
518-
'mcp-server-2': { Authorization: 'Bearer token-2' },
517+
'mcp-server-1': { Authorization: 'token-1' },
518+
'mcp-server-2': { Authorization: 'token-2' },
519519
});
520520
});
521521

@@ -617,7 +617,7 @@ describe('lightspeed router tests', () => {
617617

618618
const parsedHeaders = JSON.parse(capturedMcpHeaders!);
619619
expect(parsedHeaders).toEqual({
620-
'single-mcp-server': { Authorization: 'Bearer single-token' },
620+
'single-mcp-server': { Authorization: 'single-token' },
621621
});
622622
});
623623

workspaces/lightspeed/plugins/lightspeed-backend/src/service/router.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ interface StaticMcpServer {
5757

5858
/**
5959
* Build MCP-HEADERS for LCS. Format matches the LCS "client" auth model:
60-
* { "server-name": { "Authorization": "Bearer <token>" } }
60+
* { "server-name": { "Authorization": "<token>" } }
6161
*
6262
* For each admin-configured server, includes the user's override token if
6363
* present in the DB, falling back to the admin default from app-config.
@@ -82,7 +82,7 @@ async function buildMcpHeaders(
8282
// If neither exists, the server is excluded from MCP-HEADERS.
8383
const token = setting?.token || server.token;
8484
if (token) {
85-
headers[server.name] = { Authorization: `Bearer ${token}` };
85+
headers[server.name] = { Authorization: `${token}` };
8686
}
8787
}
8888

0 commit comments

Comments
 (0)