Labsco
MCP SERVER

Damien Email Wrestler

by ivan-rivera-projects

Run Gmail from a conversation: read, draft, send, label, thread, rule and analyse — with an AI layer that writes the rules for you.

Email: Mailboxes & Delivery
Summary
Several services, and some tools delete mail permanently.

This is not a single binary — a CLI, an MCP server and an adapter all have to be running, which is what the start script is for. Once up, the range is unusual: rules with a dry-run mode, thread-level operations, and vacation, IMAP and POP settings that most Gmail servers leave out. Treat the irreversible tools accordingly — `damien_delete_emails_permanently` and `damien_delete_thread_permanently` do exactly what their names say.

What it is

A multi-part Gmail platform: a Python CLI, an MCP server and a Node adapter. Tools cover core email operations, drafts, threads, labelling, filtering rules and account settings, plus an analysis layer that detects patterns, suggests rules and creates them from plain language.

What you get
  • Email listed with pagination and read in full, metadata or minimal form — `damien_list_emails`, `damien_get_email_details`
  • Drafts created, listed, inspected, edited, sent and deleted — `damien_create_draft`, `damien_list_drafts`, `damien_get_draft_details`, `damien_update_draft`, `damien_send_draft`, `damien_delete_draft`
  • Bulk actions on messages: trash, label, mark read or unread, and permanent deletion — `damien_trash_emails`, `damien_label_emails`, `damien_mark_emails`, `damien_delete_emails_permanently`
  • Thread-level work: list, inspect, relabel, trash and delete — `damien_list_threads`, `damien_get_thread_details`, `damien_modify_thread_labels`, `damien_trash_thread`, `damien_delete_thread_permanently`
  • Filtering rules listed, inspected, added, deleted and applied with a dry-run mode — `damien_list_rules`, `damien_get_rule_details`, `damien_add_rule`, `damien_delete_rule`, `damien_apply_rules`
  • Inbox analysis, rule suggestions, and rule creation from a sentence, with large-scale and background variants for big mailboxes — `damien_ai_analyze_emails`, `damien_ai_suggest_rules`, `damien_ai_create_rule`, `damien_ai_get_insights`, `damien_ai_optimize_inbox`, `damien_ai_analyze_emails_large_scale`, `damien_ai_analyze_emails_async`
  • Background jobs tracked, fetched, cancelled and listed — `damien_job_get_status`, `damien_job_get_result`, `damien_job_cancel`, `damien_job_list`
  • Account settings: vacation responder, IMAP and POP access read and updated — `damien_get_vacation_settings`, `damien_update_vacation_settings`, `damien_get_imap_settings`, `damien_update_imap_settings`, `damien_get_pop_settings`, `damien_update_pop_settings`
Requirements

Python 3.11+ with Poetry, Node.js 18+ with npm, Gmail API credentials, and an OpenAI API key for the AI features; AWS credentials are optional and only enable the Lambda path. Run `poetry install` in the CLI and MCP server directories and `npm install` in the adapter, start everything with `./scripts/start-all.sh`, then authenticate with `poetry run damien login`. The client points at the adapter with `DAMIEN_MCP_SERVER_URL` set to `http://localhost:8892` and `DAMIEN_MCP_SERVER_API_KEY`.

Setup effort

Build from source — clone the repository and build it, then point your client at the binary