Model Context Protocol server enabling AI assistants to seamlessly integrate with Gmail and Calendar APIs for advanced email management, draft handling, event scheduling, search filtering, and secure OAuth2 authentication.
Unlock the full potential of Gmail MCP Server through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.
Free tier available • No credit card required
A Model Context Protocol (MCP) server implementation for Gmail API integration, enabling AI assistants to interact with Gmail services.
Clone and install dependencies:
git clone [repository-url] cd gmail-mcp-server npm install
Configure environment:
# Create .env file cp .env.example .env # Add your credentials: GOOGLE_CLIENT_ID="your_client_id" GOOGLE_CLIENT_SECRET="your_client_secret" REDIRECT_URI="http://localhost:4100/code" GOOGLE_REFRESH_TOKEN="your_refresh_token"
Build and run:
npm run build npm start
npm run dev
- Build and run with watch modenpm run build
- Build the projectnpm run clean
- Clean build artifactsnpm run watch
- Watch for changesgmail-mcp-server/
├── src/
│ ├── config/ # Configuration and setup
│ ├── services/ # Core business logic
│ │ ├── gmail/ # Gmail services
│ │ └── calendar/ # Calendar services
│ ├── tools/ # MCP tool implementations
│ │ ├── calendar/ # Calendar tools
│ │ ├── drafts/ # Draft management tools
│ │ └── messages/ # Email tools
│ ├── types/ # TypeScript definitions
│ └── index.ts # Server entry point
├── dist/ # Compiled JavaScript
└── tests/ # Test files (pending)
listEmails({ maxResults?: number, // Default: 10 query?: string, // Gmail search query labelIds?: string[], // Filter by labels verbose?: boolean // Include details })
readEmail({ messageId: string // Message ID to fetch })
// List Drafts listDrafts({ maxResults?: number, // Default: 10 query?: string, // Search query verbose?: boolean // Include details }) // Read Draft readDraft({ draftId: string // Draft ID to fetch }) // Create Draft draftEmail({ to: string[], subject: string, body: string, cc?: string[], bcc?: string[], isHtml?: boolean }) // Update Draft updateDraft({ draftId: string, // Draft ID to update to?: string[], // New recipients cc?: string[], // New CC recipients bcc?: string[], // New BCC recipients subject?: string, // New subject body?: string, // New body content isHtml?: boolean // Content type flag }) // Delete Draft deleteDraft({ draftId: string // Draft ID to delete })
sendEmail({ to: string[], subject: string, body: string, cc?: string[], bcc?: string[], isHtml?: boolean, draftId?: string // Optional: send existing draft })
// List Events listEvents({ maxResults?: number, // Default: 25 timeMin?: string, // Start time (ISO 8601) timeMax?: string, // End time (ISO 8601) query?: string, // Text search term timeZone?: string // Default: Australia/Brisbane }) // Read Event Details readEvent({ eventId: string, // Event ID to fetch details timeZone?: string // Default: Australia/Brisbane }) // Create Event createEvent({ summary: string, // Event title start: { dateTime: string, // ISO 8601 start time timeZone?: string // Start time timezone }, end: { dateTime: string, // ISO 8601 end time timeZone?: string // End time timezone }, description?: string, // Optional event description location?: string, // Optional event location attendees?: Array, status?: 'confirmed' | 'tentative' | 'cancelled', sendNotifications?: boolean })
The server implements comprehensive error handling for:
Please see CONTRIBUTING.md for guidelines.
See CHANGELOG.md for version history and updates.
See Backlog.md for planned features and improvements.
MIT License - see LICENSE for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!