Gmail MCP Server logo

Gmail MCP Server

by christo707

This project is a Spring Boot MCP server for Gmail. It provides tools for interacting with Gmail through the `GMailer` class and includes a client, `ClientStdio`, to test the MCP server functionality.

View on GitHub

Last updated: N/A

What is Gmail MCP Server?

The Gmail MCP Server is a Spring Boot application that acts as a Model Context Protocol (MCP) server designed to interact with the Gmail API. It provides a set of tools encapsulated in the GMailer class to perform various Gmail-related operations.

How to use Gmail MCP Server?

To use the server, you need to clone the repository, configure Gmail API credentials (including creating a Google Cloud project, enabling the Gmail API, configuring an OAuth consent screen, and creating an OAuth Client ID), build the project using Maven, and then run the Spring Boot application. The ClientStdio class can be used to test the server functionality.

Key features of Gmail MCP Server

  • trashEmail: Moves an email to the trash given its ID.

  • markEmailAsRead: Marks an email as read given its ID.

  • sendEmail: Sends an email to a specified recipient.

  • getUnreadMessages: Retrieves unread messages.

  • readEmail: Reads an email given its ID.

  • ClientStdio: A client to test the MCP server functionality using standard I/O.

Use cases of Gmail MCP Server

  • Automating email management tasks.

  • Integrating Gmail functionality into other applications.

  • Programmatically sending and receiving emails.

  • Building custom email workflows.

FAQ from Gmail MCP Server

What is the purpose of the ClientStdio?

The ClientStdio is a client application that allows you to test the functionality of the Gmail MCP Server using standard input and output.

What are the prerequisites for running this server?

You need Java 17 or higher, Maven, and Gmail API credentials.

How do I configure Gmail API credentials?

You need to create a Google Cloud project, enable the Gmail API, configure an OAuth consent screen, create an OAuth Client ID, and download the JSON file of your client's OAuth keys.

Where should I place the credentials.json file?

Place your credentials.json file in the src/main/resources directory.

How do I start the MCP server?

Run the command mvn spring-boot:run.