File size: 928 Bytes
5f40163 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import type {
MCPAuthCredential,
MCPOAuthAuthentication,
} from "@openhands/typescript-client";
export type {
MCPAuthCredential,
MCPOAuthAuthentication,
MCPOAuthState,
} from "@openhands/typescript-client";
export type MCPAuthenticationConfig = MCPOAuthAuthentication;
export type MCPOAuthAuthenticationConfig = MCPOAuthAuthentication;
export type MCPOAuthClientAuthMethod = NonNullable<
MCPOAuthAuthentication["client_auth_method"]
>;
export const MCP_AUTH_STRATEGIES = [
"none",
"api_key",
"bearer",
"basic",
"header",
"oauth2",
] as const;
const isRecord = (value: unknown): value is Record<string, unknown> =>
!!value && typeof value === "object" && !Array.isArray(value);
export const isMcpAuthCredential = (
value: unknown,
): value is MCPAuthCredential =>
isRecord(value) &&
typeof value.strategy === "string" &&
(MCP_AUTH_STRATEGIES as readonly string[]).includes(value.strategy);
|