mcpField
M
Mailbox

Mailbox

Local
github.com/psyb0tCommunication5Updated 1d ago

About Mailbox

Mailbox provides a shared HTTP API and MCP endpoint for accessing multiple IMAP/SMTP accounts, for agents and workflows that need controlled email access. Token scopes limit available operations and mailboxes, with explicit safeguards for sending, deletion, and auditing.

Key features

  1. 01Reads, searches, and organizes multiple mailboxes
  2. 02Creates drafts, replies, and sends mail
  3. 03Scopes tokens by operations and mailbox allowlists
  4. 04Moves deletions to Trash by default
  5. 05Checks authentication results and suspicious content
  6. 06Audits writes and refused operations

Use cases

  1. 01Let agents search mail within permitted accounts
  2. 02Prepare reply drafts for human sending
  3. 03Restrict automated sending and record operations
  4. 04Inspect email authentication and deceptive content

MCP support

Mailbox provides an `/mcp` endpoint on the same port as its HTTP API. MCP and REST share token scopes and mailbox allowlists.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"psyb0t-mailbox": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"docker.io/psyb0t/mailbox:v0.8.0"
]
}
}
}
Run commanddocker run -i --rm docker.io/psyb0t/mailbox:v0.8.0

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocidocker.io/psyb0t/mailbox:v0.8.0

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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:
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:
TOKEN="paste-the-token-here"

curl -s http://localhost:8000/health | jq                                               # health is always open
curl -s -H "Authorization: Bearer $TOKEN" http://localhost:8000/mailboxes | jq
curl -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:

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/mailboxd
volumes:
  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

make lint           # flake8 and mypy
make test-coverage  # full suite, production container and coverage floor
make audit          # frozen runtime and dev dependency advisories
make build          # production image
make 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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.