Skip to content

How it works

mailflow-mcp is one Python module with hand-written tools: MailFlow has no OpenAPI spec to generate them from. Sesamcp appears twice, as a library inside it and as the service in front.

flowchart TD
  S[Sesamcp service:<br/>the sign-in] -->|call with mfat_ token| A
  subgraph P["mailflow-mcp"]
    A[HTTP app<br/>from Sesamcp's library] -->|arguments| T[17 tools]
    T -->|route| G[GuardedTransport:<br/>only ALLOWED_CALLS]
  end
  G -->|API call| B[MailFlow backend]

From top to bottom: the sign-in decides who gets in, the tools shape the call, and the transport refuses every route that isn't on the list.

A request

sequenceDiagram
  participant C as Client
  participant S as Sesamcp
  participant M as mailflow-mcp
  participant B as MailFlow
  C->>S: connect without a token
  S-->>C: 401, sign in here
  C->>S: sign-in form with the mfat_ token
  S->>B: try the token
  B-->>S: valid
  S-->>C: Sesamcp's own token
  C->>S: tool call with Sesamcp's token
  S->>M: the same call with the mfat_ token
  M->>B: API call with the mfat_ token
  B-->>M: data, or 401 / 403
  M-->>S: result
  S-->>C: result

The upper half happens once per sign-in, the lower half on every tool call.

What it stores

Nothing. The token arrives with each request and goes on to MailFlow as Authorization: Bearer. The logins are in the sign-in's volume (Security).

Keeping up with MailFlow

MailFlow's token API changes with its releases. A daily CI job compares MailFlow's allowlist with a recorded copy, and dev/live-smoke.py calls the read tools against a real instance (Development).