| 35 | } |
| 36 | |
| 37 | export function getMCPUserAgent(): string { |
| 38 | const parts: string[] = [] |
| 39 | if (process.env.CLAUDE_CODE_ENTRYPOINT) { |
| 40 | parts.push(process.env.CLAUDE_CODE_ENTRYPOINT) |
| 41 | } |
| 42 | if (process.env.CLAUDE_AGENT_SDK_VERSION) { |
| 43 | parts.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`) |
| 44 | } |
| 45 | if (process.env.CLAUDE_AGENT_SDK_CLIENT_APP) { |
| 46 | parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`) |
| 47 | } |
| 48 | const suffix = parts.length > 0 ? ` (${parts.join(', ')})` : '' |
| 49 | return `claude-code/${MACRO.VERSION}${suffix}` |
| 50 | } |
| 51 | |
| 52 | // User-Agent for WebFetch requests to arbitrary sites. `Claude-User` is |
| 53 | // Anthropic's publicly documented agent for user-initiated fetches (what site |