UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

113 lines (112 loc) 2.99 kB
export interface OAuthClient { client_id: string; client_secret?: string; redirect_uris: string[]; grant_types?: string[]; response_types?: string[]; scopes?: string[]; } export interface AccessToken { token: string; clientId: string; scopes: string[]; expiresAt?: Date; refreshToken?: string; } export interface OAuthEndpoints { authorizationUrl: string; tokenUrl: string; revocationUrl?: string; userInfoUrl?: string; registerUrl: string; } export interface OAuthError { error: string; error_description?: string; error_uri?: string; } export interface TokenResponse { access_token: string; token_type: string; expires_in?: number; refresh_token?: string; scope?: string; } export interface OAuthStorage { tokens: TokenStorage; } export interface TokenStorage { getToken(token: string): Promise<AccessToken | null>; saveToken(token: AccessToken): Promise<void>; deleteToken(token: string): Promise<void>; deleteTokensByClient(clientId: string): Promise<void>; } export interface ProxyOAuthProviderConfig { endpoints: OAuthEndpoints; storage?: OAuthStorage; verifyAccessToken?: (token: string) => Promise<AccessToken>; issuerUrl?: string; defaultScopes?: string[]; } export interface OAuthRouterConfig { provider: ProxyOAuthServerProvider; issuerUrl: URL; baseUrl: URL; serviceDocumentationUrl?: URL; pathPrefix?: string; } export interface ProxyOAuthServerProvider { verifyAccessToken(token: string): Promise<AccessToken>; authorize(params: AuthorizeParams): Promise<string>; token(params: TokenParams): Promise<TokenResponse>; revoke(params: RevokeParams): Promise<void>; readonly endpoints: OAuthEndpoints; } export interface AuthorizeParams { response_type: string; client_id: string; redirect_uri: string; scope?: string; state?: string; code_challenge: string; code_challenge_method: string; } export interface TokenParams { grant_type: string; client_id: string; client_secret?: string; code?: string; redirect_uri?: string; refresh_token?: string; code_verifier?: string; } export interface RevokeParams { token: string; token_type_hint?: string; client_id?: string; client_secret?: string; } export interface OAuthConfigOptions { endpoints: { authorizationUrl: string; tokenUrl: string; revocationUrl?: string; userInfoUrl?: string; registerUrl: string; }; issuerUrl: string; baseUrl: string; serviceDocumentationUrl?: string; pathPrefix?: string; defaultScopes?: string[]; } export interface OAuthProxyConfig { endpoints: OAuthEndpoints; issuerUrl: string; baseUrl: string; serviceDocumentationUrl?: string; pathPrefix?: string; storage?: OAuthStorage; verifyAccessToken?: (token: string) => Promise<any>; defaultScopes?: string[]; }