Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

493 B
Raw Blame
import { isIdJagAccessToken } from './id-jag'

export type McpAuthMethod = 'oauth' | 'personal_api_key' | 'id_jag' | 'none' | 'unknown'

export function classifyAuthMethod(token: string | undefined): McpAuthMethod {
    if (!token) {
        return 'none'
    }
    if (token.startsWith('pha_')) {
        return 'oauth'
    }
    if (token.startsWith('phx_')) {
        return 'personal_api_key'
    }
    if (isIdJagAccessToken(token)) {
        return 'id_jag'
    }
    return 'unknown'
}