sieve-mcp-server
OfficialAllows managing Sieve mail filter scripts on cPanel-hosted mail servers via ManageSieve.
Enables managing Sieve mail filter scripts on Dovecot/Pigeonhole mail servers over ManageSieve, including validation, activation, and local backups.
Allows reading, writing, validating, activating, and backing up Sieve mail filter scripts on mailbox.org over ManageSieve.
Allows managing Sieve mail filter scripts on Plesk-hosted mail servers via ManageSieve.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sieve-mcp-servercreate a filter that files emails from newsletters into a News folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sieve-mcp-server
An MCP server that lets Claude (Desktop, Code, or any MCP client) read, write, validate, and activate Sieve mail filter scripts on your mail server over ManageSieve (RFC 5804).
It is built to go alongside an IMAP MCP server such as imap-mcp-server, which can read and move mail but cannot manage server-side filter rules.
Every upload is validated by your server first (
CHECKSCRIPT), and nothing is written if validation fails.Replacing a script needs
overwrite: true, anddryRunshows a diff first.The previous version is backed up locally before any overwrite or delete.
Uploading a script never activates it; activation is a separate, explicit call.
The active script cannot be deleted.
Passwords are stored AES-256-GCM encrypted in one place shared by all your MCP clients.
Requirements
Node.js ≥ 22.12
A mail server with ManageSieve enabled, usually on port 4190. Dovecot/Pigeonhole, Cyrus, Stalwart, mailbox.org, Posteo and most cPanel/Plesk hosts support it. Gmail and Outlook.com do not support Sieve.
Related MCP server: email-mcp
Install
git clone https://github.com/trustypangolin/sieve-mcp-server.git
cd sieve-mcp-server
npm install
npm run buildSet up an account
Run the setup CLI in a terminal. That way your password is typed there and never passes through a chat:
node dist/setup.js addIf you already use imap-mcp-server, you can import its accounts without retyping passwords. The importer only reads ~/.imap-mcp; it never changes anything there.
node dist/setup.js import-imap
# ManageSieve host differs from the IMAP host:
node dist/setup.js import-imap --account personal --host sieve.example.comOther commands: list, test <name>, update <name> [--host … --port … --tls … --password], remove <name>. Run node dist/setup.js --help for all options.
Each account is tested (connect, TLS, login) before it is saved. Pass --skip-test to save it anyway.
Connect Claude
node dist/setup.js config prints both snippets below with the correct absolute path filled in.
Claude Desktop: add to claude_desktop_config.json. On Windows that is %APPDATA%\Claude\; on macOS it is ~/Library/Application Support/Claude/.
{
"mcpServers": {
"sieve": {
"command": "node",
"args": ["C:\\path\\to\\sieve-mcp-server\\dist\\index.js"]
}
}
}Claude Code (available in all projects):
claude mcp add --scope user sieve -- node /path/to/sieve-mcp-server/dist/index.jsEditing rules locally
If you'd rather edit scripts in your own editor than through chat, use the setup CLI. local-rules/ is gitignored, so your real rules never get committed.
node dist/setup.js pull # every script → local-rules/<account>/<script>.sieve
node dist/setup.js check "local-rules/Personal/My Rules.sieve"
node dist/setup.js push "local-rules/Personal/My Rules.sieve" # validate, show diff, confirm, upload
node dist/setup.js activate "My Rules"pullnever overwrites a local file you've edited unless you pass--force.pushuses the file name as the script name; pass--nameto override it. Like the MCP tool, it backs up the server copy first and never activates the script.
samples/ has commented example rules: filing, mailing lists, spam, vacation, flags, plus-addressing, attachments, and a complete combined script.
One shared config for every client
Accounts live in ~/.sieve-mcp/ (%USERPROFILE%\.sieve-mcp\ on Windows):
File | Contents |
| Accounts, with passwords AES-256-GCM encrypted |
| Random 256-bit encryption key (owner-only permissions on macOS/Linux) |
| Script versions saved before each overwrite or delete |
Claude Desktop and Claude Code both run the server as your user, so they read the same store. The store is re-read on every call, which means an account added with the CLI shows up without restarting either client. Set SIEVE_MCP_HOME to move the store somewhere else.
Credentials from environment variables
To keep a password out of the store, save the account with an empty password, then set environment variables in the MCP client's env block:
SIEVE_MCP_ACCOUNT_<NAME>_USERNAME
SIEVE_MCP_ACCOUNT_<NAME>_PASSWORD<NAME> is the account name in uppercase, with every non-alphanumeric character replaced by _. For example, the account Personal Mail becomes SIEVE_MCP_ACCOUNT_PERSONAL_MAIL_PASSWORD. The values are read once at startup and then removed from the process environment.
Tools
Tool | What it does |
| Lists the configured accounts. Passwords are never shown. |
| Manage accounts from the chat. The CLI is preferred for passwords. |
| Shows the server's supported Sieve extensions. Also works as a connection test. |
| Lists the scripts on the server and which one is active. |
| Returns a script's source. |
| Has the server validate a script without saving it. |
| Creates or replaces a script, with validation, |
| Sets which script filters incoming mail, or switches filtering off. |
| Deletes an inactive script, after backing it up. |
| Renames a script. If it was active, it stays active. |
| Lists local backups and reads one back, so a change can be undone. |
Every tool accepts accountName (or accountId). You can leave both out when only one account is configured.
A typical change goes like this. You ask, for example, "file anything from the council into Council". Claude reads the active script, edits it, and runs a dry run so you can review the diff. It writes the change only after you approve it.
Security
TLS is required by default. With the default
tls: "starttls", the server refuses to log in if the mail server doesn't offer STARTTLS. Useimplicitfor a port that speaks TLS from the first byte. Usenoneonly on localhost or a trusted network.Certificates are verified. Set
allowInvalidCertificateonly for a self-signed certificate you trust. The client sets verification explicitly, so a globalNODE_TLS_REJECT_UNAUTHORIZED=0does not weaken it.Logins use SASL PLAIN, and only ever after TLS unless you chose
tls: "none".Nothing is logged except startup info, which goes to stderr. There is no telemetry, and the server makes no network connections other than to your own mail server.
Development
npm run dev # run the server from source
npm run setup -- list
npm test # vitest, including a fake ManageSieve server with STARTTLS
npm run lint # tsc --noEmitThe ManageSieve client in src/protocol/ is written from RFC 5804. It contains no code from other ManageSieve implementations. In particular, the AGPL-licensed Sieve Editor is not a source.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Your mailbox for MCP clients: search, read, draft, send, rules and notes. Sending is off by default.
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Shared memory and mail for your AI agents. Verified with Claude Code; other MCP clients in testing.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server that gives Claude and other MCP hosts full access to Mail.app on macOS — search, read, send, reply, flag, move, and more across all accounts configured in Mail.app.2434 npm1MIT
- FlicenseNot gradedqualityCmaintenanceLocal IMAP/SMTP MCP server that lets Claude read, search, draft, send, flag, and move mail across multiple IMAP mailboxes. Credentials stay on your machine.-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives Claude access to plain IMAP mailboxes, enabling reading, searching, moving, and forwarding emails with safety controls configured via config files.MIT
- AlicenseAqualityDmaintenanceMCP server to administer a Mailu mail server from Claude — domains, mailboxes, aliases and forwards.326 npmMIT