Labsco
MCP SERVER

Search a Gmail mailbox and delete messages — one at a time or in bulk — through the Gmail API.

Email: Mailboxes & Delivery
Summary
Search then delete, and delete is permanent.

The pairing is deliberate: `searchEmails` exists so the assistant can resolve a description into message IDs, and the delete tools take those IDs. That makes bulk cleanup — years of notifications from one sender — a single conversation. It also means a badly scoped query and a batch call remove real mail, so it is worth reading the search results before approving the second step.

What it is

A Spring-based Java server built around mailbox cleanup. It searches messages with Gmail's own query syntax, returns the matching IDs, and deletes them individually or as a batch. Every call names the user whose mailbox it is acting on, and authentication goes through a Google Cloud OAuth client you create yourself.

What you get
  • `searchEmails` takes a `userId`, a `query` and a `maxResults`, and returns matching messages with their IDs
  • `deleteEmail` deletes one message by `userId` and `messageId`
  • `batchDeleteEmails` deletes a list of `messageIds` in one call and reports the result
  • Runs over stdio, or as a web application on the port you configure
Requirements

Java 17 or higher and Maven 3.6+ or Gradle 7.0+. Create a project in Google Cloud Console, enable the Gmail API, create an OAuth 2.0 client and drop the `credentials.json` into `src/main/resources/`. Build with `./mvnw clean install` and launch the jar with `-Dspring.ai.mcp.server.stdio=true` for a local client. `server.port` defaults to 8080 and `gmail.credentials.path` points at the credentials file.