Metadata-Version: 2.4
Name: pyfastmail-mcp
Version: 0.1.0
Summary: MCP server for Fastmail — email, contacts, calendar, and files via JMAP, CardDAV, CalDAV, and WebDAV
Project-URL: Homepage, https://github.com/pjosols/pyfastmail-mcp
Project-URL: Repository, https://github.com/pjosols/pyfastmail-mcp
Project-URL: Issues, https://github.com/pjosols/pyfastmail-mcp/issues
Author-email: Paul Olsen <paul@wholeshoot.com>
License: MIT License
        
        Copyright (c) 2026 Paul Olsen
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: caldav,carddav,fastmail,jmap,mcp,webdav
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: defusedxml>=0.7.1
Requires-Dist: icalendar>=6.0.0
Requires-Dist: mcp[cli]>=1.0.0
Requires-Dist: requests>=2.32.0
Requires-Dist: vobject>=0.9.6
Provides-Extra: dev
Requires-Dist: black>=24.0.0; extra == 'dev'
Requires-Dist: isort>=5.13.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Description-Content-Type: text/markdown

# pyfastmail-mcp

An [MCP](https://modelcontextprotocol.io/) server that gives AI assistants full access to your Fastmail account — email, contacts, calendars, and file storage.

## Features

**42 tools** across 4 protocols:

| Domain | Protocol | Tools |
|--------|----------|-------|
| Mail | JMAP | Send, reply, forward, search, read, archive, labels, masked email, attachments, threads |
| Contacts | CardDAV | List address books, CRUD contacts |
| Calendar | CalDAV | List calendars, CRUD events |
| Files | WebDAV | List, upload, download, move, delete, create folders |

## Installation

```bash
pip install pyfastmail-mcp
```

Or run directly with `uvx`:

```bash
uvx pyfastmail-mcp
```

## Configuration

### 1. Get Fastmail Credentials

You need two credentials from Fastmail:

- **API Token** (for JMAP/mail): [Fastmail Settings → Privacy & Security → API Tokens](https://app.fastmail.com/settings/security/tokens)
- **App Password** (for CardDAV/CalDAV/WebDAV): [Fastmail Settings → Privacy & Security → App Passwords](https://app.fastmail.com/settings/security/passwords) — create one with DAV access

### 2. Set Environment Variables

```bash
export FASTMAIL_API_TOKEN="fmu1-..."
export FASTMAIL_APP_PASSWORD="your-app-password"
export FASTMAIL_EMAIL="you@fastmail.com"
```

### 3. Add to Your MCP Client

For Claude Desktop, add to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "fastmail": {
      "command": "uvx",
      "args": ["pyfastmail-mcp"],
      "env": {
        "FASTMAIL_API_TOKEN": "fmu1-...",
        "FASTMAIL_APP_PASSWORD": "your-app-password",
        "FASTMAIL_EMAIL": "you@fastmail.com"
      }
    }
  }
}
```

For Kiro CLI, add to `.kiro/settings/mcp.json`:

```json
{
  "mcpServers": {
    "fastmail": {
      "command": "uvx",
      "args": ["pyfastmail-mcp"],
      "env": {
        "FASTMAIL_API_TOKEN": "${FASTMAIL_API_TOKEN}",
        "FASTMAIL_EMAIL": "${FASTMAIL_EMAIL}",
        "FASTMAIL_APP_PASSWORD": "${FASTMAIL_APP_PASSWORD}"
      }
    }
  }
}
```

## Tools

### Mail (`mail_*`)

| Tool | Description |
|------|-------------|
| `health_check` | Verify connection and auth |
| `mail_list_mailboxes` | List all mailboxes |
| `mail_create_mailbox` | Create a mailbox |
| `mail_rename_mailbox` | Rename a mailbox |
| `mail_delete_mailbox` | Delete a mailbox |
| `mail_get_email` | Get a single email by ID |
| `mail_get_recent_emails` | Get recent emails |
| `mail_search_emails` | Search by query |
| `mail_get_email_thread` | Get full thread |
| `mail_mark_email_read` | Mark read/unread |
| `mail_move_email` | Move to mailbox |
| `mail_delete_email` | Move to trash |
| `mail_archive_email` | Archive |
| `mail_manage_email_labels` | Add/remove labels |
| `mail_list_identities` | List send-as identities |
| `mail_send_email` | Send new email |
| `mail_reply_to_email` | Reply to email |
| `mail_forward_email` | Forward email |
| `mail_list_masked_emails` | List masked emails |
| `mail_create_masked_email` | Create masked email |
| `mail_update_masked_email_state` | Enable/disable masked email |
| `mail_download_attachment` | Download attachment |
| `mail_upload_attachment` | Upload blob for sending |

### Contacts (`contacts_*`)

| Tool | Description |
|------|-------------|
| `contacts_list_address_books` | List address books |
| `contacts_list` | List contacts |
| `contacts_get_contact` | Get contact details |
| `contacts_create_contact` | Create contact |
| `contacts_update_contact` | Update contact |
| `contacts_delete_contact` | Delete contact |

### Calendar (`calendar_*`)

| Tool | Description |
|------|-------------|
| `calendar_list_calendars` | List calendars |
| `calendar_list_events` | List events |
| `calendar_get_event` | Get event details |
| `calendar_create_event` | Create event |
| `calendar_update_event` | Update event |
| `calendar_delete_event` | Delete event |

### Files (`files_*`)

| Tool | Description |
|------|-------------|
| `files_list` | List files/folders |
| `files_get` | Download file |
| `files_upload` | Upload file |
| `files_create_folder` | Create folder |
| `files_move` | Move/rename file |
| `files_delete` | Delete file/folder |

## Development

```bash
git clone https://github.com/pjosols/pyfastmail-mcp.git
cd pyfastmail-mcp
uv sync --group dev
uv run pytest
```

## License

MIT
