Skip to main content
Glama
SymbolStar

gmail-mcp

by SymbolStar

Gmail MCP Server

Gmail MCP Server ist ein auf Node.js/TypeScript basierender MCP-stdio-Server, der es OpenClaw ermöglicht, Gmail-E-Mails über das Model Context Protocol zu lesen.

Funktionen

  • Verwendung der Gmail API OAuth 2.0-Autorisierung mit schreibgeschütztem Zugriffsbereich: https://www.googleapis.com/auth/gmail.readonly

  • list_emails: Listet E-Mails im Posteingang auf, unterstützt maxResults und Gmail-query-Filter

  • get_email: Liest Details einer einzelnen E-Mail über die messageId

  • search_emails: Durchsucht E-Mails mithilfe der Gmail-Suchsyntax

  • list_labels: Listet alle Gmail-Labels/Ordner auf

  • Unterstützt den MCP-stdio-Transport zur Verwendung durch OpenClaw

Related MCP server: gmail-mcp

Systemanforderungen

  • Node.js 18 oder höher

  • npm

  • Ein Google-Konto mit Zugriff auf die Gmail API

Installation

npm install
npm run build

Erstellen von OAuth-Anmeldeinformationen in der Google Cloud Console

  1. Öffnen Sie die Google Cloud Console.

  2. Erstellen Sie ein Projekt oder wählen Sie eines aus.

  3. Gehen Sie zu APIs & Services -> Library, suchen Sie nach der Gmail API und aktivieren Sie diese.

  4. Gehen Sie zu APIs & Services -> OAuth consent screen.

  5. Wählen Sie den Benutzertyp. Für den persönlichen Gebrauch wählen Sie normalerweise External.

  6. Geben Sie den Anwendungsnamen, die Support-E-Mail-Adresse des Benutzers und die Kontakt-E-Mail-Adresse des Entwicklers ein.

  7. Fügen Sie im Schritt „Scopes“ die schreibgeschützte Gmail-Berechtigung hinzu: https://www.googleapis.com/auth/gmail.readonly.

  8. Wenn sich die Anwendung im Status „Testing“ befindet, fügen Sie Ihr Gmail-Konto unter „Test users“ hinzu.

  9. Gehen Sie zu APIs & Services -> Credentials.

  10. Klicken Sie auf Create Credentials -> OAuth client ID.

  11. Wählen Sie als Anwendungstyp Desktop app.

  12. Laden Sie nach der Erstellung die JSON-Datei herunter.

Platzieren der credentials.json

Erstellen Sie das Konfigurationsverzeichnis und speichern Sie die heruntergeladene OAuth-JSON-Datei als:

mkdir -p ~/.gmail-mcp
chmod 700 ~/.gmail-mcp
cp /path/to/downloaded/client_secret.json ~/.gmail-mcp/credentials.json
chmod 600 ~/.gmail-mcp/credentials.json

Der endgültige Pfad muss lauten:

~/.gmail-mcp/credentials.json

Ausführen des Autorisierungsprozesses

npm run auth

Das Skript führt folgende Schritte aus:

  • Startet einen temporären lokalen OAuth-Callback-Dienst

  • Öffnet den Browser für die Google-Autorisierung

  • Speichert das Token nach erfolgreicher Autorisierung unter ~/.gmail-mcp/token.json

Falls sich der Browser nicht automatisch öffnet, druckt das Terminal die Autorisierungs-URL aus, die Sie manuell in den Browser kopieren können.

Starten des MCP Servers

npm run start

start verwendet den stdio-Transport und wird normalerweise von OpenClaw als MCP-Server-Unterprozess gestartet; ein manueller Dauerbetrieb ist nicht erforderlich.

Beispiel für die OpenClaw MCP-Konfiguration

Verweisen Sie den Befehl auf den Einstiegspunkt des erstellten Projekts:

{
  "mcpServers": {
    "gmail": {
      "command": "node",
      "args": ["/Volumes/DevDisk/symbol/gmailMCP/dist/src/index.js"]
    }
  }
}

Alternativ können Sie das Projekt im Verzeichnis mit npm starten:

{
  "mcpServers": {
    "gmail": {
      "command": "npm",
      "args": ["run", "start"],
      "cwd": "/Volumes/DevDisk/symbol/gmailMCP"
    }
  }
}

Parameterbeschreibung der Tools

list_emails

Listet E-Mails im Posteingang auf.

{
  "maxResults": 10,
  "query": "from:example@gmail.com newer_than:7d"
}
  • maxResults: Optional, Standard 10, Maximum 50

  • query: Optional, Gmail-Suchsyntax, beschränkt die Suche auf den Posteingang (INBOX)

get_email

Liest Details einer einzelnen E-Mail.

{
  "messageId": "18f..."
}

Die zurückgegebenen Felder enthalten Absender, Empfänger, Betreff, Datum, Labels, Textkörper, HTML-Körper und Metadaten der Anhänge.

Durchsucht Gmail-E-Mails.

{
  "query": "subject:invoice has:attachment newer_than:30d",
  "maxResults": 10
}
  • query: Erforderlich, unterstützt Gmail-Suchsyntax

  • maxResults: Optional, Standard 10, Maximum 50

list_labels

Listet alle Labels/Ordner auf.

{}

Dateispeicherorte

  • OAuth-Anmeldeinformationen: ~/.gmail-mcp/credentials.json

  • OAuth-Token: ~/.gmail-mcp/token.json

  • MCP-Server-Einstiegspunkt: dist/src/index.js

