gmail
Gmail MCP Server - Email management for AI assistants. Send, search, organize emails with labels and filters. OAuth2 auth, batch operations, attachments. Works with Claude, Gemini, Cursor.
claude mcp add --transport stdio pouyanafisi-gmail-mcp node /absolute/path/to/gmail-mcp/dist/index.js \ --env GMAIL_CLIENT_ID="OAuth2 Client ID (optional if using credentials file)" \ --env GMAIL_CLIENT_SECRET="OAuth2 Client Secret (optional if using credentials file)" \ --env GMAIL_CREDENTIALS_DIR="Directory to store credentials (e.g., ~/.gmail-mcp/)" \ --env GMAIL_OAUTH_CREDENTIALS="Path to OAuth credentials JSON or file location"
How to use
The Gmail MCP server provides programmatic access to Google’s Gmail API through OAuth2 authentication, enabling you to send emails, manage labels, create filters, and handle attachments via your IDE’s AI assistants. It exposes a set of 19 operations categorized into Email Operations, Label Management, and Filter Management, allowing you to perform tasks such as sending and drafting emails, reading messages with MIME parsing, applying labels, and creating Gmail filters. This server is designed to integrate with Cursor Cloud Geminis and similar IDE integrations, so you can manage Gmail directly from your development environment using natural language prompts or structured API calls.
To use it, install the MCP server package, build the project, and configure the MCP setup for your IDE. After authentication with Gmail, you can invoke operations like sending an email, searching for messages, or batch-modifying labels through your IDE’s command palette or chat interface. The integration supports proactive suggestions and transparent feedback, so you can see exactly which Gmail actions were performed and handle errors gracefully.
How to install
Prerequisites:
- Node.js 18.0.0+ and npm
- A Google Cloud Project with Gmail API enabled
- OAuth 2.0 credentials (Desktop or Web application) and a credentials JSON file
Step-by-step installation:
- Install Node.js and npm from the official Node.js website if not already installed.
- Clone the repository: git clone https://github.com/pouyanafisi/gmail-mcp.git cd gmail-mcp
- Install dependencies: npm install
- Build the project (TypeScript to JavaScript): npm run build
- Run the setup to configure MCP for your IDE (Cursor IDE in quick-start example): npm run setup
- Authenticate with Gmail: npm run auth
- Start the MCP server using the Node entry point (adjust the path as needed): node dist/index.js
Optional local/global npm install:
- Global install (recommended for CLI access): npm install -g @pouyanafisi/gmail-mcp
- Local install (per-project): npm install @pouyanafisi/gmail-mcp
Additional notes
Environment and configuration tips:
- Ensure Gmail API is enabled and OAuth credentials are correctly configured. Credentials can be saved to ~/.gmail-mcp/credentials.json and auto-refreshed.
- If using source installation, the MCP entry point is typically dist/index.js after a successful npm run build. Update the path in mcp_config accordingly.
- For IDE integration, the setup command will generate platform-specific instructions and verify credentials. If you encounter authentication issues, re-run npm run auth or inspect the credentials file location.
- When running in cloud environments, configure a callback URL appropriate to your deployment and provide it during the auth flow.
- The server supports both global and local npm installation modes; adjust the mcp_config command and args accordingly (npx usage for local installs).
- Keep Node.js updated to match the required version to ensure compatibility with TypeScript output and Gmail API client libraries.
Related MCP Servers
Pare
Dev tools, optimized for agents. Structured, token-efficient MCP servers for git, test runners, npm, Docker, and more.
taskflow
A task management Model Context Protocol (MCP) server that helps AI assistants break down user requests into manageable tasks with subtasks, dependencies, and notes. Enforces a structured workflow with user approval steps.
kratos
🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
spec-kit
MCP server enabling AI assistants to use GitHub's spec-kit methodology
cursor-feedback-extension
Save your Cursor monthly quota! Unlimited AI interactions in one conversation via MCP feedback loop.
shodan
Shodan MCP server for Claude, Cursor & VS Code. 20 tools for passive reconnaissance, CVE/CPE intelligence, DNS analysis, and device search. 4 tools work free without an API key. OSINT and vulnerability research from your IDE.