Mailbox
Scoped IMAP/SMTP access over HTTP and MCP: read, organize, draft, reply and send mail.
التثبيت
أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: .cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).
docker.io/psyb0t/mailbox:v0.7.0claude mcp add mailbox -- docker run -i --rm docker.io/psyb0t/mailbox:v0.7.0
{
"mcpServers": {
"mailbox": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"docker.io/psyb0t/mailbox:v0.7.0"
]
}
}
}
التوثيق
مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.
mailbox
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,draftandorganizecannot send or delete, and does not even see those tools. - Deletion defaults to Trash. Deleting moves a message to Trash. Permanent erasure needs the
deletescope and only works from the Trash folder. The service never issues a folder-wideEXPUNGE. - 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 that must be one of the identities you configured.
- 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
- Configuration
- HTTP API, MCP, safety and webhooks
- Agent integrations
- Architecture and development
- Operations, backups and migration
Quick start
- Copy
config.example.yamltoconfig.yamland.env.exampleto.env. Configure your accounts and replace every placeholder in.envwith its password or a fresh token fromopenssl rand -hex 32. Restrict both files withchmod 600. - 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
- 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
| Area | Operations |
|---|---|
| Reading | Unified inbox, structured search, raw source, headers, attachments and threads |
| Organization | Seen flags, labels, move, mailbox creation and Trash |
| Sending | Configured identities, signatures, replies, IMAP drafts and Sent copies |
| Access | Per-token scopes and mailbox allowlists shared by REST and MCP |
| Operations | SQLite 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.
الأسئلة الشائعة
ما هو Mailbox؟
Scoped IMAP/SMTP access over HTTP and MCP: read, organize, draft, reply and send mail.
كيف أثبّت Mailbox؟
يعمل على جهازك. في Claude Code: claude mcp add mailbox -- docker run -i --rm docker.io/psyb0t/mailbox:v0.7.0. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.
هل يحتاج Mailbox إلى مفتاح API؟
لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.
هل Mailbox مفتوح المصدر؟
نعم. شيفرته متاحة على GitHub بترخيص WTFPL.
من يصون Mailbox؟
ينشره psyb0t. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.
من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.