Package Exports
- @techsend/gmail-mcp-server
- @techsend/gmail-mcp-server/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@techsend/gmail-mcp-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Gmail MCP Server v2.0
A comprehensive Model Context Protocol (MCP) server for Gmail with 25+ tools and AI-powered features.
Quick Start
npx @yourusername/gmail-mcp-serverInstallation
Prerequisites
- Node.js 18+ installed
- Google Cloud OAuth credentials
- OpenRouter API key (for AI features)
Step 1: Get Google OAuth Credentials
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Gmail API
- Go to Credentials โ Create Credentials โ OAuth Client ID
- Choose Desktop app
- Download the JSON file
- Rename it to
credentials.json
Step 2: Get OpenRouter API Key
- Visit OpenRouter
- Sign up and get your API key
- Copy the key (starts with
sk-or-...)
Step 3: Configure Your IDE
Add this to your MCP settings (.vscode/settings.json or ~/.cursor/mcp.json):
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": ["@yourusername/gmail-mcp-server"],
"env": {
"OPENROUTER_API_KEY": "sk-or-your-key-here"
}
}
}
}Step 4: Add Credentials
Place your credentials.json in your home directory:
- Windows:
C:\Users\YourName\.gmail-mcp\credentials.json - Mac/Linux:
~/.gmail-mcp/credentials.json
Step 5: First Run
When you first use a Gmail tool in your IDE, a browser window will open:
- Log in with your Google account
- Grant the requested permissions
- Close the tab
You're all set! ๐
Features
๐ง Email Operations (15 tools)
search_emails- Search with Gmail syntaxread_email- Read full contentsend_email- Send new emails (CC/BCC support)reply_to_email- Reply to emailsforward_email- Forward emailstrash_email/untrash_email- Trash managementdelete_email- Permanent deletionarchive_email- Archive emailsmark_as_read/mark_as_unread- Read statusstar_email/unstar_email- Star management
๐งต Thread Operations (2 tools)
get_thread- Get full conversationlist_threads- List matching threads
๐ท๏ธ Label Management (5 tools)
list_labels- Get all labelscreate_label/delete_label- Manage labelsadd_labels_to_email/remove_labels_from_email- Apply labels
๐ Draft Operations (4 tools)
list_drafts- List all draftscreate_draft- Create new draftdelete_draft- Delete draftsend_draft- Send draft
๐ค AI-Powered (1 tool)
summarize_email- Summarize with Gemini 2.5
๐ Utilities (2 tools)
get_profile- User profileget_unread_count- Count unread
Usage Examples
In Your IDE
Just ask naturally:
- "Find emails from john@example.com this week"
- "Reply to the last email saying I'll be there"
- "Star all unread emails from my boss"
- "Create a draft thanking Alice for the meeting"
- "Summarize that long newsletter email"
Required OAuth Scopes
The server requests these Gmail permissions:
gmail.readonly- Read emailsgmail.modify- Modify emails (labels, read status)gmail.compose- Send emails and draftsgmail.labels- Manage labels
Configuration Options
Environment Variables
You can also use a .env file in your project:
OPENROUTER_API_KEY=sk-or-your-key-hereCustom Credentials Path
Set the path to your credentials:
{
"env": {
"GMAIL_CREDENTIALS_PATH": "/path/to/credentials.json"
}
}Troubleshooting
"OAuth keys not found"
- Ensure
credentials.jsonis in~/.gmail-mcp/or setGMAIL_CREDENTIALS_PATH
"OPENROUTER_API_KEY not found"
- Add the key to your MCP config's
envblock
"Permission denied"
- Delete the token file and re-authenticate:
- Windows:
C:\Users\YourName\.gmail-mcp\token.json - Mac/Linux:
~/.gmail-mcp/token.json
- Windows:
Development
Clone and build locally:
git clone https://github.com/yourusername/gmail-mcp-server
cd gmail-mcp-server
npm install
npm run build
npm linkContributing
Contributions welcome! Please open an issue or PR.
License
MIT - see LICENSE file
Support
- Issues: GitHub Issues
- Docs: Full Documentation
Made with โค๏ธ for the MCP community