JG

jasonsum/gmail-mcp-server

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

73 stars 37 forks Качество 64 Тренд 14GPL-3.0

jasonsum/gmail-mcp-сервер является кандидатом на сервер MCP, импортированным из https://github.com/jasonsum/gmail-mcp-server.

Обзор

jasonsum/gmail-mcp-сервер является кандидатом на сервер MCP, импортированным из https://github.com/jasonsum/gmail-mcp-server.

Обзор (машинный перевод)

Этот MCP-сервер интегрируется с Gmail для отправки, удаления, чтения, составления и ответа на электронные письма.

Этот сервер позволяет клиенту MCP читать, удалять и отправлять электронные письма. Однако клиент подсказывает пользователю перед проведением таких действий.

[[Т0]]

Компоненты

Инструменты

отправить письмо

  • Отправляет e-mail на адрес электронной почты получателя

  • Ввод:

  • recipient_id (струна): адрес электронной почты адресата

  • [[Т2]] (струна): тема электронной почты

  • message (струна): Содержание электронной почты Возвращает статус и сообщение id

  • trash-email Переместить электронную почту в мусор

  • Ввод:

  • email_id (струна): автоматически генерируемый идентификатор электронной почты Вернуть сообщение об успехе

mark-email-as-read

  • Отметки электронной почты как читать
  • Ввод: email_id (струна): Автоматический идентификатор электронной почты Вернуть сообщение об успехе

get-unread-emails

  • Получает непрочитанные электронные письма

  • Возвращает список электронных писем, включая идентификатор электронной почты

  • read-email

  • Retrieves given email content

  • Ввод: email_id (струна): Автоматический идентификатор электронной почты Возвращает словарь метаданных электронной почты и отмечает электронную почту как прочитанную

  • ** открытая электронная почта** Открытая электронная почта в браузере

  • Ввод:

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

Gmail Server for Model Context Protocol (MCP)

This MCP server integrates with Gmail to enable sending, removing, reading, drafting, and responding to emails.

Note: This server enables an MCP client to read, remove, and send emails. However, the client prompts the user before conducting such activities.

https://github.com/user-attachments/assets/5794cd16-00d2-45a2-884a-8ba0c3a90c90

Components

Tools

  • send-email

    • Sends email to email address recipient
    • Input:
      • recipient_id (string): Email address of addressee
      • subject (string): Email subject
      • message (string): Email content
    • Returns status and message_id
  • trash-email

    • Moves email to trash
    • Input:
      • email_id (string): Auto-generated ID of email
    • Returns success message
  • mark-email-as-read

    • Marks email as read
    • Input:
      • email_id (string): Auto-generated ID of email
    • Returns success message
  • get-unread-emails

    • Retrieves unread emails
    • Returns list of emails including email ID
  • read-email

    • Retrieves given email content
    • Input:
      • email_id (string): Auto-generated ID of email
    • Returns dictionary of email metadata and marks email as read
  • open-email

    • Open email in browser
    • Input:
      • email_id (string): Auto-generated ID of email
    • Returns success message and opens given email in default browser

Setup

Gmail API Setup

  1. Create a new Google Cloud project
  2. Enable the Gmail API
  3. Configure an OAuth consent screen
    • Select “external”. However, we will not publish the app.
    • Add your personal email address as a “Test user”.
  4. Add OAuth scope https://www.googleapis.com/auth/gmail/modify
  5. Create an OAuth Client ID for application type “Desktop App”
  6. Download the JSON file of your client’s OAuth keys
  7. Rename the key file and save it to your local machine in a secure location. Take note of the location.
    • The absolute path to this file will be passed as parameter --creds-file-path when the server is started.

Authentication

When the server is started, an authentication flow will be launched in your system browser. Token credentials will be subsequently saved (and later retrieved) in the absolute file path passed to parameter --token-path.

For example, you may use a dot directory in your home folder, replacing [your-home-folder].:

Parameter Example
--creds-file-path /[your-home-folder]/.google/client_creds.json
--token-path /[your-home-folder]/.google/app_tokens.json

Usage with Desktop App

Открыть полный README на GitHub

Установка

npx @modelcontextprotocol/inspector uv run [absolute-path-to-git-repo]/src/gmail/server.py --creds-file-path [absolute-path-to-credentials-file] --token-path [absolute-path-to-access-tokens-file]
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "gdrive": { "command": "uv", "args": [ "--directory", "[absolute-path-to-git-repo]", "run", "gmail", "--creds-file-path", "[absolute-path-to-credentials-file]", "--token-path", "[absolute-path-to-access-tokens-file]" ] } } }