Mailbox

io.github.psyb0tPublished by GitHub account psyb0tv0.8.0Updated Oct 30, 2026

Scoped IMAP/SMTP access over HTTP and MCP: read, organize, draft, reply and send mail.

The publisher's own server: mailbox.bot

Overview

AI-generated overview

Self-hosted IMAP/SMTP mail gateway exposing an MCP endpoint so an assistant can read, organize, draft, reply and send mail under scoped tokens.

What you can do
  • Read mail across accounts: unified inbox, structured search, raw source, headers, attachments and threads
  • Organize mailboxes: seen flags, labels, move, mailbox creation and moving messages to Trash
  • Draft and send: configured identities, signatures, replies, IMAP drafts and Sent copies
  • Analyze messages: SPF/DKIM/DMARC verdicts, header mismatches, hidden text and deceptive links, with sanitized HTML on request
  • Operate: per-token scopes and mailbox allowlists, audit records, shared send limits and signed webhooks
When to use it
Useful when you want an assistant to work with real mailboxes on your own IMAP/SMTP accounts while keeping sending and deleting behind explicit token scopes, dry-run and rate limits. Suited to self-hosted setups where mail stays on the mail server and only operational state is stored locally.
Requirements
Runs as a local Docker container (image psyb0t/mailbox) exposing HTTP and an MCP endpoint on the same port. Needs a config.yaml with your IMAP/SMTP accounts and identities, plus a .env holding account passwords and bearer tokens; the README suggests restricting both files to chmod 600. A named volume at /var/lib/mailboxd keeps state. No credentials are declared in the manifest itself.
Before you install
The container holds mail account passwords and bearer tokens in config and env files, so protect and keep them out of version control. Tokens grant read, draft, organize, send or delete scopes; a token with send can actually send mail, and permanent erasure needs the delete scope. Writes and refused writes are audit-logged, and an optional watcher keeps an IMAP connection open and can deliver webhooks to external endpoints.

Installation

In SourceWeft

  1. Open Mailbox in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

mailbox

[CI] [version] [license] [Docker Pulls]

Read, organize, draft and send mail across multiple IMAP/SMTP accounts through one HTTP API and an MCP endpoint at /mcp, on the same port. Each bearer token controls which operations and mailboxes a client can access.

For agent access, configure tokens with explicit permissions:

  • Scoped tokens. A token that holds read, draft and organize cannot send or delete, and does not even see those tools.
  • Deletion defaults to Trash. Deleting moves a message to Trash. Permanent erasure needs the delete scope and only works from the Trash folder. The service never issues a folder-wide EXPUNGE.
  • Drafts in two steps. An agent can prepare a reply; a human (or a token with send) sends it.
  • Send guard. Hourly rate limit, dry-run mode, and a sender address authorized by your configured exact identities or opt-in domain patterns.
  • Message analysis. Inspect SPF/DKIM/DMARC verdicts, header mismatches, hidden text and deceptive links. Verdicts are trusted only when the receiving server matches your configuration. Request sanitized HTML when needed.
  • Audit log. Every write, and every refused write, is recorded (never message bodies).

Mail bodies and drafts stay on IMAP. A shared SQLite database stores audit records, send counters, checkpoints, draft send claims and webhook delivery metadata. API requests close their mail-server connections after use; the watcher keeps an IMAP connection open for notifications.

The service uses Python's imaplib and smtplib, FastAPI, the official MCP Python SDK and nh3 for HTML sanitizing. Dependency updates enforce a seven-day release-age cutoff through uv's exclude-newer setting.

Contents

Quick start

  1. Copy config.example.yaml to config.yaml and .env.example to .env. Configure your accounts and replace every placeholder in .env with its password or a fresh token from openssl rand -hex 32. Restrict both files with chmod 600.
  2. Start the container. The named volume preserves operational state across restarts:
bash
docker run --rm \  -p 127.0.0.1:8000:8000 \  --env-file .env \  -v "$PWD/config.yaml:/etc/mailboxd/config.yaml:ro" \  -v mailboxd-state:/var/lib/mailboxd \  psyb0t/mailbox:latest
  1. Check health and list mail:
bash
TOKEN="paste-the-token-here"
curl -s http://localhost:8000/health | jq                                               # health is always opencurl -s -H "Authorization: Bearer $TOKEN" http://localhost:8000/mailboxes | jqcurl -s -H "Authorization: Bearer $TOKEN" 'http://localhost:8000/inbox?limit=5' | jq

Docker Compose

The checked-in docker-compose.yml publishes on 127.0.0.1:${PORT:-8000}, mounts ./config.yaml (or $MAILBOXD_CONFIG) read-only and creates the mailboxd-state volume:

yaml
services:  mailboxd:    image: psyb0t/mailbox:latest    ports: ["127.0.0.1:8000:8000"]    volumes:      # Keep config.yaml out of Git and restrict access to its credentials.      - ./config.yaml:/etc/mailboxd/config.yaml:ro      - mailboxd-state:/var/lib/mailboxdvolumes:  mailboxd-state:

The optional webhook watcher is a second service in the same file, off by default: docker compose --profile watch up -d.

Capabilities

AreaOperations
ReadingUnified inbox, structured search, raw source, headers, attachments and threads
OrganizationSeen flags, labels, move, mailbox creation and Trash
SendingConfigured identities, signatures, replies, IMAP drafts and Sent copies
AccessPer-token scopes and mailbox allowlists shared by REST and MCP
OperationsSQLite audit records, shared send limits, checkpoints and durable signed webhooks

Mount /var/lib/mailboxd for persistent operational state. HTTP workers and the optional watcher share one SQLite database on a local filesystem. Read the migration notes before replacing a stateless deployment.

Development

bash
make lint           # flake8 and mypymake test-coverage  # full suite, production container and coverage floormake audit          # frozen runtime and dev dependency advisoriesmake build          # production imagemake help           # all available targets

All project tools run inside the development image. Tests use socket-level IMAP/SMTP fixtures, a local HTTP receiver, real SQLite files and a production-container smoke test. See development for details.

License

WTFPL. See LICENSE and third-party components.

Source: README.md at commit 33a2eb1

Tools

0
SourceWeft started this package once in an isolated sandbox, without credentials, to list its tools. That failed: the package type cannot run in the sandbox.

Version history

8
  1. v0.8.0LatestOct 29, 2026
  2. v0.7.0Oct 23, 2026
  3. v0.6.2Oct 21, 2026
  4. v0.6.1Oct 19, 2026
  5. v0.6.0Oct 19, 2026
  6. v0.5.1Oct 13, 2026
  7. v0.4.16Oct 10, 2026
  8. v0.4.15Sep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Mailbox integrations