Skip to content

Commit 5d1f7ed

Browse files
committed
fix: add fallback to config token when authInfo token is empty
When extra.authInfo?.token is undefined or empty, fallback to config.GITLAB_PERSONAL_ACCESS_TOKEN to ensure API calls work with proper authentication. Fixes issue where some MCP tools returned 404 due to empty Authorization header when no authInfo token was provided.
1 parent 0c5e667 commit 5d1f7ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mcpserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
678678
}
679679
// Create GitlabSession instance
680680
// TODO: we silently do nothing if the authInfo is not properly forwared. should we do something?
681-
const gitlabSession = new GitlabHandler(extra.authInfo?.token || "", cookieJar);
681+
const gitlabSession = new GitlabHandler(extra.authInfo?.token || config.GITLAB_PERSONAL_ACCESS_TOKEN || "", cookieJar);
682682
if(cookieJar) {
683683
await gitlabSession.ensureSessionForCookieJar();
684684
}

0 commit comments

Comments
 (0)