@emit-ia/gdrive-mcp-server
Version:
Google Drive MCP Server - Model Context Protocol server for Google Drive and Gmail APIs
179 lines • 5.05 kB
TypeScript
/**
* Google Drive Service for MCP Server
*
* This service provides comprehensive Google Drive operations using Service Account
* authentication for reliable, non-expiring access. It includes file management,
* folder operations, sharing/permissions, search, comments, and more.
*/
/**
* Google Drive service class that handles all Drive API operations
*
* Uses Service Account authentication for reliable access without token expiration.
* Provides a complete set of file and folder management operations.
*/
export declare class GoogleDriveService {
private auth;
private drive;
constructor();
/**
* Initialize Service Account authentication for Google Drive
*
* Service Account authentication is preferred over OAuth2 for Google Drive
* because it provides reliable, non-expiring access without user intervention.
*/
private initializeAuth;
/**
* List files and folders in Google Drive
*
* @param args - Search parameters including folder, query, limits, and sharing options
* @returns Promise resolving to file list with metadata
*/
listFiles(args?: any): Promise<{
files: any;
nextPageToken: any;
totalCount: any;
}>;
/**
* Get detailed information about a specific file
*
* @param args - File ID and optional content inclusion flag
* @returns Promise resolving to file metadata and optionally content
*/
getFile(args: {
fileId: string;
includeContent?: boolean;
}): Promise<any>;
/**
* Download file content, handling both regular files and Google Workspace documents
*
* @param args - File ID and optional export format for Google Workspace files
* @returns Promise resolving to file content and metadata
*/
downloadFile(args: {
fileId: string;
format?: string;
}): Promise<{
fileName: any;
mimeType: any;
content: any;
size: any;
}>;
/**
* Upload a new file to Google Drive
*
* @param args - File name, content, MIME type, and optional parent folder
* @returns Promise resolving to uploaded file metadata
*/
uploadFile(args: {
name: string;
content: string;
mimeType?: string;
parentId?: string;
}): Promise<any>;
updateFile(args: {
fileId: string;
name?: string;
content?: string;
mimeType?: string;
}): Promise<any>;
deleteFile(args: {
fileId: string;
permanent?: boolean;
}): Promise<{
success: boolean;
message: string;
}>;
copyFile(args: {
fileId: string;
name?: string;
parentId?: string;
}): Promise<any>;
moveFile(args: {
fileId: string;
newParentId: string;
removeFromParents?: string;
}): Promise<any>;
createFolder(args: {
name: string;
parentId?: string;
}): Promise<any>;
getFolderInfo(args: {
folderId: string;
includeFiles?: boolean;
}): Promise<any>;
shareFile(args: {
fileId: string;
email?: string;
role?: string;
type?: string;
sendNotificationEmail?: boolean;
}): Promise<any>;
getPermissions(args: {
fileId: string;
}): Promise<{
permissions: any;
}>;
removePermission(args: {
fileId: string;
permissionId: string;
}): Promise<{
success: boolean;
message: string;
}>;
search(args?: any): Promise<{
files: any;
query: string;
totalCount: any;
}>;
getRecentFiles(args?: {
maxResults?: number;
daysBack?: number;
}): Promise<{
files: any;
query: string;
totalCount: any;
}>;
getComments(args: {
fileId: string;
includeDeleted?: boolean;
}): Promise<{
comments: any;
}>;
addComment(args: {
fileId: string;
content: string;
anchor?: string;
}): Promise<any>;
getRevisions(args: {
fileId: string;
}): Promise<{
revisions: any;
}>;
getAbout(): Promise<any>;
emptyTrash(): Promise<{
success: boolean;
message: string;
}>;
/**
* Check if a MIME type represents a text file that can be read as content
*
* @param mimeType - The MIME type to check
* @returns True if the file is a readable text file
*/
private isTextFile;
/**
* Check if a file is a Google Workspace document that requires export
*
* @param mimeType - The MIME type to check
* @returns True if the file is a Google Workspace document
*/
private isGoogleWorkspaceFile;
/**
* Get the default export format for Google Workspace files
*
* @param mimeType - The Google Workspace MIME type
* @returns The appropriate export format MIME type
*/
private getDefaultExportFormat;
}
//# sourceMappingURL=google-drive.d.ts.map