Skip to content

Commit 2175de2

Browse files
authored
fix(search): describe OAuth-only authentication accurately (#339)
1 parent ff0d028 commit 2175de2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ async function authenticateRequest(
510510
keylessClientIp: extractClientIp(request),
511511
};
512512
}
513+
if (!profile.acceptApiKeys) {
514+
throw new Error(
515+
`OAuth access token required for the Firecrawl MCP resource ${profile.endpoint}`
516+
);
517+
}
513518
throw new Error(
514519
'Firecrawl credentials required: OAuth access token (Authorization: Bearer fco_...) or API key (x-firecrawl-api-key)'
515520
);

tests/mcp-search-profile.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ test('primary search profile is OAuth-only, six-tool frozen, and ready without k
569569
method: 'tools/list',
570570
});
571571
assert.equal(anonymous.status, 401);
572+
const anonymousBody = await anonymous.text();
573+
assert.match(anonymousBody, /OAuth access token required/);
574+
assert.doesNotMatch(anonymousBody, /API key/i);
572575
assert.match(
573576
anonymous.headers.get('www-authenticate') ?? '',
574577
/oauth-protected-resource\/v2\/mcp-search/

0 commit comments

Comments
 (0)