Labsco
j3k0 logo

Google Workspace

β˜… 31

from j3k0

Interact with Google Workspace services like Gmail and Google Calendar.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

MCP Google Workspace Server

A Model Context Protocol server for Google Workspace services. This server provides tools to interact with Gmail and Google Calendar through the MCP protocol.

Features

  • Multiple Google Account Support

    • Use and switch between multiple Google accounts
    • Each account can have custom metadata and descriptions
  • Gmail Integration

    • Query emails with advanced search
    • Read full email content and attachments
    • Create and manage drafts
    • Reply to emails
    • Archive emails
    • Handle attachments
    • Bulk operations support
  • Calendar Integration

    • List available calendars
    • View calendar events
    • Create new events
    • Delete events
    • Support for multiple calendars
    • Custom timezone support

Example Prompts

Try these example prompts with your AI assistant:

Gmail

  • "Retrieve my latest unread messages"
  • "Search my emails from the Scrum Master"
  • "Retrieve all emails from accounting"
  • "Take the email about ABC and summarize it"
  • "Write a nice response to Alice's last email and upload a draft"
  • "Reply to Bob's email with a Thank you note. Store it as draft"

Calendar

  • "What do I have on my agenda tomorrow?"
  • "Check my private account's Family agenda for next week"
  • "I need to plan an event with Tim for 2hrs next week. Suggest some time slots"

Available Tools

Account Management

  1. gmail_list_accounts / calendar_list_accounts
    • List all configured Google accounts
    • View account metadata and descriptions
    • No user_id required

Gmail Tools

  1. gmail_query_emails

    • Search emails with Gmail's query syntax (e.g., 'is:unread', 'from:example@gmail.com', 'newer_than:2d', 'has:attachment')
    • Returns emails in reverse chronological order
    • Includes metadata and content summary
  2. gmail_get_email

    • Retrieve complete email content by ID
    • Includes full message body and attachment info
  3. gmail_bulk_get_emails

    • Retrieve multiple emails by ID in a single request
    • Efficient for batch processing
  4. gmail_create_draft

    • Create new email drafts
    • Support for CC recipients
  5. gmail_delete_draft

    • Delete draft emails by draft_id
    • Note: draft_id is distinct from the message ID returned by gmail_query_emails. Use gmail_list_drafts to obtain it.
  6. gmail_list_drafts

    • List Gmail drafts, optionally filtered by a Gmail search query
    • Returns each draft's draft_id (required for gmail_delete_draft) alongside its message_id, subject, recipients, and snippet
  7. gmail_reply

    • Reply to existing emails
    • Option to send immediately or save as draft
    • Support for "Reply All" via CC
  8. gmail_get_attachment

    • Download email attachments
    • Save to disk or return as embedded resource
  9. gmail_bulk_save_attachments

    • Save multiple attachments in a single operation
  10. gmail_archive / gmail_bulk_archive

    • Move emails out of inbox
    • Support for individual or bulk operations

Calendar Tools

  1. calendar_list

    • List all accessible calendars
    • Includes calendar metadata, access roles, and timezone information
  2. calendar_get_events

    • Retrieve events in a date range
    • Support for multiple calendars
    • Filter options (deleted events, max results)
    • Timezone customization
  3. calendar_create_event

    • Create new calendar events
    • Support for attendees and notifications
    • Location and description fields
    • Timezone handling
  4. calendar_delete_event

    • Delete events by ID
    • Option for cancellation notifications

Development

  • Source code is in TypeScript under the src/ directory
  • Build output goes to dist/ directory
  • Uses ES modules for better modularity
  • Follows Google API best practices

Project Structure

Copy & paste β€” that's it
mcp-google-workspace/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ server.ts           # Main server implementation
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── gauth.ts        # Google authentication service
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ gmail.ts        # Gmail tools implementation
β”‚   β”‚   └── calendar.ts     # Calendar tools implementation
β”‚   └── types/
β”‚       └── tool-handler.ts # Common types and interfaces
β”œβ”€β”€ .gauth.json             # OAuth2 credentials
β”œβ”€β”€ .accounts.json          # Account configuration
β”œβ”€β”€ package.json            # Project dependencies
└── tsconfig.json           # TypeScript configuration

Development Commands

  • npm run build: Build TypeScript code
  • npm start: Start the server
  • npm run dev: Start in development mode with auto-reload

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License - see LICENSE file for details