Skip to content

feat: Gmail API Integration (read, compose, send) - v3.2.0 #28

@AojdevStudio

Description

@AojdevStudio

Summary

Add Gmail email functionality to the gdrive MCP server following the established operation-based architecture pattern. This includes 12 Gmail operations, documentation updates, and technical debt cleanup.

Spec File: specs/gmail-integration-and-tech-debt.md
Plan File: Available in repo
Target Version: v3.2.0


Scope Decisions (Approved)

Feature Decision
Send-as (aliases) YES - from parameter in sendMessage
Signatures YES - getSignature operation
Draft scheduling YES - scheduleSend operation
Attachments DEFER - Skip for simplicity
Calendar API FUTURE - Not this version

Gmail Operations (12 total)

Operation Description Priority
listMessages List messages with filters P0
listThreads List email threads P0
getMessage Get full message content P0
getThread Get full thread P0
searchMessages Gmail query syntax search P0
createDraft Create email draft P0
sendMessage Send email (with send-as) P0
sendDraft Send existing draft P0
scheduleSend Schedule draft for later P1
listLabels List all labels P1
modifyLabels Add/remove labels P1
getSignature Get email signature P1

Files to Create

```
src/modules/gmail/
├── index.ts # Barrel exports
├── types.ts # Gmail interfaces
├── list.ts # listMessages, listThreads
├── read.ts # getMessage, getThread
├── search.ts # searchMessages
├── compose.ts # createDraft
├── send.ts # sendMessage, sendDraft, scheduleSend
├── labels.ts # listLabels, modifyLabels
└── signature.ts # getSignature
```


Files to Modify

  • index.ts - Add OAuth scopes, gmail tool registration, dispatch handler
  • src/modules/types.ts - Add GmailContext
  • src/tools/listTools.ts - Add Gmail to gdrive://tools
  • README.md - Gmail documentation
  • CLAUDE.md - Architecture updates
  • docs/Developer-Guidelines/API.md - Gmail API reference
  • package.json - Version bump to 3.2.0

OAuth Scopes to Add

```typescript
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.settings.basic", // For signatures
```

Note: Users will need to re-authenticate after upgrade.


Tech Debt Cleanup (Part of this issue)

  • Remove deprecated code in src/tools/listTools.ts:147
  • Delete skipped tests in src/__tests__/integration/addQuestion-integration.test.ts
  • Archive legacy handlers (src/drive/, src/sheets/, src/forms/, src/docs/)
  • Run ESLint --fix

Success Criteria

  • 12 Gmail operations functional
  • Send-as working with aliases
  • Signature retrieval working
  • Draft scheduling working
  • All docs updated
  • Tech debt items resolved
  • 90%+ test coverage on new code
  • No breaking changes to existing tools

Implementation Notes

Follow existing architecture pattern:

  • Single gmail tool with operation parameter (like drive, sheets, forms, docs)
  • Module structure in src/modules/gmail/
  • Shared context pattern with GmailContext
  • Progressive disclosure via gdrive://tools resource

See full spec at specs/gmail-integration-and-tech-debt.md

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions