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.
80 lines • 2.46 kB
TypeScript
import { gmail_v1 } from 'googleapis';
import { EmailMessage, AttachmentDownloadOptions } from './types.js';
export declare class GmailService {
private credentials;
private gmail;
private oauth2Client;
private attachmentHandler;
private readonly SCOPES;
constructor(credentials: {
client_id: string;
client_secret: string;
redirect_uri: string;
});
authenticate(authCode?: string): Promise<string>;
loadSavedTokens(): Promise<boolean>;
private saveTokens;
private initializeServices;
private ensureAuthenticated;
/**
* Send email with improved attachment handling
*/
sendEmail(message: EmailMessage): Promise<string>;
/**
* Download attachment with streaming support
*/
downloadAttachment(options: AttachmentDownloadOptions): Promise<Buffer | string>;
/**
* Download attachment and save to local file system with auto-generated path
*/
downloadAttachmentToLocal(messageId: string, attachmentId: string, customPath?: string): Promise<{
filePath: string;
filename: string;
size: number;
contentType: string;
}>;
/**
* Get attachment information without downloading
*/
getAttachmentInfo(messageId: string, attachmentId: string): Promise<{
filename: string;
size: number;
contentType: string;
}>;
/**
* Search emails with enhanced capabilities
*/
searchEmails(query: string, maxResults?: number): Promise<gmail_v1.Schema$Message[]>;
/**
* Read email by ID
*/
readEmail(messageId: string, format?: 'minimal' | 'full' | 'raw' | 'metadata'): Promise<gmail_v1.Schema$Message>;
/**
* List all downloaded attachments
*/
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;
};
private buildEmailContent;
private buildMultipartEmailWithAttachments;
}
//# sourceMappingURL=gmail-service.d.ts.map