| 47 | } |
| 48 | |
| 49 | export function getMCPUserAgent(): string { |
| 50 | const parts: string[] = [] |
| 51 | if (process.env.CLAUDE_CODE_ENTRYPOINT) { |
| 52 | parts.push(process.env.CLAUDE_CODE_ENTRYPOINT) |
| 53 | } |
| 54 | if (process.env.CLAUDE_AGENT_SDK_VERSION) { |
| 55 | parts.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`) |
| 56 | } |
| 57 | if (process.env.CLAUDE_AGENT_SDK_CLIENT_APP) { |
| 58 | parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`) |
| 59 | } |
| 60 | const suffix = parts.length > 0 ? ` (${parts.join(', ')})` : '' |
| 61 | return `claude-code/${MACRO.VERSION}${suffix}` |
| 62 | } |
| 63 | |
| 64 | // User-Agent for WebFetch requests to arbitrary sites. `Claude-User` is |
| 65 | // Anthropic's publicly documented agent for user-initiated fetches (what site |