diff --git a/src/mcpd/src/services/llm/adapters/anthropic.ts b/src/mcpd/src/services/llm/adapters/anthropic.ts index 4f2f185..a8ddd5f 100644 --- a/src/mcpd/src/services/llm/adapters/anthropic.ts +++ b/src/mcpd/src/services/llm/adapters/anthropic.ts @@ -182,9 +182,15 @@ export class AnthropicAdapter implements LlmAdapter { } private headers(ctx: InferContext): Record { + // Claude subscription / Claude Code keys are OAuth tokens (`sk-ant-oat…`) + // and authenticate via Bearer, not x-api-key — mirror the mcplocal client + // adapter so an OAuth key works as a server-side fallback Llm. + const isOAuth = ctx.apiKey.startsWith('sk-ant-oat'); return { 'Content-Type': 'application/json', - 'x-api-key': ctx.apiKey, + ...(isOAuth + ? { Authorization: `Bearer ${ctx.apiKey}` } + : { 'x-api-key': ctx.apiKey }), 'anthropic-version': ANTHROPIC_VERSION, }; }