draftgate-mcp
draftgate-mcp
An MCP server for email agents that cannot send mail without a human saying yes — unless you've explicitly told it otherwise for that contact.
Most "AI email assistant" demos either send freely (fine for a toy, unacceptable in production) or gate everything behind approval (safe, but defeats the point of automation for routine, low-stakes contacts). draftgate-mcp does neither: each contact carries its own trust level, and the send path enforces it deterministically — not by asking the model to "please be careful."
The pattern
Every contact has an auth_level:
Level | Behaviour |
| Sends immediately. No gate. |
| Sends immediately, unless the body contains a flagged keyword ( |
| Always held as a draft. A human must explicitly call |
| The agent isn't even allowed to compose a draft without permission first. This is the default for anyone not in |
send_email() returns a status field — sent, draft_created, needs_review, or blocked — and the server's own instructions tell the calling model exactly what each status requires before it's allowed to proceed. The gate lives in code, not in a prompt asking the model nicely not to send things.
Unknown recipients default to the most restrictive level. An agent can't accidentally email someone it's never been told about — it has to be extended a trust level explicitly, by a human, first.
Tools
read_inbox,read_message— read mail via IMAPsend_email— the gated send path described abovelist_drafts,confirm_draft,discard_draft— manage held draftslist_contacts,add_contact,update_contact_auth— manage trust levels
Setup
pip install -r requirements.txt
cp .env.example .env # fill in your IMAP/SMTP credentials
cp data/contacts.example.json data/contacts.json # add your real contacts
python server.pyPoint any MCP client (Claude Desktop, Claude Code, etc.) at server.py over stdio.
Why
This was extracted from the trust-tiering logic in a production email agent I run for my own inbox. The rest of that system — voice, telephony, task tracking, internal chat bridges — is specific to my own setup and not worth open-sourcing as-is, but the draft-gate pattern is a genuinely reusable answer to "how do you let an agent act without letting it act unsupervised." This repo is that pattern, stripped down to ~250 lines with no dependencies beyond the standard library, fastmcp, and python-dotenv.
License
MIT — see LICENSE.
Derek Manthorpe · github.com/DRMM101
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/DRMM101/draftgate-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server