Skip to main content
Glama
TU Clausthal Mail MCP

TU Clausthal Mail MCP

by tatoline
README.md
# TU Clausthal Mail MCP

Read your TU Clausthal Exchange mailbox from an MCP client. Each student runs a separate Python process with their own TUC account. This independent community project has no university affiliation or endorsement.

**Before connecting an assistant**, check whether it may process the correspondence. Even a locally installed server can send private mail to a cloud AI provider through its client. Read the [privacy and security guide](SECURITY.md) first.

## What works

The server provides ten read-only tools. It cannot send mail, create drafts, move messages, delete mail or change read flags. There is no background sync, mailbox database, analytics or shared account service.

| Tool | Result |
| --- | --- |
| `check_connection` | Successful authentication or a sanitized error |
| `list_folders` | Actual folder names and flags, including custom and localized folders |
| `get_mailbox_status` | Total and unread counts for one folder |
| `search_emails` | Selected headers matching combined filters |
| `list_recent_emails` | Headers in descending mailbox UID order |
| `get_unread_emails` | Unread headers in the same order |
| `read_email` | Headers, text, thread IDs and file metadata |
| `get_email_thread` | Related headers linked by message IDs across selected folders |
| `list_attachments` | MIME parts, filenames, types, inline status and encoded sizes |
| `get_attachment` | One explicitly selected, size-limited file as base64 |

The official Python MCP client has been tested over stdio and authenticated Streamable HTTP. MCP Inspector 2.17 also discovered the tools from a clean wheel installation over stdio. All ten tools have run against a fictional TLS IMAP server. Live TU Exchange, ChatGPT, Secure MCP Tunnel, Claude Desktop and a production OAuth provider remain unverified. See [protocol notes and limits](docs/protocol.md).

## Install locally

Install [Git](https://git-scm.com/downloads) and [uv](https://docs.astral.sh/uv/getting-started/installation/). Use a current patched Python 3.12–3.14. The examples ask uv for Python 3.13. Run these commands in PowerShell on Windows or Terminal on macOS or Linux.

```sh
git clone https://github.com/tatoline/tu-clausthal-mail-mcp.git
cd tu-clausthal-mail-mcp
uv sync --locked --no-dev --python 3.13
```

### Windows

Keep the configuration in your private local application data folder. Run the copy step once.

```powershell
$dir = Join-Path $env:LOCALAPPDATA 'tuc-mail'
New-Item -ItemType Directory -Force $dir | Out-Null
$config = Join-Path $dir 'mail.env'
if (!(Test-Path $config)) { Copy-Item .env.example $config }
notepad $config
```

### macOS and Linux

Use a private file under your home directory. Substitute your preferred local text editor for `nano` if needed.

```sh
mkdir -p "$HOME/.config/tuc-mail"
config="$HOME/.config/tuc-mail/mail.env"
(umask 077 && cp -n .env.example "$config")
chmod 600 "$config"
nano "$config"
```

### Enter credentials and check the connection

Set `TUC_USERNAME` to the **short TUC user ID**. The server adds the `tu-clausthal\` prefix. Put the TUC password inside single quotes in `TUC_PASSWORD`. Inside single quotes, write a literal apostrophe as `\'` and a backslash as `\\`. Save as UTF-8. Restrict file access to your OS account and trusted administrators. Keep it out of cloud sync and source control.

Alternatively, supply those two environment variables through a trusted process manager and omit `--env-file`. Environment variables override file values. The server never searches for a dotenv file. It needs no email address, SMTP settings or Microsoft Graph credentials.

After reviewing the [university guidance](docs/protocol.md#university-settings), run this explicit live login check in the same terminal. It reads no messages.

```sh
uv run --no-sync tuc-mail check --env-file "$config"
```

On success you should see `Authenticated over verified TLS.` Never paste a password, token, configuration file or private mail into a chat or issue.

## Connect a client

- [Claude Desktop and other local clients](docs/clients.md) can launch the installed executable over stdio. Start here if your client supports it.
- [ChatGPT](docs/chatgpt.md) needs a supported custom connection and OAuth. A private tunnel is an optional network path.
- [Remote Streamable HTTP](docs/http.md) requires your own compatible authorization server, an HTTPS resource identity and one allowed owner.
- [Docker](docs/docker.md) provides an optional container for either transport.

```mermaid
flowchart LR
    A[Local MCP client] -->|stdio| S[Personal MCP server]
    B[Remote MCP client] -->|HTTPS or private tunnel| H[OAuth check]
    H --> S
    S -->|On-demand IMAP over verified TLS| E[TU Exchange]
```

The official MCP SDK handles schemas and transports. The mailbox layer uses IMAPClient for folder encoding, searches and MIME section retrieval. Results travel back to the requesting client. Only the HTTP variant needs an external OAuth issuer.

## Example requests

- What unread emails did I receive today?
- Find the latest email from my professor at the address I give you.
- Summarize university emails from this week. Ask before opening sensitive messages.
- Find emails mentioning Simulation Engineering.
- What deadlines are mentioned in my recent emails? Cite each message.
- Show emails containing PDF attachments. Check metadata only.
- Summarize my correspondence with a particular lecturer. Include my Sent folder.

Start with narrow date ranges and small result counts. Search uses delivery dates and mailbox order. A thread can be incomplete, and a client may truncate large responses. Verify important dates and decisions in the original mail.

## Troubleshooting

| Symptom | What to check |
| --- | --- |
| Configuration error | Verify the absolute file path, UTF-8 encoding, short ID and inherited variables. HTTP needs additional settings. |
| Login failed or paused | Stop the client. Verify your account with RZ before restarting. Repeated restarts can lock an account. |
| Timeout or certificate error | Check connectivity, system clock and OS trust store. Ask RZ about current network restrictions. Keep verification enabled. |
| Folder unavailable or stale ID | Run `list_folders` and search again after moves, renames or mailbox resets. |
| Empty search page | Follow `before` if present. Try narrower filters or a simpler phrase if Exchange rejects a search. |
| No tools in a desktop client | Use absolute paths, restart the client and check its local MCP policy. |
| HTTP 401 or 403 | Check OAuth discovery, token type, owner, audience, scope and proxy header handling. Never share a token for diagnosis. |

## Development

See [contributing](CONTRIBUTING.md), [security reporting](SECURITY.md) and the [changelog](CHANGELOG.md). The project is distributed under the [MIT License](LICENSE).

TDQS

A3.7/5.0

Scored across 10 tools

Disambiguation4/5

Most tools have clearly distinct purposes: connection check, folder listing, status counts, search, thread lookup, attachment listing and fetching. The overlap is in the three header-listing tools (search_emails, list_recent_emails, get_unread_emails), which all page backwards with 'before' and could be confused at a glance, though descriptions differentiate them (filters vs. recency vs. unread-only).

Naming Consistency5/5

All ten tools follow a strict snake_case verb_noun pattern (check_connection, list_folders, search_emails, get_attachment). The verb choice is also semantically predictable: list_ for collections, get_ for single-resource retrieval, read_ for full content.

Tool Count5/5

Ten tools is well within the ideal range and each one covers a distinct mailbox operation. There is no filler: connection, folders, status, listing, search, read, thread, and attachment access each earn their place.

Completeness3/5

The surface is thorough on the read side (search, threads, attachments, pagination) but entirely read-only: no send, reply, forward, move, delete, or flag mutation, and unread tools explicitly avoid changing state. This is a coherent design decision but leaves notable gaps for common mail workflows beyond inspection.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues