Skip to main content
Glama
tum-mail

tum-mail

by trouties
README.md
# tum-mail

An Agent Skill, Plugin, CLI, and MCP server for TUM / MWN Exchange mailboxes (`mail.tum.de`, `xmail.mwn.de`).

Supports reading, searching, triaging, drafting, replying, organizing, downloading attachments, and scheduling server-side sends on Windows, macOS, and Linux using Python 3.9+ with no third-party dependencies.

---

## Quick Start

### 1. Install

#### Option A — Universal Agent Skill `(Recommended)`

Works with Claude Code, Cursor, Codex CLI, Antigravity, Gemini CLI, GitHub Copilot, and Windsurf:

```bash
npx skills add trouties/tum-mail
```

#### Option B — Native Plugin Managers

- **Claude Code:**
  ```text
  /plugin marketplace add trouties/tum-mail
  /plugin install tum-mail@tum-mail-marketplace
  ```
- **Google Antigravity:**
  ```bash
  agy plugin install https://github.com/trouties/tum-mail
  ```
- **Gemini CLI:**
  ```bash
  gemini extensions install https://github.com/trouties/tum-mail
  ```

#### Option C — Standalone CLI & MCP Server (`uv` / `pipx`)

Recommended if you want `tummail` on `PATH` for terminal use or GUI MCP clients such as Claude Desktop:

```bash
uv tool install git+https://github.com/trouties/tum-mail
# or: pipx install git+https://github.com/trouties/tum-mail
```

### 2. Authenticate

Run credential setup in your own terminal (never paste passwords into an AI chat):

```bash
# If installed via Option C:
tummail auth setup

# Or run the script inside your installed skill directory:
python3 <skill-dir>/scripts/tummail.py auth setup   # macOS / Linux
python <skill-dir>\scripts\tummail.py auth setup    # Windows
```

- Enter your **TUM-ID** (e.g., `ab12xyz`), **not** your `@tum.de` email alias.
- Credentials are stored in your OS keyring (Windows Credential Manager, macOS Keychain, or Linux `secret-tool`).

Verify setup and connectivity:

```bash
tummail whoami
tummail doctor
```

---

## Usage

### With an AI Agent

Ask your agent in natural language, for example:
- *"Check my unread TUM emails and group anything from professors or the exam office first."*
- *"Search my TUM mailbox for emails about thesis registration."*
- *"Draft a reply to `m1a2b3c4d5e`, show me a preview, and schedule it for Monday 08:30."*

### From the Command Line

```bash
# Unread inbox, flagged items, and scheduled sends
tummail triage --max 30 --days 7

# Search across all folders using Exchange AQS
tummail list --folder all --query 'from:surname subject:thesis'

# Read a message or conversation thread (does not mark as read)
tummail get --id m1a2b3c4d5e --unique
tummail thread --id m1a2b3c4d5e

# Look up a colleague in the TUM directory
tummail resolve --name "Surname"

# Create a draft via stdin
printf "Dear Prof. Surname,\n\nCould we schedule a brief meeting next week?\n\nBest regards,\nYour Name\n" | \
  tummail draft --to prof@tum.de --subject "Thesis meeting" --body-stdin

# Preview, send now, or schedule server-side
tummail send --id m9f8e7d6c5b --dry-run
tummail send --id m9f8e7d6c5b --at "2026-12-01 08:30"

# List or cancel scheduled sends back into Drafts
tummail scheduled
tummail unschedule --id m9f8e7d6c5b

# Download attachments or export .eml
tummail download --id m1a2b3c4d5e --name "*.pdf"
tummail export --id m1a2b3c4d5e
```

Run `tummail help` for all actions and options.

---

## MCP Server (Optional)

For GUI clients without shell access (such as Claude Desktop), install the CLI via Option C and add this to your client's MCP configuration:

```json
{
  "mcpServers": {
    "tum-mail": {
      "command": "tummail",
      "args": ["mcp"]
    }
  }
}
```

---

## Configuration & Notes

- **Optional preferences:**
  ```bash
  tummail config set ews https://xmail.mwn.de/EWS/Exchange.asmx
  tummail config set download_dir ~/Documents/tum-attachments
  tummail config set signature "Best regards,\nYour Name"
  tummail config set timezone "Europe/Berlin"
  ```
- **Server-side scheduling:** `send --at` sets Exchange `PidTagDeferredSendTime` (1 minute to 60 days ahead). Your computer does not need to stay on.
- **Lockout protection:** If the server returns HTTP `401`, `tummail` records a SHA-256 fingerprint of that credential and refuses further login attempts until you run `tummail auth setup` with a new password.
- **Safety defaults:** Agents save drafts first, run `--dry-run` previews before sending, move deleted items to Trash rather than purging, and treat email contents as untrusted data.

---

## License

[MIT](LICENSE) © trouties

*Unofficial community tool. Not affiliated with Technische Universität München (TUM) or Leibniz-Rechenzentrum (LRZ).*