gmail-labels-mcp-server
Provides tools for managing Gmail labels, including listing, creating, deleting labels, and modifying labels on messages and threads.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gmail-labels-mcp-serverlist all my Gmail labels"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail Labels MCP Server
An MCP server for Gmail label management. Fills the gap in the official Gmail MCP connector, which lacks label/tag operations.
Handles OAuth2 automatically — authenticate once, and the server refreshes tokens forever.
Tools
Tool | Description |
| List all labels with IDs, names, and message counts |
| Create a new label (supports nesting with |
| Delete a user-created label |
| Get current labels on a specific message |
| Add/remove labels on a specific message |
| Add/remove labels on an entire thread |
| Search messages and bulk apply label changes |
Related MCP server: Gmail MCP Server
Setup
1. Create a Google Cloud project and enable the Gmail API
Go to the Google Cloud Console
Create a new project (or select an existing one)
Navigate to APIs & Services > Library
Search for Gmail API and click Enable
2. Create OAuth2 credentials
Go to APIs & Services > Credentials
Click Create Credentials > OAuth Client ID
If prompted, configure the OAuth consent screen first:
Choose External user type (or Internal if using Google Workspace)
Fill in the app name (e.g. "Gmail Labels MCP") and your email
Add the scope
https://mail.google.com/Add your email as a test user
Save and go back to creating credentials
Select Desktop app as the application type
Give it a name (e.g. "Gmail Labels MCP")
Click Create and copy the Client ID and Client Secret
3. Install and authenticate
Option A: Install from npm (recommended)
npm install -g gmail-labels-mcp-server
GOOGLE_CLIENT_ID=your_client_id GOOGLE_CLIENT_SECRET=your_client_secret gmail-labels-mcp-server --authOption B: Clone and build from source
git clone https://github.com/YimingYAN/gmail-labels-mcp-server.git
cd gmail-labels-mcp-server
npm install && npm run build
GOOGLE_CLIENT_ID=your_client_id GOOGLE_CLIENT_SECRET=your_client_secret npm run authThis opens a browser for Google consent. Approve Gmail access, and credentials are saved to ~/.gmail-labels-mcp/credentials.json. You only need to do this once.
4. Configure your client
Claude Code
claude mcp add gmail-labels -- npx gmail-labels-mcp-serverOr if installed from source:
claude mcp add gmail-labels -- node /path/to/gmail-labels-mcp-server/dist/index.jsClaude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"gmail-labels": {
"command": "npx",
"args": ["gmail-labels-mcp-server"]
}
}
}No env vars needed — the server reads credentials from ~/.gmail-labels-mcp/credentials.json and auto-refreshes tokens.
Example Usage
"List all my Gmail labels"
"Create a label called 'Crypto/Compliance'"
"Tag message [id] with the Finance label"
"Mark message [id] as read" (removes UNREAD label)
"Archive all emails from newsletter@example.com"
"Star message [id]" (adds STARRED label)
"What labels does message [id] currently have?"
Notes
System label IDs:
INBOX,SENT,TRASH,SPAM,STARRED,IMPORTANT,UNREADUser label IDs follow the format
Label_XXXXXXXXXXUse
gmail_list_labelsfirst to discover label IDs before modifying messages"Mark as read" = remove
UNREADlabel; "Mark as unread" = addUNREADlabelTo re-authenticate: delete
~/.gmail-labels-mcp/credentials.jsonand re-run the auth step
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/YimingYAN/gmail-labels-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server