UNPKG

@ankimcp/anki-mcp-server

Version:

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

63 lines (62 loc) • 1.96 kB
export interface TunnelMessage { type: string; [key: string]: unknown; } export interface TunnelEstablishedMessage extends TunnelMessage { type: "tunnel_established"; url: string; } export interface TunnelRequestMessage extends TunnelMessage { type: "request"; requestId: string; method: string; path: string; headers: Record<string, string>; body?: string; } export interface TunnelPingMessage extends TunnelMessage { type: "ping"; timestamp: number; } export interface TunnelErrorMessage extends TunnelMessage { type: "error"; code: string; message: string; details?: unknown; } export type ServerMessage = TunnelEstablishedMessage | TunnelRequestMessage | TunnelPingMessage | TunnelErrorMessage; export interface TunnelResponseMessage extends TunnelMessage { type: "response"; requestId: string; statusCode: number; headers: Record<string, string>; body?: string; } export interface TunnelPongMessage extends TunnelMessage { type: "pong"; timestamp: number; } export type ClientMessage = TunnelResponseMessage | TunnelPongMessage; export declare const TunnelCloseCodes: { readonly NORMAL: 1000; readonly GOING_AWAY: 1001; readonly AUTH_FAILED: 4001; readonly TOKEN_REVOKED: 4002; readonly TUNNEL_AUTH_FAILED: 4003; readonly ACCOUNT_DELETED: 4004; readonly SESSION_REPLACED: 4005; readonly URL_REGENERATED: 4006; readonly SERVICE_UNAVAILABLE: 4008; readonly SHUTDOWN: 4009; readonly IDLE_TIMEOUT: 4010; }; export type TunnelCloseCode = (typeof TunnelCloseCodes)[keyof typeof TunnelCloseCodes]; export declare const TUNNEL_DEFAULTS: { readonly CONNECTION_TIMEOUT: 10000; readonly REQUEST_TIMEOUT: 25000; readonly HEARTBEAT_INTERVAL: 30000; readonly HEARTBEAT_TIMEOUT: 10000; readonly RECONNECT_INITIAL_DELAY: 1000; readonly RECONNECT_MAX_DELAY: 30000; readonly RECONNECT_MAX_ATTEMPTS: 10; };