gmail-labels-mcp-server

gmail-labels-mcp-server

Enables Gmail label management with tools to list, create, delete labels, and modify labels on messages and threads, handling OAuth2 authentication automatically.

Category
Visit Server

README

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
gmail_list_labels List all labels with IDs, names, and message counts
gmail_create_label Create a new label (supports nesting with /)
gmail_delete_label Delete a user-created label
gmail_get_message_labels Get current labels on a specific message
gmail_modify_message_labels Add/remove labels on a specific message
gmail_modify_thread_labels Add/remove labels on an entire thread
gmail_bulk_label_by_search Search messages and bulk apply label changes

Setup

1. Create a Google Cloud project and enable the Gmail API

  1. Go to the Google Cloud Console
  2. Create a new project (or select an existing one)
  3. Navigate to APIs & Services > Library
  4. Search for Gmail API and click Enable

2. Create OAuth2 credentials

  1. Go to APIs & Services > Credentials
  2. Click Create Credentials > OAuth Client ID
  3. 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
  4. Select Desktop app as the application type
  5. Give it a name (e.g. "Gmail Labels MCP")
  6. 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 --auth

Option 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 auth

This 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-server

Or if installed from source:

claude mcp add gmail-labels -- node /path/to/gmail-labels-mcp-server/dist/index.js

Claude 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, UNREAD
  • User label IDs follow the format Label_XXXXXXXXXX
  • Use gmail_list_labels first to discover label IDs before modifying messages
  • "Mark as read" = remove UNREAD label; "Mark as unread" = add UNREAD label
  • To re-authenticate: delete ~/.gmail-labels-mcp/credentials.json and re-run the auth step

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured