MCP Implementation for Gmail Services
Configuration
View docs{
"mcpServers": {
"hitmanly007-gmail-mcp": {
"command": "npx",
"args": [
"-y",
"@shinzolabs/gmail-mcp"
],
"env": {
"PORT": "3000",
"CLIENT_ID": "YOUR_CLIENT_ID",
"CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"REFRESH_TOKEN": "YOUR_REFRESH_TOKEN",
"MCP_CONFIG_DIR": "~/.gmail-mcp",
"AUTH_SERVER_PORT": "3000",
"GMAIL_OAUTH_PATH": "MCP_CONFIG_DIR/gcp-oauth.keys.json",
"GMAIL_CREDENTIALS_PATH": "MCP_CONFIG_DIR/credentials.json"
}
}
}
}This MCP server provides a standardized interface to manage Gmail data and actions through the Gmail API. It covers messages, threads, labels, drafts, settings, and more, enabling you to interact with Gmail from your MCP-enabled client with consistent, scalable operations.
You connect to the Gmail MCP server from your MCP client to perform common email tasks. Use the available endpoints to list and read messages, manage threads and labels, compose and send emails, handle drafts, and adjust settings such as forwarding, language, and vacation responders. The server handles authentication via Google Cloud credentials and exposes a set of organized endpoints so your agent can work with Gmail in a uniform way.
Prerequisites: you need Node.js and a package manager installed on your system. You can run the server locally, or connect to a remote MCP host.
Option A — NPX local install (quick start) This installs the MCP server for use directly from the npm registry.
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"@shinzolabs/gmail-mcp"
]
}
}
}Option B — Build from source (requires cloning the repo, installing dependencies, and building) This is used when you want to run the server from your own build artifacts.
# Step 1: Clone the repository
git clone https://github.com/shinzo-labs/gmail-mcp.git
# Step 2: Install dependencies and build
pnpm i && pnpm build
# Step 3: Run from the built artifact
# After building, configure your client to start the compiled serverConfiguration for running from a built artifact (example) This starts the server using Node with the generated index in dist.
{
"mcpServers": {
"gmail": {
"command": "node",
"args": [
"/path/to/gmail-mcp/dist/index.js"
]
}
}
}The Gmail MCP server relies on OAuth credentials stored on your system. You configure an MCP client to connect either via a remote HTTP endpoint (if you have a hosted MCP server) or by running the server locally through NPX or a built artifact.
Key prerequisites include setting up a Google API project, enabling the Gmail API, and obtaining OAuth credentials. The service uses these credentials to securely access Gmail data and perform actions on behalf of users.
Protect your OAuth client IDs, client secrets, and refresh tokens. Do not share credentials publicly. Use secure storage paths and restrict access to credentials to authorized users and processes.
If you encounter authentication errors, verify that the OAuth credentials are correctly placed at the expected path and that refresh tokens are valid. Check that the MCP client has the necessary scopes for Gmail operations and that your environment variables (if used) are set correctly. Ensure the Gmail API is enabled for your Google Cloud project.
List messages with optional filtering to locate specific emails.
Retrieve a specific Gmail message by ID.
Fetch an attachment from a message.
Modify labels or other metadata on a message.
Send an email to specified recipients.
Permanently delete a message.
Move a message to trash.
Restore a trashed message.
Apply changes to multiple messages in a single operation.
Delete multiple messages in a single operation.
List all labels in the user's mailbox.
Get details about a specific label.
Create a new label.
Update an existing label.
Partially update a label.
Delete a label.
List email threads.
Get a specific thread.
Modify thread labels.
Move a thread to trash.
Restore a trashed thread.
Delete a thread.
List drafts in the mailbox.
Get a draft by ID.
Create a new draft.
Replace a draft's content.
Delete a draft.
Send an existing draft.
Get auto-forwarding settings.
Update auto-forwarding settings.
Get IMAP settings.
Update IMAP settings.
Get POP settings.
Update POP settings.
Get vacation responder settings.
Update vacation responder.
Get language settings.
Update language settings.
List account delegates.
Get a specific delegate.
Add a delegate.
Remove a delegate.
List email filters.
Get a specific filter.
Create a new filter.
Delete a filter.
List forwarding addresses.
Get a specific forwarding address.
Create a forwarding address.
Delete a forwarding address.
List send-as aliases.
Get a specific send-as alias.
Create a send-as alias.
Update a send-as alias.
Partial update of a send-as alias.
Send verification email.
Delete a send-as alias.
List S/MIME configurations.
Get a specific S/MIME config.
Upload a new S/MIME config.
Set default S/MIME config.
Delete an S/MIME config.