UNPKG

@ankimcp/anki-mcp-server

Version:

Model Context Protocol server for Anki - enables AI assistants to interact with your Anki flashcards

47 lines (46 loc) • 1.46 kB
import { AppConfigService } from "../app-config.service.js"; export interface DeviceCodeResponse { device_code: string; user_code: string; verification_uri: string; verification_uri_complete?: string; expires_in: number; interval: number; } export interface TokenResponse { access_token: string; token_type: string; expires_in: number; refresh_token: string; user: { id: string; email: string; tier: "free" | "paid"; }; } export interface DeviceFlowErrorResponse { error: "authorization_pending" | "slow_down" | "expired_token" | "access_denied" | string; error_description?: string; } export declare class DeviceFlowError extends Error { readonly code: string; readonly description?: string | undefined; constructor(message: string, code: string, description?: string | undefined); } export declare class DeviceFlowService { private readonly config; private readonly client; private readonly logger; private readonly deviceEndpoint; private readonly tokenEndpoint; constructor(config: AppConfigService); requestDeviceCode(): Promise<DeviceCodeResponse>; pollForToken(deviceCode: string, interval: number, expiresIn: number): Promise<TokenResponse>; refreshToken(refreshToken: string): Promise<TokenResponse>; private sleep; private handleError; getConfig(): { tunnelUrl: string; clientId: string; }; }