UNPKG

gmail-mcp-server

Version:

Gmail MCP Server with on-demand authentication for SIYA/Claude Desktop. Complete Gmail integration with multi-user support and OAuth2 security.

100 lines 2.57 kB
import { OAuth2Client } from 'google-auth-library'; export interface GmailCredentials { client_id: string; client_secret: string; redirect_uris: string[]; } export interface StoredToken { access_token: string; refresh_token: string; scope: string; token_type: string; expiry_date: number; } /** * Gmail authentication manager class */ export declare class GmailAuth { private oAuth2Client; private credentials; private activeServer; private activeServerPort; private activeServerTimeout; constructor(); /** * Ensure configuration directory exists */ private ensureConfigDir; /** * Load credentials from file or environment */ loadCredentials(): Promise<boolean>; /** * Save credentials to file */ saveCredentials(credentials: any): Promise<void>; /** * Initialize OAuth2 client */ private initializeOAuth2Client; /** * Load stored access token */ private loadStoredToken; /** * Save access token to file */ private saveToken; /** * Find an available port starting from a base port */ private findAvailablePort; /** * Stop any active callback server */ private stopActiveServer; /** * Start local server for OAuth2 callback */ private startCallbackServer; /** * Perform OAuth2 authentication flow */ authenticate(): Promise<OAuth2Client>; /** * Get authenticated Gmail API client */ getGmailClient(): Promise<import("googleapis").gmail_v1.Gmail>; /** * Prompt user for credentials setup */ setupCredentials(): Promise<void>; /** * Check if user credentials are configured */ isConfigured(): Promise<boolean>; /** * Check if user is currently authenticated (has valid tokens) */ isAuthenticated(): Promise<boolean>; /** * Reset authentication (clear stored tokens) */ resetAuth(): void; /** * Get authentication URL without starting the full authentication flow * This allows for manual authentication control */ getAuthUrl(): Promise<string>; /** * Complete manual authentication flow * Call this after user has visited the auth URL to finalize authentication */ completeManualAuth(): Promise<boolean>; /** * Reset cached OAuth2Client (called when switching accounts) */ resetClient(): void; } export declare const gmailAuth: GmailAuth; //# sourceMappingURL=gmail-auth.d.ts.map