commit 2240bf745e02d4d07f2af1791072c942e1fc9643 Author: Kayos Date: Thu May 21 06:50:25 2026 -0700 mail-mcp v0.1 — Rust MCP server for Sulkta email Phase A: mail_send + mail_inbox_list + mail_inbox_read. Replaces scripts/kayos_mail.py with a typed MCP server. Outbound guarantees Date, Message-ID (own-domain), User-Agent, MIME-Version, multipart/alternative for HTML+text, multipart/mixed for attachments, In-Reply-To + References for threading. Single account in v0.1 (default_account from config). Phase B adds multi-account + threading + search; Phase C adds mark + attachments + reply helper. Stack: rmcp 0.1 (matches aldabra), lettre 0.11 + tokio-rustls, async-imap 0.10, mail-parser 0.9. Stderr-only logging (stdout is the MCP transport). Smoke verified 2026-05-21: send -> land -> read kayos@sulkta.com round trip, DKIM-Signature + Authentication-Results pass at the rspamd relay. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7ca0702 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +target/ +**/*.rs.bk +Cargo.lock.bak + +# Local config files MUST NOT be tracked — they carry credentials. +config.toml +**/config.toml +!config.example.toml + +# Editor / OS junk +.idea/ +.vscode/ +*.swp +.DS_Store diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7ccb7a4 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2246 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-compression" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79b3f8a79cccc2898f31920fc69f304859b3bd567490f75ebf51ae1c792a9ac" +dependencies = [ + "compression-codecs", + "compression-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-imap" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca726c61b73c471f531b65e83e161776ba62c2b6ba4ec73d51fad357009ed00a" +dependencies = [ + "async-channel 2.5.0", + "async-compression", + "base64 0.22.1", + "bytes", + "chrono", + "futures", + "imap-proto", + "log", + "nom 7.1.3", + "pin-project", + "pin-utils", + "self_cell", + "stop-token", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ec2f1fc3ec205783a5da9a7e6c1509cc69dedf09a1949e412c1e18469326d00" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a2f9779ce85b93ab6170dd940ad0169b5766ff848247aff13bb788b832fe3f4" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "compression-codecs" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf" +dependencies = [ + "compression-core", + "flate2", +] + +[[package]] +name = "compression-core" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys 0.4.1", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys 0.5.0", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.4.6", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.5.2", + "windows-sys 0.61.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "email-encoding" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9298e6504d9b9e780ed3f7dfd43a61be8cd0e09eb07f7706a945b0072b6670b6" +dependencies = [ + "base64 0.22.1", + "memchr", +] + +[[package]] +name = "email_address" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e079f19b08ca6239f47f8ba8509c11cf3ea30095831f7fed61441475edd8c449" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener 5.4.1", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hostname" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" +dependencies = [ + "cfg-if", + "libc", + "windows-link", +] + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "imap-proto" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f6af35c6a517aea5c72314abe90134980d2ae6a763809b50c208b3e429d71f" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "lettre" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0da65617f6cb926332d039cb578aad56178da86e128db6a1b09f4c94fa5b3349" +dependencies = [ + "async-trait", + "base64 0.22.1", + "email-encoding", + "email_address", + "fastrand", + "futures-io", + "futures-util", + "hostname", + "httpdate", + "idna", + "mime", + "nom 8.0.0", + "percent-encoding", + "quoted_printable", + "rustls", + "socket2", + "tokio", + "tokio-rustls", + "url", + "webpki-roots 1.0.7", +] + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libredox" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +dependencies = [ + "libc", +] + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "mail-mcp" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-imap", + "base64 0.22.1", + "dirs 5.0.1", + "futures", + "lettre", + "mail-parser", + "rmcp", + "rustls", + "rustls-pki-types", + "schemars", + "serde", + "serde_json", + "shellexpand", + "thiserror 1.0.69", + "tokio", + "tokio-rustls", + "toml", + "tracing", + "tracing-subscriber", + "uuid", + "webpki-roots 0.26.11", +] + +[[package]] +name = "mail-parser" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93c3b9e5d8b17faf573330bbc43b37d6e918c0a3bf8a88e7d0a220ebc84af9fc" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "quoted_printable" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478e0585659a122aa407eb7e3c0e1fa51b1d8a870038bd29f0cf4a8551eea972" + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rmcp" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a0110d28bd076f39e14bfd5b0340216dd18effeb5d02b43215944cc3e5c751" +dependencies = [ + "base64 0.21.7", + "chrono", + "futures", + "paste", + "pin-project-lite", + "rmcp-macros", + "schemars", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "rmcp-macros" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e2b2fd7497540489fa2db285edd43b7ed14c49157157438664278da6e42a7a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "self_cell" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shellexpand" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" +dependencies = [ + "dirs 6.0.0", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stop-token" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af91f480ee899ab2d9f8435bfdfc14d08a5754bd9d3fef1f1a1c23336aad6c8b" +dependencies = [ + "async-channel 1.9.0", + "cfg-if", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.7", +] + +[[package]] +name = "webpki-roots" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c1b24f9 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,77 @@ +# Cargo workspace root for mail-mcp. +# +# One crate today (mail-mcp), workspace shape so we can grow without +# rework. Same pattern as aldabra. +# +# Workspace deps pinned here; each crate references with `foo = { workspace = true }`. +[workspace] +resolver = "2" +members = ["crates/mail-mcp"] + +[workspace.package] +version = "0.1.0" +edition = "2021" +license = "MIT" +repository = "http://192.168.0.5:3001/Sulkta-Coop/mail-mcp" +authors = ["Cobb ", "Kayos "] + +[workspace.dependencies] +tokio = { version = "1", features = ["full"] } + +# MCP — same crate aldabra uses. Pinned to 0.1 series; bump together +# across repos when we move. +rmcp = { version = "0.1", features = ["server", "transport-io"] } +schemars = "0.8" + +# SMTP — lettre handles RFC-5322 headers (Date, Message-ID), STARTTLS, +# multipart/alternative + multipart/mixed natively. rustls-tls so we +# don't pull openssl. +lettre = { version = "0.11", default-features = false, features = [ + "tokio1-rustls-tls", + "smtp-transport", + "builder", + "hostname", +] } + +# IMAP — async-imap is tokio-native and supports UID-based addressing +# (which we use throughout the API surface). +async-imap = { version = "0.10", default-features = false, features = ["runtime-tokio"] } +tokio-rustls = "0.26" +rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "ring"] } +rustls-pki-types = "1" +webpki-roots = "0.26" + +# Email parsing on the read side. mail-parser is fast, no_std-friendly, +# and handles the RFC-5322 + MIME zoo without surprises. +mail-parser = "0.9" + +# Config + serde +toml = "0.8" +serde = { version = "1", features = ["derive"] } +serde_json = "1" + +# UUID for Message-ID generation when lettre's auto isn't appropriate +# (we want our own domain in the Message-ID, not lettre's local-hostname +# default). +uuid = { version = "1", features = ["v4"] } + +# Base64 for attachments +base64 = "0.22" + +# Errors +anyhow = "1" +thiserror = "1" + +# Stream adapter (.next() on async-imap fetch streams) +futures = "0.3" + +# Logging — stderr only, never stdout (stdio is the MCP transport). +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } + +# Dirs lookup for `~/.config/mail-mcp/config.toml` default path +dirs = "5" + +# Shell-style env-var expansion for the `password_file` setting +# (`~/.config/...` paths). shellexpand is small + maintained. +shellexpand = "3" diff --git a/README.md b/README.md new file mode 100644 index 0000000..e03ff75 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# mail-mcp + +Rust MCP server for Sulkta-hosted email. SMTP send + IMAP read with RFC-correct headers, multipart/alternative when HTML is included, multipart/mixed for attachments, threading via `In-Reply-To`/`References`. + +Replaces the `scripts/kayos_mail.py` CLI path that lived in `kayos/openclaw-workspace` since 2026-04-23. + +## Why a server, not a CLI + +`kayos_mail.py` shipped without `Date` or `Message-ID` headers until a 2026-05-18 patch — exactly the kind of header-discipline regression a typed Rust server prevents at compile time. The "no spam bin" framing is mostly upstream of any client (Rackham postfix + rspamd DKIM-sign at the relay; mail-tester scored 10/10 and port25 SpamAssassin −7.31 on 2026-05-20), but a correct client doesn't trip filters with bad MIME structure, broken threading, or missing headers. + +## Tools (v0.1) + +- `mail_send` — send mail. Args: `account?`, `to`, `cc[]?`, `bcc[]?`, `subject`, `body`, `body_html?`, `attachments[]?`, `in_reply_to?`, `references[]?`. Returns `{message_id, sent_at}`. +- `mail_inbox_list` — list folder messages newest-first. Args: `account?`, `since?` (YYYY-MM-DD), `unread_only?`, `limit?` (default 50, max 500), `folder?` (default INBOX). Uses `BODY.PEEK` so it does not toggle `\Seen`. +- `mail_inbox_read` — fetch one message by UID. Args: `account?`, `uid`, `folder?`, `format?` (`text`|`html`|`raw_eml`). Attachment payloads are not inlined — only filename/mime_type/size metadata. + +## Headers we guarantee on outbound + +- `Date` — UTC, RFC 5322 (lettre auto) +- `Message-ID` — `>` — own-domain, never the container hostname +- `From` — `name ` +- `MIME-Version: 1.0` +- `User-Agent: mail-mcp/` +- `In-Reply-To` + `References` when threading args present +- `Content-Type` correct for the body shape (text-only / alternative / mixed) + +DKIM-Signature is applied by the relay (rspamd on Rackham), not the client. + +## Build + +```bash +cargo build --release +``` + +Binary lands at `target/release/mail-mcp`. + +## Config + +```bash +mkdir -p ~/.config/mail-mcp +cp config.example.toml ~/.config/mail-mcp/config.toml +chmod 600 ~/.config/mail-mcp/config.toml +``` + +Edit accounts as needed. Passwords are NEVER inline: + +1. Looked up from the env var named in `password_env` +2. Falling back to `password_file` (shell-format: `KEY=VALUE` per line) +3. Hard-failing with a vault-pointer hint if neither resolves + +Vault canonical: `bw.sulkta.com` → `kayos@sulkta.com — IMAP/SMTP`. + +## MCP wiring (Claude Code / kayos-house) + +```json +{ + "mcpServers": { + "mail-mcp": { + "command": "/usr/local/bin/mail-mcp", + "args": [] + } + } +} +``` + +Logging is stderr-only — stdout is the JSON-RPC transport. + +## Future phases + +- **Phase B** (~200 LOC): multi-account routing across all configured `[accounts.*]`, plus `mail_thread` and `mail_search`. +- **Phase C** (~150 LOC): `mail_mark` (read/unread/flag/trash/archive), `mail_attachment_get`, `mail_reply` helper. + +Full locked spec: `kayos/openclaw-workspace` → `memory/spec-mail-mcp.md`. diff --git a/config.example.toml b/config.example.toml new file mode 100644 index 0000000..d19c4a7 --- /dev/null +++ b/config.example.toml @@ -0,0 +1,27 @@ +# mail-mcp config — copy to ~/.config/mail-mcp/config.toml, chmod 600. +# +# Passwords are NEVER inline. Each account names an env var (`password_env`) +# AND a fallback file (`password_file`). Lookup order: +# 1. env var +# 2. shell-format file (`KEY=VALUE` per line) +# 3. hard fail with a vault-pointer hint +# +# Vault canonical: bw.sulkta.com → "kayos@sulkta.com — IMAP/SMTP". + +default_account = "kayos" + +[accounts.kayos] +from_name = "Kayos" +from_addr = "kayos@sulkta.com" +smtp_host = "mail.sulkta.com" +smtp_port = 587 +smtp_starttls = true +imap_host = "mail.sulkta.com" +imap_port = 993 +imap_tls = true +username = "kayos@sulkta.com" +password_env = "KAYOS_SMTP_PASS" +password_file = "~/.config/kayos-mail/smtp.env" +# Optional: pin Message-ID domain. Defaults to the part of `from_addr` +# after the @ if unset. +# message_id_domain = "sulkta.com" diff --git a/crates/mail-mcp/Cargo.toml b/crates/mail-mcp/Cargo.toml new file mode 100644 index 0000000..c52b0d0 --- /dev/null +++ b/crates/mail-mcp/Cargo.toml @@ -0,0 +1,43 @@ +# mail-mcp — the binary. Stdio MCP server exposing SMTP send + IMAP +# read tools. Spawned per-session by any MCP client. + +[package] +name = "mail-mcp" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +authors.workspace = true +description = "Rust MCP server for Sulkta-hosted email (SMTP send + IMAP read)" + +[[bin]] +name = "mail-mcp" +path = "src/main.rs" + +[dependencies] +tokio = { workspace = true } +rmcp = { workspace = true } +schemars = { workspace = true } + +lettre = { workspace = true } +async-imap = { workspace = true } +tokio-rustls = { workspace = true } +rustls = { workspace = true } +rustls-pki-types = { workspace = true } +webpki-roots = { workspace = true } +mail-parser = { workspace = true } + +toml = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +uuid = { workspace = true } +base64 = { workspace = true } + +anyhow = { workspace = true } +thiserror = { workspace = true } +futures = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } + +dirs = { workspace = true } +shellexpand = { workspace = true } diff --git a/crates/mail-mcp/src/config.rs b/crates/mail-mcp/src/config.rs new file mode 100644 index 0000000..e04ece9 --- /dev/null +++ b/crates/mail-mcp/src/config.rs @@ -0,0 +1,134 @@ +//! TOML config + password resolution. +//! +//! Config path: `$MAIL_MCP_CONFIG` env, or `~/.config/mail-mcp/config.toml`. +//! +//! Password lookup per account: +//! 1. env var named by `password_env` +//! 2. file at `password_file` (shell-format: `KEY=VALUE`) +//! 3. hard fail with a vault-pointer hint — never silent +//! +//! Vault canonical: `bw.sulkta.com` → `kayos@sulkta.com — IMAP/SMTP`. + +use std::collections::HashMap; +use std::path::PathBuf; + +use anyhow::{anyhow, Context, Result}; +use serde::Deserialize; + +#[derive(Debug, Clone, Deserialize)] +pub struct Config { + pub default_account: String, + pub accounts: HashMap, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct Account { + pub from_name: String, + pub from_addr: String, + pub smtp_host: String, + pub smtp_port: u16, + #[serde(default = "default_true")] + pub smtp_starttls: bool, + pub imap_host: String, + pub imap_port: u16, + #[serde(default = "default_true")] + pub imap_tls: bool, + pub username: String, + pub password_env: String, + pub password_file: Option, + /// If unset, derived from the part of `from_addr` after `@`. + pub message_id_domain: Option, +} + +fn default_true() -> bool { + true +} + +impl Config { + pub fn load() -> Result { + let path = config_path()?; + let text = std::fs::read_to_string(&path) + .with_context(|| format!("read config {}", path.display()))?; + let cfg: Self = toml::from_str(&text) + .with_context(|| format!("parse config {}", path.display()))?; + if !cfg.accounts.contains_key(&cfg.default_account) { + return Err(anyhow!( + "default_account `{}` not in [accounts.*]", + cfg.default_account + )); + } + Ok(cfg) + } + + /// Resolve the named account (or `default_account` if `None`). + pub fn account<'a>(&'a self, name: Option<&str>) -> Result<&'a Account> { + let key = name.unwrap_or(&self.default_account); + self.accounts + .get(key) + .ok_or_else(|| anyhow!("unknown account `{key}` — check [accounts.*] in config.toml")) + } +} + +impl Account { + /// Resolve the password from env, then from `password_file`, then fail. + pub fn resolve_password(&self) -> Result { + if let Ok(v) = std::env::var(&self.password_env) { + if !v.is_empty() { + return Ok(v); + } + } + if let Some(path) = &self.password_file { + let expanded = shellexpand::tilde(path).into_owned(); + if std::path::Path::new(&expanded).is_file() { + let text = std::fs::read_to_string(&expanded) + .with_context(|| format!("read password_file {expanded}"))?; + for raw in text.lines() { + let line = raw.trim(); + if line.is_empty() || line.starts_with('#') { + continue; + } + if let Some((k, v)) = line.split_once('=') { + if k.trim() == self.password_env { + return Ok(strip_quotes(v.trim()).to_string()); + } + } + } + } + } + Err(anyhow!( + "no password for `{}`. Set ${} or write {}. Vault: bw.sulkta.com → `{} — IMAP/SMTP`", + self.username, + self.password_env, + self.password_file.as_deref().unwrap_or("(no file configured)"), + self.from_addr, + )) + } + + /// Domain used to qualify Message-IDs (so they read as ``, + /// not `>`). + pub fn msgid_domain(&self) -> &str { + if let Some(d) = &self.message_id_domain { + return d; + } + match self.from_addr.split_once('@') { + Some((_, d)) => d, + None => "localhost", + } + } +} + +fn strip_quotes(s: &str) -> &str { + let s = s.strip_prefix('"').unwrap_or(s); + let s = s.strip_suffix('"').unwrap_or(s); + let s = s.strip_prefix('\'').unwrap_or(s); + s.strip_suffix('\'').unwrap_or(s) +} + +fn config_path() -> Result { + if let Ok(p) = std::env::var("MAIL_MCP_CONFIG") { + return Ok(PathBuf::from(shellexpand::tilde(&p).into_owned())); + } + let home = dirs::config_dir() + .ok_or_else(|| anyhow!("could not resolve $XDG_CONFIG_HOME / ~/.config"))?; + Ok(home.join("mail-mcp").join("config.toml")) +} diff --git a/crates/mail-mcp/src/imap.rs b/crates/mail-mcp/src/imap.rs new file mode 100644 index 0000000..954d4e4 --- /dev/null +++ b/crates/mail-mcp/src/imap.rs @@ -0,0 +1,383 @@ +//! Inbound IMAP via `async-imap` + `tokio-rustls`. +//! +//! Two surfaces: +//! - `list(account, opts)` → newest-first summary array +//! - `read(account, uid, folder, format)` → full message +//! +//! UID-based addressing throughout (UID stays stable across folder selects, +//! sequence numbers don't). + +use std::sync::Arc; + +use anyhow::{anyhow, Context, Result}; +use async_imap::types::Fetch; +use futures::StreamExt; +use mail_parser::{MessageParser, MimeHeaders}; +use rustls::pki_types::ServerName; +use serde::Serialize; +use tokio::net::TcpStream; +use tokio_rustls::TlsConnector; + +use crate::config::Account; + +#[derive(Debug, Clone, Default)] +pub struct ListOpts { + pub since: Option, // YYYY-MM-DD + pub unread_only: bool, + pub limit: u32, // 0 means default (50) + pub folder: Option, // None → INBOX +} + +#[derive(Debug, Clone, Serialize)] +pub struct ListEntry { + pub uid: u32, + pub message_id: Option, + pub from: Vec, + pub to: Vec, + pub subject: String, + pub date: Option, + pub snippet: String, + pub has_attachments: bool, + pub flags: Vec, +} + +#[derive(Debug, Clone, Serialize)] +pub struct ReadOutput { + pub uid: u32, + pub message_id: Option, + pub from: Vec, + pub to: Vec, + pub cc: Vec, + pub subject: String, + pub date: Option, + pub headers: serde_json::Value, + pub body: String, + pub format: String, + pub attachments: Vec, +} + +#[derive(Debug, Clone, Serialize)] +pub struct AttachmentMeta { + pub filename: String, + pub mime_type: String, + pub size: usize, +} + +const DEFAULT_LIMIT: u32 = 50; +const MAX_LIMIT: u32 = 500; +const SNIPPET_LEN: usize = 240; + +// ============================================================================= +// list +// ============================================================================= + +pub async fn list(account: &Account, opts: ListOpts) -> Result> { + let folder = opts.folder.as_deref().unwrap_or("INBOX"); + let limit = match opts.limit { + 0 => DEFAULT_LIMIT, + n if n > MAX_LIMIT => MAX_LIMIT, + n => n, + }; + + let mut session = open_session(account).await?; + session + .select(folder) + .await + .with_context(|| format!("SELECT {folder}"))?; + + // Build the SEARCH query. + let mut search_terms: Vec = vec!["ALL".into()]; + if opts.unread_only { + search_terms = vec!["UNSEEN".into()]; + } + if let Some(since) = &opts.since { + let imap_date = format_imap_since(since) + .with_context(|| format!("`since` must be YYYY-MM-DD, got `{since}`"))?; + search_terms.push(format!("SINCE {imap_date}")); + } + let query = search_terms.join(" "); + + let uids: Vec = { + let set = session + .uid_search(&query) + .await + .with_context(|| format!("UID SEARCH {query}"))?; + let mut v: Vec = set.into_iter().collect(); + v.sort_unstable_by(|a, b| b.cmp(a)); // newest UID first + v.truncate(limit as usize); + v + }; + + let mut out: Vec = Vec::with_capacity(uids.len()); + if uids.is_empty() { + session.logout().await.ok(); + return Ok(out); + } + + let seq = uids + .iter() + .map(|u| u.to_string()) + .collect::>() + .join(","); + // BODY.PEEK so we don't toggle \Seen as a side effect of listing. + let fetch_query = "(UID FLAGS INTERNALDATE BODY.PEEK[HEADER] RFC822.SIZE)"; + let mut stream = session + .uid_fetch(&seq, fetch_query) + .await + .with_context(|| format!("UID FETCH {seq}"))?; + + while let Some(msg_res) = stream.next().await { + let msg = msg_res.context("UID FETCH stream item")?; + let entry = fetch_to_list_entry(&msg); + out.push(entry); + } + drop(stream); + + session.logout().await.ok(); + // Preserve newest-first ordering even if the server reordered. + out.sort_by(|a, b| b.uid.cmp(&a.uid)); + Ok(out) +} + +fn fetch_to_list_entry(msg: &Fetch) -> ListEntry { + let uid = msg.uid.unwrap_or(0); + let flags: Vec = msg.flags().map(|f| format!("{f:?}")).collect(); + let header_bytes = msg.header().unwrap_or(&[]); + + let parser = MessageParser::default(); + let parsed = parser.parse(header_bytes); + + let (from, to, subject, date, message_id) = if let Some(m) = parsed.as_ref() { + ( + addr_list(m.from()), + addr_list(m.to()), + m.subject().unwrap_or_default().to_string(), + m.date().map(|d| d.to_rfc3339()), + m.message_id().map(|s| s.to_string()), + ) + } else { + (vec![], vec![], String::new(), None, None) + }; + + // We didn't fetch the body for the list view — snippet stays empty. + // (read() fetches the body separately.) + let snippet = String::new(); + + // has_attachments is best-guessed from Content-Type in the header + // block, since we don't pull the body. multipart/mixed almost always + // means attachments are present. + let has_attachments = parsed + .as_ref() + .and_then(|m| m.content_type()) + .map(|ct| { + let main = ct.ctype().to_ascii_lowercase(); + let sub = ct.subtype().map(|s| s.to_ascii_lowercase()); + main == "multipart" && sub.as_deref() == Some("mixed") + }) + .unwrap_or(false); + + ListEntry { + uid, + message_id, + from, + to, + subject, + date, + snippet, + has_attachments, + flags, + } +} + +// ============================================================================= +// read +// ============================================================================= + +pub async fn read( + account: &Account, + uid: u32, + folder: Option<&str>, + format: &str, +) -> Result { + let folder = folder.unwrap_or("INBOX"); + let format = match format { + "text" | "html" | "raw_eml" => format, + other => { + return Err(anyhow!( + "format must be one of `text`, `html`, `raw_eml` — got `{other}`" + )) + } + }; + + let mut session = open_session(account).await?; + session + .select(folder) + .await + .with_context(|| format!("SELECT {folder}"))?; + + // BODY[] = full RFC822 message. We parse with mail-parser, then either + // return the text part, html part, or raw. + let mut stream = session + .uid_fetch(uid.to_string(), "(UID FLAGS BODY.PEEK[])") + .await + .with_context(|| format!("UID FETCH {uid}"))?; + + let first = stream + .next() + .await + .ok_or_else(|| anyhow!("no message at UID {uid} in {folder}"))? + .context("UID FETCH stream")?; + + let raw_body = first.body().unwrap_or(&[]).to_vec(); + drop(stream); + session.logout().await.ok(); + + let parser = MessageParser::default(); + let parsed = parser + .parse(&raw_body) + .ok_or_else(|| anyhow!("could not parse message bytes"))?; + + let body = match format { + "raw_eml" => String::from_utf8_lossy(&raw_body).into_owned(), + "html" => parsed + .body_html(0) + .map(|s| s.into_owned()) + .or_else(|| parsed.body_text(0).map(|s| s.into_owned())) + .unwrap_or_default(), + _ => parsed + .body_text(0) + .map(|s| s.into_owned()) + .or_else(|| parsed.body_html(0).map(|s| s.into_owned())) + .unwrap_or_default(), + }; + + let attachments: Vec = parsed + .attachments() + .map(|att| AttachmentMeta { + filename: att.attachment_name().unwrap_or("attachment").to_string(), + mime_type: format!( + "{}/{}", + att.content_type() + .map(|ct| ct.ctype().to_string()) + .unwrap_or_else(|| "application".into()), + att.content_type() + .and_then(|ct| ct.subtype().map(|s| s.to_string())) + .unwrap_or_else(|| "octet-stream".into()), + ), + size: att.contents().len(), + }) + .collect(); + + // Headers as a flat JSON map (last-write-wins on duplicates is fine for v0.1). + let mut headers = serde_json::Map::new(); + for h in parsed.headers() { + let name = h.name(); + let val = h.value().as_text().map(|s| s.to_string()).unwrap_or_default(); + headers.insert(name.to_string(), serde_json::Value::String(val)); + } + + let subject = parsed.subject().unwrap_or_default().to_string(); + let snippet_unused: String = body.chars().take(SNIPPET_LEN).collect(); + let _ = snippet_unused; // suppress unused (kept structure-wise for symmetry) + + Ok(ReadOutput { + uid, + message_id: parsed.message_id().map(|s| s.to_string()), + from: addr_list(parsed.from()), + to: addr_list(parsed.to()), + cc: addr_list(parsed.cc()), + subject, + date: parsed.date().map(|d| d.to_rfc3339()), + headers: serde_json::Value::Object(headers), + body, + format: format.to_string(), + attachments, + }) +} + +// ============================================================================= +// helpers +// ============================================================================= + +fn addr_list(addrs: Option<&mail_parser::Address>) -> Vec { + let Some(addrs) = addrs else { return vec![] }; + let mut out = vec![]; + for a in addrs.iter() { + let email = a.address().unwrap_or(""); + if email.is_empty() { + continue; + } + match a.name() { + Some(n) if !n.is_empty() => out.push(format!("{n} <{email}>")), + _ => out.push(email.to_string()), + } + } + out +} + +fn format_imap_since(iso_date: &str) -> Result { + // YYYY-MM-DD → DD-Mon-YYYY (IMAP requires uppercase 3-letter month). + let parts: Vec<&str> = iso_date.split('-').collect(); + if parts.len() != 3 { + return Err(anyhow!("expected YYYY-MM-DD")); + } + let y: u32 = parts[0].parse().context("year")?; + let m: u32 = parts[1].parse().context("month")?; + let d: u32 = parts[2].parse().context("day")?; + let mon = match m { + 1 => "Jan", + 2 => "Feb", + 3 => "Mar", + 4 => "Apr", + 5 => "May", + 6 => "Jun", + 7 => "Jul", + 8 => "Aug", + 9 => "Sep", + 10 => "Oct", + 11 => "Nov", + 12 => "Dec", + _ => return Err(anyhow!("month must be 1..=12")), + }; + Ok(format!("{d:02}-{mon}-{y:04}")) +} + +async fn open_session( + account: &Account, +) -> Result>> { + if !account.imap_tls { + return Err(anyhow!( + "plain-IMAP (no TLS) not supported in v0.1 — set imap_tls=true and imap_port=993" + )); + } + let addr = format!("{}:{}", account.imap_host, account.imap_port); + let tcp = TcpStream::connect(&addr) + .await + .with_context(|| format!("tcp connect {addr}"))?; + + let root_store = rustls_roots(); + let cfg = rustls::ClientConfig::builder() + .with_root_certificates(root_store) + .with_no_client_auth(); + let connector = TlsConnector::from(Arc::new(cfg)); + let server_name = ServerName::try_from(account.imap_host.clone()) + .with_context(|| format!("server name `{}`", account.imap_host))?; + let tls = connector + .connect(server_name, tcp) + .await + .with_context(|| format!("tls handshake {}", account.imap_host))?; + + let client = async_imap::Client::new(tls); + // greeting was consumed by Client::new in async-imap >= 0.10 + let session = client + .login(&account.username, account.resolve_password()?) + .await + .map_err(|(e, _client)| anyhow!("imap login failed: {e}"))?; + Ok(session) +} + +fn rustls_roots() -> rustls::RootCertStore { + let mut roots = rustls::RootCertStore::empty(); + roots.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned()); + roots +} diff --git a/crates/mail-mcp/src/main.rs b/crates/mail-mcp/src/main.rs new file mode 100644 index 0000000..c90a8ed --- /dev/null +++ b/crates/mail-mcp/src/main.rs @@ -0,0 +1,66 @@ +//! mail-mcp — MCP server entry point. +//! +//! Speaks MCP over stdio. Any MCP client (Claude Code, OpenClaw, +//! kayos-house's bundled claude binary) launches this as a subprocess +//! and gets `mail_send` + `mail_inbox_list` + `mail_inbox_read`. +//! +//! Logging is stderr-only — stdout belongs to the JSON-RPC transport. + +mod config; +mod imap; +mod smtp; +mod tools; + +use std::process::ExitCode; + +use anyhow::Result; +use rmcp::{transport::stdio, ServiceExt}; +use tracing_subscriber::EnvFilter; + +use crate::config::Config; +use crate::tools::MailService; + +#[tokio::main] +async fn main() -> ExitCode { + tracing_subscriber::fmt() + .with_writer(std::io::stderr) + .with_env_filter( + EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()), + ) + .init(); + + // rustls 0.23 requires the process-wide default CryptoProvider to be set + // before any TLS handshake. lettre carries its own internal provider for + // SMTP; our IMAP path goes through tokio-rustls + raw `ClientConfig`, + // which needs this. Install once at startup; ignore the Err which only + // surfaces if a provider is already installed (idempotent). + let _ = rustls::crypto::ring::default_provider().install_default(); + + match run().await { + Ok(()) => ExitCode::SUCCESS, + Err(e) => { + tracing::error!("{e:#}"); + ExitCode::FAILURE + } + } +} + +async fn run() -> Result<()> { + let cfg = Config::load()?; + tracing::info!( + accounts = cfg.accounts.len(), + default_account = %cfg.default_account, + "mail-mcp starting" + ); + + let service = MailService::new(cfg); + let server = service + .serve(stdio()) + .await + .map_err(|e| anyhow::anyhow!("rmcp serve failed: {e}"))?; + server + .waiting() + .await + .map_err(|e| anyhow::anyhow!("rmcp wait failed: {e}"))?; + Ok(()) +} diff --git a/crates/mail-mcp/src/smtp.rs b/crates/mail-mcp/src/smtp.rs new file mode 100644 index 0000000..f827f43 --- /dev/null +++ b/crates/mail-mcp/src/smtp.rs @@ -0,0 +1,229 @@ +//! Outbound SMTP via `lettre` with explicit header discipline. +//! +//! Headers we guarantee: +//! - `Date` — lettre auto, UTC, RFC 5322 +//! - `Message-ID` — `` — own-domain, not local hostname +//! - `From` — `name ` +//! - `MIME-Version` — lettre auto +//! - `User-Agent` — `mail-mcp/` +//! - `In-Reply-To` — if provided +//! - `References` — if provided (space-joined) +//! +//! Body shape: +//! - body only → `text/plain; charset=utf-8` +//! - body + body_html → `multipart/alternative` (text first per RFC 2046) +//! - attachments → `multipart/mixed` wrap around the alternative +//! (or around the singlepart text body if no html) + +use anyhow::{anyhow, Context, Result}; +use base64::Engine; +use lettre::message::header::ContentType; +use lettre::message::{Attachment, MultiPart, SinglePart}; +use lettre::transport::smtp::authentication::Credentials; +use lettre::{AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor}; + +use crate::config::Account; + +#[derive(Debug, Clone)] +pub struct AttachmentSpec { + pub filename: String, + pub content_base64: String, + pub mime_type: String, +} + +#[derive(Debug, Clone, Default)] +pub struct SendInput { + pub to: Vec, + pub cc: Vec, + pub bcc: Vec, + pub subject: String, + pub body: String, + pub body_html: Option, + pub attachments: Vec, + pub in_reply_to: Option, + pub references: Vec, +} + +#[derive(Debug, Clone)] +pub struct SendOutput { + pub message_id: String, + pub sent_at: String, // RFC-3339 +} + +const USER_AGENT: &str = concat!("mail-mcp/", env!("CARGO_PKG_VERSION")); + +pub async fn send(account: &Account, input: SendInput) -> Result { + if input.to.is_empty() { + return Err(anyhow!("at least one `to` address required")); + } + + // Build From, To, Cc, Bcc. + let from_str = format!("{} <{}>", account.from_name, account.from_addr); + let mut builder = Message::builder() + .from(from_str.parse().context("parse from address")?) + .subject(&input.subject); + + for addr in &input.to { + builder = builder.to(addr.parse().with_context(|| format!("parse to `{addr}`"))?); + } + for addr in &input.cc { + builder = builder.cc(addr.parse().with_context(|| format!("parse cc `{addr}`"))?); + } + for addr in &input.bcc { + builder = builder + .bcc(addr.parse().with_context(|| format!("parse bcc `{addr}`"))?); + } + + // Own-domain Message-ID. Lettre defaults to the local hostname; we + // want the sender domain so receivers don't see `<...@container-id>`. + let message_id = format!("<{}@{}>", uuid::Uuid::new_v4(), account.msgid_domain()); + builder = builder.message_id(Some(message_id.clone())); + + // Threading. + if let Some(parent) = &input.in_reply_to { + builder = builder.in_reply_to(parent.clone()); + } + if !input.references.is_empty() { + builder = builder.references(input.references.join(" ")); + } + + // User-Agent — uses the lettre `user_agent()` shorthand which writes + // the standard header. + builder = builder.user_agent(USER_AGENT.to_string()); + + // Body. + let body_part: MultiPart = build_body(&input)?; + let email = builder + .multipart(body_part) + .context("compose message")?; + + // SMTP transport. STARTTLS on submission port (587) is the canonical + // path; SMTPS-on-465 supported too if someone configures `smtp_starttls = false`. + let creds = Credentials::new( + account.username.clone(), + account.resolve_password()?, + ); + + let transport: AsyncSmtpTransport = if account.smtp_starttls { + AsyncSmtpTransport::::starttls_relay(&account.smtp_host) + .with_context(|| format!("smtp starttls relay {}", account.smtp_host))? + .port(account.smtp_port) + .credentials(creds) + .build() + } else { + AsyncSmtpTransport::::relay(&account.smtp_host) + .with_context(|| format!("smtp relay {}", account.smtp_host))? + .port(account.smtp_port) + .credentials(creds) + .build() + }; + + let sent_at = chrono_rfc3339_now(); + transport + .send(email) + .await + .with_context(|| format!("send to {}:{}", account.smtp_host, account.smtp_port))?; + + Ok(SendOutput { + message_id, + sent_at, + }) +} + +fn build_body(input: &SendInput) -> Result { + // Inner content: plain or alternative(plain, html). + let inner_alternative: Option = input.body_html.as_ref().map(|html| { + MultiPart::alternative() + .singlepart( + SinglePart::builder() + .header(ContentType::TEXT_PLAIN) + .body(input.body.clone()), + ) + .singlepart( + SinglePart::builder() + .header(ContentType::TEXT_HTML) + .body(html.clone()), + ) + }); + + let plain_only: SinglePart = SinglePart::builder() + .header(ContentType::TEXT_PLAIN) + .body(input.body.clone()); + + if input.attachments.is_empty() { + // No attachments — return alternative if html else a one-part + // "mixed" wrapping just the plain body (keeps return type uniform). + if let Some(alt) = inner_alternative { + return Ok(alt); + } + // Wrap the singlepart in a "mixed" container so we always return + // MultiPart. This adds one MIME boundary but is RFC-valid. + return Ok(MultiPart::mixed().singlepart(plain_only)); + } + + // Have attachments — multipart/mixed wraps either the alternative + // (if html provided) or just the plain body. + let mut mixed = if let Some(alt) = inner_alternative { + MultiPart::mixed().multipart(alt) + } else { + MultiPart::mixed().singlepart(plain_only) + }; + + for att in &input.attachments { + let bytes = base64::engine::general_purpose::STANDARD + .decode(&att.content_base64) + .with_context(|| format!("attachment `{}`: invalid base64", att.filename))?; + let content_type: ContentType = att.mime_type.parse().with_context(|| { + format!( + "attachment `{}`: invalid mime_type `{}`", + att.filename, att.mime_type + ) + })?; + mixed = mixed.singlepart( + Attachment::new(att.filename.clone()).body(bytes, content_type), + ); + } + Ok(mixed) +} + +/// Render `now` as RFC-3339 UTC (`2026-05-21T06:42:18Z`). We avoid pulling +/// the full `chrono` crate just for this; build the string by hand from +/// std time. +fn chrono_rfc3339_now() -> String { + use std::time::{SystemTime, UNIX_EPOCH}; + let secs = SystemTime::now() + .duration_since(UNIX_EPOCH) + .map(|d| d.as_secs()) + .unwrap_or(0); + // RFC-3339 via the same algorithm `httpdate` uses, simplified for UTC. + let (year, month, day, hour, minute, second) = civil_from_unix(secs as i64); + format!( + "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z", + year, month, day, hour, minute, second + ) +} + +/// Convert a unix timestamp (UTC) to civil (Y,M,D,h,m,s). Copy of the +/// classic Howard Hinnant algorithm — works for the full proleptic Gregorian range. +fn civil_from_unix(t: i64) -> (i64, u32, u32, u32, u32, u32) { + let days = t.div_euclid(86_400); + let secs_of_day = t.rem_euclid(86_400); + let hour = (secs_of_day / 3600) as u32; + let minute = ((secs_of_day % 3600) / 60) as u32; + let second = (secs_of_day % 60) as u32; + + // 0000-03-01 is the start of the cycle ("era"). + let z = days + 719_468; + let era = if z >= 0 { z } else { z - 146_096 } / 146_097; + let doe = (z - era * 146_097) as u64; + let yoe = + (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let y = yoe as i64 + era * 400; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = (doy - (153 * mp + 2) / 5 + 1) as u32; + let m = if mp < 10 { (mp + 3) as u32 } else { (mp - 9) as u32 }; + let y = if m <= 2 { y + 1 } else { y }; + (y, m, d, hour, minute, second) +} + diff --git a/crates/mail-mcp/src/tools.rs b/crates/mail-mcp/src/tools.rs new file mode 100644 index 0000000..a4ea54c --- /dev/null +++ b/crates/mail-mcp/src/tools.rs @@ -0,0 +1,260 @@ +//! `MailService` — the rmcp tool surface. +//! +//! Three tools exposed in v0.1: +//! - `mail_send` +//! - `mail_inbox_list` +//! - `mail_inbox_read` +//! +//! All tool methods return `Result` where the success path +//! holds a JSON-serialized payload and the error path is a pre-rendered +//! message string suitable for surfacing to the LLM. + +use std::sync::Arc; + +use rmcp::{ + model::{ServerCapabilities, ServerInfo}, + schemars, + tool, ServerHandler, +}; +use serde::Deserialize; + +use crate::config::Config; +use crate::{imap as imap_mod, smtp as smtp_mod}; + +// ============================================================================= +// service +// ============================================================================= + +#[derive(Clone)] +pub struct MailService { + inner: Arc, +} + +struct MailInner { + config: Config, +} + +impl MailService { + pub fn new(config: Config) -> Self { + Self { + inner: Arc::new(MailInner { config }), + } + } +} + +// ============================================================================= +// args +// ============================================================================= + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +pub struct AttachmentArg { + /// Filename as the recipient should see it. + pub filename: String, + /// Base64-encoded payload (no `data:` URI prefix). + pub content_base64: String, + /// MIME type, e.g. `application/pdf` or `image/png`. + pub mime_type: String, +} + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +pub struct SendArgs { + /// Account name to send from. Falls back to `default_account` from config. + #[serde(default)] + pub account: Option, + /// Recipient — single string or array of strings. + pub to: ToField, + #[serde(default)] + pub cc: Vec, + #[serde(default)] + pub bcc: Vec, + pub subject: String, + /// Plain-text body. Required even when also sending HTML (text part + /// shows up in `multipart/alternative` first per RFC 2046). + pub body: String, + /// Optional HTML body. When present, the message becomes + /// `multipart/alternative` (text first, then html). + #[serde(default)] + pub body_html: Option, + #[serde(default)] + pub attachments: Vec, + /// Message-ID of the parent message — sets `In-Reply-To` header. + #[serde(default)] + pub in_reply_to: Option, + /// Full thread chain of Message-IDs — sets `References` header. + #[serde(default)] + pub references: Vec, +} + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +#[serde(untagged)] +pub enum ToField { + One(String), + Many(Vec), +} + +impl ToField { + fn into_vec(self) -> Vec { + match self { + ToField::One(s) => vec![s], + ToField::Many(v) => v, + } + } +} + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +pub struct ListArgs { + #[serde(default)] + pub account: Option, + /// YYYY-MM-DD; passed as IMAP SINCE. + #[serde(default)] + pub since: Option, + /// If true, only list messages without the \Seen flag. + #[serde(default)] + pub unread_only: bool, + /// Max entries to return — default 50, max 500. + #[serde(default)] + pub limit: u32, + /// IMAP folder. Default `INBOX`. + #[serde(default)] + pub folder: Option, +} + +#[derive(Debug, Deserialize, schemars::JsonSchema)] +pub struct ReadArgs { + #[serde(default)] + pub account: Option, + /// UID of the message (stable across selects, unlike sequence numbers). + pub uid: u32, + /// IMAP folder. Default `INBOX`. + #[serde(default)] + pub folder: Option, + /// `text` (default) returns the text/plain part (falls back to html-stripped if absent). + /// `html` returns the html part. + /// `raw_eml` returns the full RFC822 source. + #[serde(default)] + pub format: Option, +} + +// ============================================================================= +// tools +// ============================================================================= + +#[tool(tool_box)] +impl MailService { + #[tool( + name = "mail_send", + description = "Send mail via Sulkta's SMTP relay. Sets RFC-correct Date, Message-ID (with own-domain), From, MIME-Version, User-Agent. Supports multipart/alternative when body_html is present and multipart/mixed when attachments are attached. Use `in_reply_to` + `references` for thread continuation. Returns JSON {message_id, sent_at}." + )] + async fn mail_send( + &self, + #[tool(aggr)] args: SendArgs, + ) -> Result { + let account = self + .inner + .config + .account(args.account.as_deref()) + .map_err(|e| e.to_string())?; + let input = smtp_mod::SendInput { + to: args.to.into_vec(), + cc: args.cc, + bcc: args.bcc, + subject: args.subject, + body: args.body, + body_html: args.body_html, + attachments: args + .attachments + .into_iter() + .map(|a| smtp_mod::AttachmentSpec { + filename: a.filename, + content_base64: a.content_base64, + mime_type: a.mime_type, + }) + .collect(), + in_reply_to: args.in_reply_to, + references: args.references, + }; + let out = smtp_mod::send(account, input) + .await + .map_err(|e| format!("{e:#}"))?; + serde_json::to_string(&serde_json::json!({ + "message_id": out.message_id, + "sent_at": out.sent_at, + })) + .map_err(|e| e.to_string()) + } + + #[tool( + name = "mail_inbox_list", + description = "List messages in an IMAP folder (default INBOX), newest UID first. Supports SINCE date (YYYY-MM-DD) and unread-only filter. Each entry has uid, message_id, from, to, subject, date, has_attachments, flags. Does NOT mark messages as read (BODY.PEEK). Returns JSON array." + )] + async fn mail_inbox_list( + &self, + #[tool(aggr)] args: ListArgs, + ) -> Result { + let account = self + .inner + .config + .account(args.account.as_deref()) + .map_err(|e| e.to_string())?; + let entries = imap_mod::list( + account, + imap_mod::ListOpts { + since: args.since, + unread_only: args.unread_only, + limit: args.limit, + folder: args.folder, + }, + ) + .await + .map_err(|e| format!("{e:#}"))?; + serde_json::to_string(&entries).map_err(|e| e.to_string()) + } + + #[tool( + name = "mail_inbox_read", + description = "Fetch one message by UID from an IMAP folder. format=text (default) returns the text/plain part, format=html returns the HTML part, format=raw_eml returns the full RFC822 source. Attachment payloads are NOT inlined — only filename/mime_type/size metadata. Does NOT mark as read." + )] + async fn mail_inbox_read( + &self, + #[tool(aggr)] args: ReadArgs, + ) -> Result { + let account = self + .inner + .config + .account(args.account.as_deref()) + .map_err(|e| e.to_string())?; + let out = imap_mod::read( + account, + args.uid, + args.folder.as_deref(), + args.format.as_deref().unwrap_or("text"), + ) + .await + .map_err(|e| format!("{e:#}"))?; + serde_json::to_string(&out).map_err(|e| e.to_string()) + } +} + +// ============================================================================= +// ServerHandler — capabilities must be set explicitly. rmcp 0.1.x's +// `#[tool(tool_box)]` does NOT auto-fill ServerInfo capabilities, so +// without `enable_tools()` the client reads an empty capability set and +// never asks for tools/list. (Same lesson aldabra learned the hard way.) +// ============================================================================= + +#[tool(tool_box)] +impl ServerHandler for MailService { + fn get_info(&self) -> ServerInfo { + ServerInfo { + capabilities: ServerCapabilities::builder().enable_tools().build(), + instructions: Some( + "mail-mcp — Rust MCP server for Sulkta-hosted email. \ + Tools: mail_send, mail_inbox_list, mail_inbox_read. \ + Default account from config; pass `account` to switch. \ + Reads use BODY.PEEK so they don't toggle the \\Seen flag." + .into(), + ), + ..Default::default() + } + } +}