Häufig gestellte Fragen

Fehlende Gmail OAuth-Anmeldeinformationen

Stellen Sie sicher, dass die Google OAuth-Client-JSON heruntergeladen und unter folgendem Pfad gespeichert wurde:

~/.gmail-mcp/credentials.json

Fehlendes Gmail OAuth-Token

Führen Sie zuerst Folgendes aus:

npm run auth

access_denied oder Anwendung nicht verifiziert

Wenn sich der OAuth-Zustimmungsbildschirm noch im Status „Testing“ befindet, müssen Sie Ihr aktuelles Gmail-Konto zu den „Test users“ hinzufügen.

invalid_grant

Löschen Sie das alte Token und autorisieren Sie es erneut:

rm ~/.gmail-mcp/token.json
npm run auth

Available Tools

4 tools
get_emailA

Read one Gmail message by messageId.

NameRequiredDescriptionDefault
messageIdYesGmail message id.

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It states 'Read,' which implies a read-only operation with no side effects, but does not detail error handling, permissions required, or what the response contains. This is minimally adequate for a simple read tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence with no unnecessary words. It is front-loaded with the verb and resource, making it efficient for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema), the description is largely complete. It could be improved by briefly noting what the tool returns (e.g., message content or metadata), but it still provides enough context for basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the single parameter (messageId: 'Gmail message id.'). The description adds no further meaning beyond what the schema already provides, so it meets the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Read' and clearly identifies the resource as 'one Gmail message by messageId.' It distinguishes from siblings like list_emails (list multiple) and search_emails (search), making the tool's purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies that the tool is used when you have a specific messageId, but it does not explicitly state when to use it versus alternatives (e.g., list_emails for browsing, search_emails for filtering). No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_emailsB

List Gmail inbox messages. Supports maxResults and Gmail query filters.

NameRequiredDescriptionDefault
maxResultsNoMaximum number of emails to return. Default 10, max 50.
queryNoOptional Gmail search query, applied within INBOX.

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must disclose behavior. Mentions it lists inbox messages and supports parameters, but no details on pagination, response format, or conditions like invalid queries. For a read operation, minimal disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no filler. Efficiently conveys the core purpose and supported features.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with 2 params and no output schema, the description covers basics but lacks usage guidelines and behavioral details, leaving gaps for an AI agent to make informed decisions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear parameter descriptions (maxResults: default, min, max; query: optional within INBOX). Description merely restates that parameters are supported, adding no new semantic meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'List Gmail inbox messages' with verb and resource, distinguishing from get_email (single email) and list_labels (labels). However, does not explicitly differentiate from search_emails, which may also list emails but with different scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like search_emails. Only states what it does, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_labelsA

List all Gmail labels and folders.

NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description is the sole source. It states the action but lacks details like pagination, data scope, or authentication requirements. For a simple list, this is adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence contains all necessary information without waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema) and clear sibling differentiation, the description is complete enough for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters and 100% coverage. With 0 parameters, the baseline is 4, and the description does not add parameter information beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List all Gmail labels and folders' uses a specific verb and resource, clearly distinguishing from sibling tools that deal with emails (get_email, list_emails, search_emails).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

While no explicit when-to-use or alternatives are stated, the sibling context makes it clear this is for labels/folders vs. emails, implying appropriate usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_emailsA

Search Gmail messages with Gmail search syntax.

NameRequiredDescriptionDefault
queryYesGmail search query string.
maxResultsNoMaximum number of emails to return. Default 10, max 50.

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description bears full burden. It only mentions search syntax, but does not disclose output format, error behavior, or whether results include full messages or metadata.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no redundancy. Every word adds meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Lacks details on return format (e.g., fields, pagination) and how it differs from list_emails. No output schema, so description should provide more context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds value by specifying query uses 'Gmail search syntax', which is essential for correct invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb (Search) and resource (Gmail messages) using specific syntax. Distinguishes from sibling tools like get_email (single) and list_labels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use search vs alternatives like list_emails or get_email. The description is minimally adequate but lacks contextual differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.0.1
    • First observedget_email
    • First observedlist_emails
    • First observedlist_labels
    • First observedsearch_emails

TDQS

A3.6/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct operation: reading a single email by ID, listing inbox messages, searching with Gmail syntax, and listing labels. There is no overlap in functionality.

Naming Consistency5/5

All tool names follow the consistent verb_noun pattern in snake_case: get_email, list_emails, list_labels, search_emails.

Tool Count4/5

With 4 tools, the set is concise and scoped to basic read and list operations. While it covers common use cases, it could be expanded with write operations, but the count is reasonable for a focused subset.

Completeness2/5

The tool surface lacks write operations such as sending, deleting, or modifying emails and labels. Users cannot perform actions beyond reading and listing, which is a significant gap for comprehensive Gmail management.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive Gmail integration with LLM processing capabilities, allowing users to read, search, filter emails and handle attachments through the Model Context Protocol.
    25 npm
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables full management of Gmail accounts, including messages, threads, labels, and drafts. It leverages the Gmail API to allow searching, sending, and organizing emails via secure OAuth2 authentication.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides access to Gmail functionality through the Model Context Protocol, allowing LLMs like Claude to interact with your email.
    2
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to manage Gmail through natural language, including search, read, send, label, and draft operations via the Model Context Protocol.
    -