Repository navigation
Releases
v0.2.0-alpha.2
This is a pre-release for tests. go install ...@latest and the
"Latest" release on GitHub stay at 0.1.0. The output of every tool
changed: a client of 0.2.0-alpha.1 that reads a result by its keys
must change with it.
Known issue: S/MIME verify needs OpenSSL 3.x. On a system with
OpenSSL 4, the signature status of an S/MIME message is unsupported.
Set openssl_path to an OpenSSL 3 program.
Removed
These changes break a client of 0.2.0-alpha.1 that reads a result by
its keys, or that sends a value that the server now refuses. The input
fields of the tools did not change. Every result has the new first key
_fence. Each text that a sender, a mail server or the model controls
is now under a key untrusted, in a fence. The Security section gives
the three exceptions.
Output keys that were removed or moved, by tool:
search: each row lostemailandfolder. The sender, the
subject and the preview areuntrusted.from,untrusted.subject
anduntrusted.preview. The folder isfolder_refand
untrusted.folder. Labels and keywords leftflagsand are in
untrusted.labels.flagsholds only the wordsunread,
starred,answeredanddraft, with a space between them.
errors[].erroris a class word, not the error text. The text is in
errors[].untrusted.detail.read: each message lostheaders,bodyandfolder. The
headers areuntrusted.from,untrusted.to,untrusted.cc,
untrusted.reply_toanduntrusted.subject, and a thread row of a
message that the call did not name hasuntrusted.preview. The body
isuntrusted.body. The folder isfolder_refand
untrusted.folder. Labels leftflagsand are in
untrusted.labels.untrusted.to,untrusted.cc,
untrusted.reply_toanduntrusted.labelsare lists with one fence
for each entry. Each attachment lostfile: the file name and
the media type areuntrusted.nameanduntrusted.type. An
attachmentrefthat is not digits and dots is now=and the hex
of the part id.decrypt:bodyis nowuntrusted.body. Each attachment lost
fileandtype: they areuntrusted.nameanduntrusted.type.attachment:pathis gone.diris the save root only,
untrusted.subdiris the path below the root (absent when the file
is in the root), anduntrusted.nameis the file name.export: each item offileslostpath. It hasdir,
untrusted.subdiranduntrusted.name, as inattachment.folders: each row lostname. The folder isfolder_refand
untrusted.name.gmail_settings: each filter lostfrom,to,subject,
query,add_labelsandremove_labels. They are under the
untrustedkey of the filter.vacationlostsubjectandbody.
They are undervacation.untrusted.signatureis now
untrusted.signature.bulk: eachsamplerow lostfromandsubject. They are under
theuntrustedkey of the row.modifyandbulk, the undo list (operationsandrecords):
summaryis a fixed text with action words and a count. The folder
and label names of the operation are inuntrusted.detailof the
row. A record of an earlier version has nosummary, and its whole
line is inuntrusted.detail.templates: each row lostsubject. It isuntrusted.subject.unsubscribe: each row losturl. It isuntrusted.url. Each row
has the new keyindex, the place of its id inids. The words of
methodandstatushave_in place of-and of the space:
one_click,draft_saved,see_link,not_authenticatedand
no_header.send:idis present only when the provider gives a Message-ID
(<...@...>). No provider gives one today, so a Gmail or JMAP result
no longer hasid.export: the file name comes from the new form of the message id.
An IMAP message that was1700000001.4211.INBOX.emlis now
1700000001-4211-494e424f58.eml.- Keys that can now be absent:
dateof asearchrow and of aread
message,idof areadmessage, ofdecrypt, of abulksample
row and of anunsubscriberow, andrefof areadattachment
(absent for a part id of more than 256 bytes). draft: the identity sentence ofnoteno longer holds the From
address. It gives the number of the rule that picked the address,
and the address is inuntrusted.detail.readanddecrypt: asignature.fingerprintof fewer than 8 hex
digits is left out.- Every tool:
noteholds only texts from a fixed set, and the parts
join with"; ". A provider text that matches no such text becomes
note withheld. Provider text that a note names by its class word
is inuntrusted.detail. - Every tool: an IMAP or Outlook message id has the new form
<uidvalidity>-<uid>-<hex of the folder name>. The old form still
works as input. - Every tool: an error result is no longer the plain error text. Its
first line is_fence: <nonce>and its second line is
error: <class>. The class is one oftimeout,canceled,
unknown_account,needs_auth,invalid_input,not_found,
refused,limit,unavailable,output_refused,internaland
error. A fixed text of the server can come next. All other error
text is in one fence after it. Only when the server cannot make a
nonce, the error iserror: internalwith no_fenceline.
Values that the server now refuses:
- A result with a string that breaks its rule:
output_refused, and
no part of the result is sent. - A folder value that starts with
=and is not a validfolder_ref
(=and 2 to 1024 lowercase hex digits), infolderofsearch
andbulk,move_toofmodifyandbulk, and thenameof a
foldersrename or delete:invalid_input. Before, the value was a
folder name. - A new folder name (the
nameof afolderscreate,new_nameof a
rename) that starts with=, also after spaces, or that holds fence
marker text, a hidden character or a control character:
invalid_input. move_toofmodifyandbulk, and a name ofadd_labelsof
modify, that would make a folder or label with such a name:
invalid_input, unless a folder or label with that name exists.- An
attachmentrefthat starts with=and is not=and 2 to
512 lowercase hex digits:invalid_input. - An account alias of more than 64 characters: the server refuses
accounts.toml, andaccount add,account testand
identities detectrefuse the alias.account removestill takes
it. - A
templatessave with a name of more than 64 characters:
invalid_input. Delete and draft still take such a name. A list
leaves it out and says so innote. - An
exportof an id that is not a valid message id:
invalid_input. Take the id from asearchrow. - A one-click
unsubscribein a client that cannot ask the human:
refused, unless[unsubscribe] allow_without_elicitationis true. - A Gmail
delete_filterin a client that cannot ask the human:
refused, unless[bulk] allow_without_elicitationis true. A
filter_idthat names no filter:not_found. - A
draftthat the mail server saves with an id in a form that the
server does not accept: an error with the classerror. The draft
is saved. - An address, identity name,
reply_matchentry or save root from
your own setup that holds a character that the check refuses:
output_refusedon the result that shows it.
Security
- Every tool result has two zones. The first field
_fenceholds a
nonce of 64 bits that is new for each response. Each string that a
sender controls sits under the keyuntrusted, in a fence marked
[UNTRUSTED_<nonce>]. A sender cannot guess the nonce, so a forged
marker no longer matches. - Three values are outside this rule. On the newer protocol, a result
that asks the human a question (send,bulk,unsubscribe,
gmail_settings) has no_fence, and its question can show sender
text with no fence, because the human reads it. A template name is text
that the model chose at the save, and it shows outside the fence in
thetemplateslist: it has at most 64 letters, digits,-and
_. On Gmail and JMAP, an id that the call gave comes back outside
the fence in amodifyrow with the stategoneand in an
unsubscriberow: it has at most 256 letters, digits,-and_. - Every other string in a result must match a closed grammar. A runtime
gate checks this on each result. A result that breaks a rule is
refused with the error classoutput_refused. - Error results start with the line
_fence: <nonce>. Folder names no
longer appear in ids or in plain fields. unsubscribeasks the human one question before it sends a
one-click POST. The question shows the number of POSTs and the host
of each. A decline sends no POST and gives each one-click row the
statusdeclinedand its link. A client that cannot ask gets a
refusal, unless the new key[unsubscribe] allow_without_elicitation
is true. The[bulk]key does not cover this question.- The Gmail
delete_filterasks the human first. The question shows
the filter id and the criteria and actions of the filter. A
filter_idthat names no filter gets the classnot_found, and
nobody is asked. The[bulk]keyallow_without_elicitationalso
covers this question. - The
dirof anattachmentorexportresult holds only the
allowed save root. The path below the root that the call chose is in
untrusted.subdir, inside a fence. A mail could ask the model to save
into a directory whose name is an instruction; that name no longer
shows outside a fence. - A new folder name must not start with
=:foldersrefuses such a
createnameor renamenew_namewith the classinvalid_input.
These two fields take nofolder_ref. move_toofmodifyandbulk, and each name ofadd_labelsof
modify, must name a folder or label that exists...
v0.2.0-alpha.1
This is a pre-release for tests. go install ...@latest and the
"Latest" release on GitHub stay at 0.1.0.
Known issue: S/MIME verify needs OpenSSL 3.x. On a system with
OpenSSL 4, the signature status of an S/MIME message is unsupported.
Set openssl_path to an OpenSSL 3 program.
Added
- The access level
classify, betweenreadanddraft. It permits
the read tools andmodifychanges that sort mail: a move to INBOX
or to the junk folder,read,starredand labels. It refuses
trash, delete, undo,bulk,draft,sendand every folder write.
Security
- At
classify, a Gmailadd_labelswith a label that the account
does not have fails, and the error lists the labels. The server
creates no label at this level. - A forged fence marker no longer passes the escape. The server folds
look-alike letters (Cyrillic, Greek and others) and look-alike
slashes to ASCII on a copy, and it accepts_, a space,-or no
separator after UNTRUSTED. The same fold applies to the strip of
outgoing text, which never rewrites the owner's own characters. - A character with no glyph inside the marker word (a variation
selector, a soft hyphen, a combining mark, a Hangul filler) no longer
hides a forged fence marker from the escape or from the strip of
outgoing text. - The strip of outgoing text makes at most 16 passes. A mail body with
thousands of nested markers made a reply or a forward use tens of
seconds of processor time. Text with more nested levels than the
limit loses every square bracket. - More chat template tokens are escaped:
<tool_call>,
<tool_response>,<function_calls>,<invoke,
<function_results>,[TOOL_RESULTS],<system>and the
line-initialSystem:,### Instruction:and### Response:.
The line-initialHuman:andAssistant:were escaped before. - Server text that can quote a stranger goes through
guard.Sanitize:
provider error text in a note, folder names, the folder of a search
row or a message, and label words. A folder name is now shown in its
NFKC form. - The outgoing text of
gmail_settings(vacation subject and body,
signature, filter criteria and labels) has fence markers stripped. gmail_settingsasks the human to confirmset_vacationwith
enabledtrue, everyset_signature, and acreate_filterthat
marks mail as read or removes INBOX or UNREAD. The question shows
the text that goes out. The[bulk]keyallow_without_elicitation
also covers these questions. The session grant ofbulkdoes not.- A test pins that no message byte reaches the arguments of
gpgand
openssl: mail data goes in through stdin only. - A reply whose
Reply-Toaddress differs from theFromaddress of
the original, with notogiven, gets a note in thedraftresult.
The note shows no address.
Changed
- The size budget of the release binary is 15,600,000 B (was
15,000,000 B). The two dependency bumps below add about 450 KB. - Update
github.com/ProtonMail/go-cryptoto v1.5.2. It fixes panics
on malformed input in the OpenPGP verifier. - Update
github.com/modelcontextprotocol/go-sdkto v1.8.0. A session
whose peer closes during a call now ends with the reasonpeer-gone. - Update
github.com/emersion/go-smtpand thegolang.org/xmodules.
These are separate dependency updates. Neither main bump needs them. - The
bulkdry_runtext warns that on JMAP afrom:term matches
whole words of the address. - A release tag with a pre-release part, such as
v0.2.0-alpha.1,
makes a GitHub pre-release. - The user guide has a section "Autonomous agents", a paragraph on
attach_dirs, the threegmail_settingsconfirmations, the note
that an empty Gmail label stays after an undo, and the note that the
server does not open or scan a saved file.
v0.1.0
Added
- One MCP server for many mailboxes: IMAP/SMTP, Outlook, Gmail (REST
API) and JMAP. - Six core tools that are always on:
accounts,folders,search,
read,attachmentandexport. - Toolsets that are off by default and that
extrasinaccounts.toml
turns on:decrypt,modify,send(draftandsend),
unsubscribe,bulk,templatesandgmail_settings. - An access level for each account:
read,draftorsend. - An undo journal for
modifyandbulk. - The CLI:
account add|list|test|remove,oauth set,doctor,
tools size,tools markdown,service install|uninstalland
version. - A daemon,
mailbag-mcp serve, on a Unix socket in
$XDG_RUNTIME_DIR. All sessions share one sign-in. systemd socket
activation is optional. The daemon stops after 15 minutes with no
session. - Secrets in the system keyring, with a file store as the fallback.
mailbag-setup, a setup page in the browser for the account, the
client and the daemon steps. It listens on127.0.0.1and needs a
token.account add --answers-stdinandoauth set --answers-stdin: the
setup page sends passwords and client secrets through stdin.bulkhasdry_run: it counts the matches and lists up to 50 rows,
and it changes nothing.- One session holds at most 16 places of the store for pending sends
and bulk changes. Another session still has room. A repeated call
reuses its place and does not take a new one. - Linux packages
.deb,.rpmand.pkg.tar.zst, withmailbag-mcp
andmailbag-setupin/usr/bin. - A release gate: a tag must have a good SSH signature, and CI reads
the allowed keys frommain. Thereleaseenvironment needs an
approval before the release goes public. - Live tests of the JMAP provider against a Stalwart account. They
need the build tagliveandMAILBAG_LIVE_JMAP.
Changed
- Compared with mailbox-mcp, the server that this project replaces: 6
core tools instead of about 57, secrets in the keyring instead of in
files, and a write gate for each account. - The MCP entry connects to the daemon on Linux and macOS. It runs the
server in its own process on Windows, whenXDG_RUNTIME_DIRis not
set, or when the daemon does not answer.
Security
- The server puts all text that a sender controls between
[UNTRUSTED_...]markers, removes hidden characters from it and
defangs links in search results. sendandbulkask the person to confirm in the client. A client
that cannot ask gets a refusal, unless the configuration permits it.- No tool takes a password or a token. Secrets go in through the CLI
only, andoauth setnever prints a client id or a client secret. - The daemon accepts a connection only from the same user, and its
socket is never in/tmp. - The JMAP client refuses a private or loopback address. With
private_host = true, it permits a private address for the session
host of that account only.