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.
86 lines • 2.77 kB
TypeScript
import { gmail_v1 } from 'googleapis';
import { EmailAttachment, LargeAttachmentConfig, AttachmentProcessingResult, AttachmentDownloadOptions } from './types.js';
export declare class LargeAttachmentHandler {
private config;
private gmail;
constructor(gmail: gmail_v1.Gmail, config?: Partial<LargeAttachmentConfig>);
private ensureTempDir;
/**
* Process attachments for sending, handling large files appropriately
*/
processAttachmentsForSending(attachments: EmailAttachment[]): Promise<AttachmentProcessingResult[]>;
private processAttachment;
/**
* Create Gmail attachment parts for large files using streaming
*/
createAttachmentParts(results: AttachmentProcessingResult[]): Promise<gmail_v1.Schema$MessagePart[]>;
private createLargeAttachmentPart;
private createSmallAttachmentPart;
/**
* Download attachment with streaming support for large files
*/
downloadAttachment(options: AttachmentDownloadOptions): Promise<Buffer | string>;
/**
* Download attachment and save to local downloads directory with auto-generated path
*/
downloadAttachmentToLocal(messageId: string, attachmentId: string, customPath?: string): Promise<{
filePath: string;
filename: string;
size: number;
contentType: string;
}>;
/**
* Ensure directory exists
*/
private ensureDirectory;
private streamToFile;
/**
* Clean up temporary files
*/
cleanup(results: AttachmentProcessingResult[]): Promise<void>;
/**
* Get attachment info without downloading
*/
getAttachmentInfo(messageId: string, attachmentId: string): Promise<{
filename: string;
size: number;
contentType: string;
}>;
private findAttachmentInMessage;
private extractFilename;
private extractContentType;
private generateAttachmentId;
/**
* Validate attachment size and type
*/
validateAttachment(attachment: EmailAttachment): {
valid: boolean;
error?: string;
};
/**
* List all downloaded attachments in the downloads directory
*/
listDownloadedAttachments(downloadsDir?: string): Promise<Array<{
filename: string;
filePath: string;
size: number;
downloadDate: Date;
fileUrl: string;
}>>;
/**
* Clean up old downloaded attachments
*/
cleanupOldDownloads(maxAgeMs?: number, downloadsDir?: string): Promise<{
cleaned: number;
errors: string[];
}>;
/**
* Get memory usage statistics
*/
getMemoryStats(): {
heapUsed: number;
heapTotal: number;
external: number;
};
}
//# sourceMappingURL=attachment-handler.d.ts.map