How prabud0401/google-mcp works
Google MCP Server exposes Gmail operations to MCP-compatible clients over stdio. The principal workflow is a client tool request routed through the MCP server and tool dispatcher to Gmail operations, which authenticate and call the Gmail API before returning results. The service covers message listing, search, reading, sending, labels, drafts, and attachment downloads; MIME helpers decode message content. A separate CLI supports OAuth authorization. Source excerpts show these calls and credential handling; other capabilities are represented from the README, not unsampled implementation details.
Main entry points: auth.ts OAuth and Gmail Client · tools.ts Tool Dispatcher · service.ts Read and Search · config.ts Credential Configuration
Components 14
MCP Interface
- Stdio MCP Server
src/index.ts - Tool Dispatcher
src/tools.ts
Gmail Operations
- Read and Search
src/gmail/service.ts - Send and Draft
src/gmail/service.ts - Label Operations
src/gmail/service.ts - Attachment Download
src/gmail/service.ts - MIME Parsing
src/gmail/mime.ts
Authentication
- OAuth CLI
src/auth-cli.ts - OAuth and Gmail Client
src/auth.ts - Credential Configuration
src/config.ts
Data Models
- Gmail Data Types
src/gmail/types.ts
Other components
- MCP Client
- Gmail API
- Credential Files
Connections 23
- MCP Client → Stdio MCP Server: sends JSON-RPC
README.md - Stdio MCP Server → Tool Dispatcher: dispatches tools
src/index.ts - Tool Dispatcher → Read and Search: calls read/search
src/tools.ts - Tool Dispatcher → Send and Draft: calls send/draft
src/tools.ts - Tool Dispatcher → Label Operations: calls label tools
src/tools.ts - Tool Dispatcher → Attachment Download: calls download
src/tools.ts - Read and Search → OAuth and Gmail Client: gets client
src/gmail/service.ts - Send and Draft → OAuth and Gmail Client: gets client
src/gmail/service.ts - Label Operations → OAuth and Gmail Client: gets client
src/gmail/service.ts - Attachment Download → OAuth and Gmail Client: gets client
src/gmail/service.ts - Read and Search → Gmail API: reads messages
src/gmail/service.ts - Send and Draft → Gmail API: sends messages
src/gmail/service.ts - Label Operations → Gmail API: manages labels
src/gmail/service.ts - Attachment Download → Gmail API: fetches attachments
src/gmail/service.ts - Read and Search → MIME Parsing: parses MIME
src/gmail/service.ts - MIME Parsing → Gmail Data Types: uses attachment type
src/gmail/mime.ts - Read and Search → Gmail Data Types: returns message types
src/gmail/service.ts - OAuth CLI → OAuth and Gmail Client: creates OAuth client
src/auth-cli.ts - OAuth CLI → Credential Configuration: gets credential path
src/auth-cli.ts - OAuth and Gmail Client → Credential Configuration: loads OAuth config
src/auth.ts - OAuth and Gmail Client → Credential Files: reads and writes tokens
src/auth.ts - Credential Configuration → Credential Files: resolves file paths
src/config.ts - OAuth and Gmail Client → Gmail API: creates authenticated client
src/auth.ts