MCP server exposing JMAP email and Sieve script operations as tools
  • Go 90.8%
  • Nix 5.4%
  • Go Template 2.6%
  • Makefile 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mikhail 674ce014ef
All checks were successful
Release / nix (push) Successful in 31s
Release / ci (push) Successful in 0s
Release / chart-1 (push) Successful in 3s
Release / changelog (push) Successful in 1s
Release / test (push) Successful in 23s
Release / plan (push) Successful in 2s
Release / packages (push) Successful in 43s
Release / image (push) Successful in 50s
Release / chart (push) Successful in 2s
Release / release (push) Successful in 0s
Merge pull request 'jmap-mcp 0.16.0: a Nix flake with a NixOS module' (#11) from nix-flake into main
Reviewed-on: ⁨#11⁩
2026-12-05 12:33:14 +00:00
.forgejo/workflows jmap-mcp 0.16.0: a Nix flake with a NixOS module 2026-12-05 12:31:06 +00:00
charts/jmap-mcp jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
internal email_get: keep interleaved quotes in HTML bodies 2026-11-10 14:24:22 +00:00
nix jmap-mcp 0.16.0: a Nix flake with a NixOS module 2026-12-05 12:31:06 +00:00
packaging jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
.gitignore jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
.ko.yaml jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
AGENTS.md jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
CHANGELOG.md jmap-mcp 0.16.0: a Nix flake with a NixOS module 2026-12-05 12:31:06 +00:00
flake.lock jmap-mcp 0.16.0: a Nix flake with a NixOS module 2026-12-05 12:31:06 +00:00
flake.nix jmap-mcp 0.16.0: a Nix flake with a NixOS module 2026-12-05 12:31:06 +00:00
go.mod go 1.27.3, which ko and nfpm need to install (#2) 2026-11-06 09:22:21 +00:00
go.sum jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
main.go Name the module version when no release build set one 2026-11-13 23:30:07 +01:00
main_test.go Name the module version when no release build set one 2026-11-13 23:30:07 +01:00
makefile jmap-mcp 0.12.0: released from sarak.sh (#1) 2026-11-06 09:19:29 +00:00
README.md jmap-mcp 0.15.0: drafts signed by the sender identity (#6) 2026-11-09 18:01:00 +00:00
REVIEW.md Add REVIEW.md: what the city's reviewer checks beyond CI (#7) 2026-11-10 00:16:37 +00:00

jmap-mcp

MCP server exposing JMAP email and Sieve script operations as tools.

Built with the Go MCP SDK (go-sdk) and jmap library.

Tools

Tools map closely to JMAP methods. Email mutation tools provide structured convenience wrappers over Email/set patches.

Mailbox (RFC 8621)

Tool JMAP Method Description
mailbox_get Mailbox/get Get mailboxes by ID, or list all
mailbox_set Mailbox/set Create, update, or destroy mailboxes

Email (RFC 8621)

Tool JMAP Method Description
email_query Email/query Search emails with filters, returns IDs and total count
email_get Email/get Get full content of emails by ID
email_create Email/set Create a new email draft in the Drafts mailbox, or an answer
email_move Email/set Move emails to a different mailbox
email_flag Email/set Set or remove flags (seen, flagged, answered, draft)
email_delete Email/set Delete emails (move to Trash or permanently destroy)
email_attachment_url Blob download Signed URL streaming an attachment, expires in 30 s (HTTP mode only)

Identity

Tool JMAP Method Description
identity_get Identity/get List sender identities (addresses and signatures)

Submission (feature-gated)

Tool JMAP Method Description
email_submission_set EmailSubmission/set Submit a draft for delivery (requires -enable-send)

Sieve Scripts (RFC 9661, feature-gated)

Tool JMAP Method Description
sieve_get SieveScript/get List all scripts, or get one with full content (requires -enable-sieve)
sieve_set SieveScript/set Create, update, or destroy Sieve scripts (requires -enable-sieve)
sieve_validate SieveScript/validate Validate a Sieve script without saving (requires -enable-sieve)

Configuration

Env var Required Description
JMAP_SESSION_URL always JMAP session endpoint (e.g. https://api.fastmail.com/jmap/session)
JMAP_AUTH_TOKEN stdio mode Bearer token for JMAP authentication
ATTACHMENT_URL_SECRET no Secret sealing signed attachment URLs; set for multi-replica deployments (default: random per-process key)
Flag Default Description
-mode stdio Server mode: stdio or http
-listen :8080 HTTP listen address (http mode only)
-enable-send false Enable the email_submission_set tool (off by default)
-enable-sieve false Enable Sieve script tools (off by default, requires JMAP server support)
-external-url derived External base URL for signed attachment links; default derives from the request (X-Forwarded-Proto/X-Forwarded-Host aware)

In HTTP mode, the token can be passed per-request via Authorization: Bearer <token> header or jmap_token query parameter (query parameter takes precedence).

In HTTP mode, email_attachment_url returns a link served from /attachments/ that expires 30 seconds after issuance. The link is an AES-GCM sealed capability: it embeds the JMAP token, account, and blob IDs, so the endpoint streams the attachment from the JMAP server without any additional authentication and stores nothing on disk.

Installation

Kubernetes (Helm)

helm install jmap-mcp oci://sarak.sh/mikluko/charts/jmap-mcp \
  --version <version> \
  --set jmap.sessionURL="https://api.fastmail.com/jmap/session"

In HTTP mode, JMAP auth tokens are passed per-request via Authorization: Bearer header or ?jmap_token= query parameter — no static tokens are stored in the cluster.

The image is sarak.sh/mikluko/jmap-mcp:<version>.

Debian package

Releases publish .deb packages for amd64 and arm64 to the sarak.sh Debian registry, distribution trixie, component main, and attach them to the release.

Types: deb
URIs: https://sarak.sh/api/packages/mikluko/debian
Suites: trixie
Components: main
Signed-By: /etc/apt/keyrings/sarak.asc

The key is at https://sarak.sh/api/packages/mikluko/debian/repository.key.

Binary

go install sarak.sh/mikluko/jmap-mcp@latest

From source

git clone https://sarak.sh/mikluko/jmap-mcp.git
cd jmap-mcp
make install

Usage

# stdio mode (default)
export JMAP_SESSION_URL=https://api.fastmail.com/jmap/session
export JMAP_AUTH_TOKEN=your-token
./jmap-mcp

# HTTP mode
./jmap-mcp -mode http -listen :8080

Build

make build # Build and push container image + Helm chart
make image # Build and push container image with ko
make package # Package and push Helm chart to OCI registry
make test # Run tests
make install # Install binary locally

References