TreeMap
무료 오픈소스 디스크 사용량 시각화 도구로, 사각형 트리맵·중복 파일 탐색·디스크 가득 예측·정리 시 파일을 휴지통으로만 이동한다
에이전시·전문가용 다중 도메인 이메일 플랫폼, 도메인당 1,000 메일함·SMTP 직접 연결·대시보드 하나로 관리·무료 시작
Multi-domain email platform for agencies and professionals. Manage 1,000+ domains, 1,000 mailboxes per domain, and BYO SMTP from one dashboard. Start free.
생산성TypeScript · JavaScriptGitHub @trekmail온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기TrekMail MCP server — connect AI agents (Claude Desktop, Claude Code, etc.) to TrekMail's email infrastructure. A variety of tools covering domains, DNS, mailboxes, migrations, webmail, and more.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
A Model Context Protocol (MCP) server that exposes the TrekMail API v1 as 272 agent tools. This is a thin adapter — all business logic lives in the TrekMail API; this server handles transport, authentication, retries, and safety gates.
For the hosted service, open TrekMail in the Claude directory, select Connect, sign in to TrekMail and approve the requested permissions. TrekMail is published as a Community connector. Available tools depend on the connected account's plan and permissions.README 전문 보기 ↗A Model Context Protocol (MCP) server that exposes the TrekMail API v1 as 284 agent tools. This is a thin adapter — all business logic lives in the TrekMail API; this server handles transport, authentication, retries, and safety gates.
Current release: package 1.14.1, catalogue 2026-10-14.3.
For the hosted service, open TrekMail in the Claude directory, select Connect, sign in to TrekMail and approve the requested permissions. TrekMail is published as a Community connector. Available tools depend on the connected account's plan and permissions.
For a White Label dashboard, add a custom connector using the MCP URL shown in that dashboard and your own brand name. The shared TrekMail listing signs in on TrekMail and does not replace your branded connection.
See the connection guide for other clients. The npm and Docker instructions below run the MCP adapter locally; the adapter still calls your configured TrekMail API.
git clone https://github.com/trekmail/mcp-server trekmail-mcp
cd trekmail-mcp
npm install
npm run build
TREKMAIL_BASE_URL=https://trekmail.net \
TREKMAIL_API_TOKEN=tm_live_your_token \
npm start
git clone https://github.com/trekmail/mcp-server trekmail-mcp
cd trekmail-mcp
docker build -t trekmail-mcp .
docker run -i \
-e TREKMAIL_BASE_URL=https://trekmail.net \
-e TREKMAIL_API_TOKEN=tm_live_your_token \
trekmail-mcp
The MCP server supports two independent token types. At least one is required:
| Token | Env Var | Prefix | Unlocks |
|---|---|---|---|
| Ops token | TREKMAIL_API_TOKEN | tm_live_ | 220 infrastructure tools (White Label branding, clients, team access, client storage limits and activity; domains; DNS; mailboxes; Drive; migrations; SMTP; tickets; account; billing; verifier; Cloudflare; and related administration) |
| Message token | TREKMAIL_MESSAGE_TOKEN | tm_msg_ | 64 message tools (messages, attachments, drafts, bulk actions, folders, scheduled send, contacts, contact groups, calendar, compose helpers, connected accounts, identities, templates, blocked senders) |
Tools are registered conditionally — only token types you provide get their tools. You can supply one or both:
# Infrastructure only
TREKMAIL_API_TOKEN=tm_live_your_token npm start
# Messages only
TREKMAIL_MESSAGE_TOKEN=tm_msg_your_token npm start
# Both
TREKMAIL_API_TOKEN=tm_live_your_token \
TREKMAIL_MESSAGE_TOKEN=tm_msg_your_token \
npm start
| Variable | Required | Default | Description |
|---|---|---|---|
TREKMAIL_BASE_URL | Yes | — | Your TrekMail instance URL |
TREKMAIL_API_TOKEN | At least one token | — | Ops token (must start with tm_live_) |
TREKMAIL_MESSAGE_TOKEN | At least one token | — | Message token (must start with tm_msg_) |
TREKMAIL_TIMEOUT_MS | No | 30000 | Request timeout in milliseconds |
TREKMAIL_USER_AGENT | No | trekmail-mcp/1.14.1 | User-Agent header |
TREKMAIL_ALLOW_DESTRUCTIVE | No | false | Enable high-impact changes (White Label access/branding, mailbox storage sizes and client storage limits, delete intents, domain deletion, forwarding, password changes, SMTP, credential revocation, Drive trash/purge, and message deletion) |
TREKMAIL_ALLOW_SENDING | No | false | Enable external sends, including send_message and White Label invitations |
TREKMAIL_ALLOW_MIGRATION | No | false | Enable migration write tools (start_migration, retry_migration, delete_migration, delete_bulk_migration, update_bulk_migration_job_password, test_migration_connection) |
TREKMAIL_TOOLSETS | No | all | Comma-separated product sets to register, for example email or email,contacts,calendar |
TREKMAIL_SCOPE_AWARE_REGISTRATION | No | true | Discover the token's effective capabilities and domain/mailbox constraints at startup and omit unusable tool schemas; set false only as a compatibility escape hatch |
TREKMAIL_READ_ONLY | No | false | Register read tools only, even when the token can write |
Tool visibility is the intersection of token capability, TREKMAIL_TOOLSETS,
TREKMAIL_READ_ONLY, and transport support. A token limited to some domains
also does not get update_account, set_client_limit or remove_client_limit,
which the API refuses to it whatever its scopes; update_account and
drive_folder_stop_sharing are withheld from a token limited to some mailboxes
(no mailbox stops a folder share, as in webmail). Runtime API authorization remains
authoritative. Account Drive and Mailbox Drive deliberately share one drive
toolset; all White Label capabilities share white_label. The concrete resource,
membership, entitlement, and token constraints decide what a call can access:
a token limited to some mailboxes, for one, reaches Account Drive only through
the folders shared with all mailboxes, as those mailboxes do in webmail.
Shared mailbox member tools require the matching shared mailbox permission
from your dashboard role as well as the mailbox API permission. Roles with
Read access can list members; changing members requires permission to manage
shared mailboxes.
Compact email, contacts, calendar, and email-settings selections also include
the existing read-only list_mailboxes tool so an agent can discover the
required mailbox ID without loading the full administration toolset.
For a normal mailbox project, this is the compact configuration:
TREKMAIL_MESSAGE_TOKEN=tm_msg_your_token \
TREKMAIL_TOOLSETS=email \
TREKMAIL_SCOPE_AWARE_REGISTRATION=true \
npm start
The full catalog is 284 tools over stdio. On the hosted HTTP transport
drive_file_uploadis intentionally not registered (itslocal_pathwould read files on our server — see the note insrc/tools/drive.ts), so the HTTP MCP exposes 283. Tools also split by token type: 64 need a message token (tm_msg_), the rest an ops token (tm_live_). These are full catalog totals. A directory profile or a restricted grant can expose a smaller set, including browser handoffs for sensitive setup.Safety gates apply to the whole list, not just the rows that say so. Read tools are always registered; every tool that creates, changes or deletes something needs
TREKMAIL_ALLOW_DESTRUCTIVE=true, the sending tools needTREKMAIL_ALLOW_SENDING, and the migration test tools needTREKMAIL_ALLOW_MIGRATION. Some entries below repeat their gate inline — the absence of that note does not mean a tool is ungated.
TREKMAIL_ALLOW_DESTRUCTIVE)confirm_remove: true (gated: TREKMAIL_ALLOW_DESTRUCTIVE)mail_hosting: "external" registers it as a sending-only domain: no MX record is asked for, it holds no mailboxes, and it serves purely as a verified From addressTREKMAIL_ALLOW_DESTRUCTIVE)external stops its mailboxes receiving, so it needs confirm_mailboxes_stop_receiving: trueTREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)These 23 tools are omitted unless White Label entitlement and the token's live scopes allow them. During cancellation grace, only the owner keeps read tools; writes and delegated access are removed.
TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_SENDING)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_SENDING)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)client_auth_mode (what mail apps may sign in with) where app passwords are availableauthentication.password_source and accepted_passwords say whether the mail app takes the mailbox password or an app password.mobileconfig file as Base64 (13 locales)storage_allocation_mb carves out dedicated storage from the account pool; omit for shared). Optional client_auth_mode; on an app_password_only mailbox the generated password opens TrekMail webmail only, so mail apps (classic webmail included) need create_mailbox_app_password nextmailbox_password_reset) (gated: TREKMAIL_ALLOW_DESTRUCTIVE)conversation_view preference, or its drive_access level (gated: TREKMAIL_ALLOW_DESTRUCTIVE)null) and a fixed size in MB, checked against the account pool and, in a domain under a client storage limit, that limit (gated: TREKMAIL_ALLOW_DESTRUCTIVE)drive_access on many mailboxes at once, chosen by explicit mailbox_ids, by domain_id, or all; shared mailboxes are skipped and counted (gated: TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)storage_allocation_mb pre-allocates dedicated storage; the recipient inherits it at redeem)storage_allocation_mb supported, each checked against what the earlier items left)TREKMAIL_ALLOW_DESTRUCTIVE)can_read / can_send permissions and access (read_send, read_only, send_only); Read opens the shared inbox and, when enabled, a shared IMAP foldercan_read and can_send default to true (gated: TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)Shared mailboxes never authenticate directly. Call get_mail_client_setup with a regular member mailbox id, wait for native_access_ready=true and (for sending) send_as_ready=true, then inspect shared_mailboxes.items[] for exact Inbox/Sent/Archive/Junk paths and allowed operations. SMTP does not save a Sent copy; configure the client to append it to the returned shared Sent folder. Send-only addresses appear in delegated_send_addresses as {id, email, display_name} even when shared IMAP is disabled. Add each as an extra From address using the member’s own sign-in and app password; no shared folder is available, and sent mail belongs in their own Sent. The Message API excludes delegated identities and cannot send or schedule as a team address with send-only access yet. Permission changes may return no_access_left, send_only_disabled or last_reader (422).
TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)targets array (one or more destinations), keep_copy, and destination_limit (the plan-tier cap so the agent can preflight an set_forwarding call without trial-and-error).targets array accepts up to 30 entries client-side; the server enforces the actual per-plan cap — Starter 5, Pro 15, Agency 30 — and returns a 422 limit_exceeded error with the cap if you pass more. CRLF / loop / self-forward / MX validation is run per destination, so a single bad entry rejects the whole save.TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE)confirm: true; the mailbox moves to the recycle bin and can be restored within the retention window (default 7 days), after which it is purged for good (gated: TREKMAIL_ALLOW_DESTRUCTIVE)domain_idmailbox_limit_reached when the domain is at its mailbox limit, or storage_pool_exceeded when its fixed size no longer fits the account's free storage or, in a domain under a White Label client storage limit, what that limit has left (gated: TREKMAIL_ALLOW_DESTRUCTIVE)Many message tools accept an optional
external_account_idto operate on a connected external mailbox (Gmail/Outlook/IMAP) instead of the primary mailbox. The id is always scoped to the token's mailbox (cross-mailbox access is impossible); discover valid ids withlist_external_accounts. Supported on:list_messages,read_message,send_message,move_message,update_message_flags,delete_message,list_folders,download_attachment,download_all_attachments,get_raw_message,save_draft,update_draft, andbulk_action(native actions only: read/unread/star/unstar/delete/move).report_spam/report_ham(andbulk_actionspam/notspam) train THIS server's spam filter, which doesn't apply to a remote provider, so they rejectexternal_account_id— move to the provider's Junk folder instead.
external_account_id)external_account_id)external_account_id, from a connected account via its own SMTP, or, with shared_mailbox_id, as a shared team mailbox where the acting member has both Read and Send as (dual safety gates, validates total recipients ≤ 10, requires body). The mailbox's Default CC/BCC apply exactly as they do in the web app; pass apply_default_recipients: false to skip them for one message. Delegated team identities for send-only members are excluded; use webmail or a mail app for those addresses. Returns once the message is accepted, not sent: confirm with get_message_delivery. A used-up sending allowance fails at once with sending_limit_exceeded, naming the allowance and when it renews (resets_at); it is never worth retrying before thensend_message accepted (pending, sending, sent, failed, delivery_uncertain), looked up by the request_id it returned; a message refused by a sending allowance reports which one and when it renews. Works with any message token for the same mailbox, not only the one that sent the message, so a later hosted session or a renewed token can check an earlier send; an unknown request_id is a 404remaining_today), the most recipients one message may have, when the allowance renews, and the API's own caps for this token. While the lowest allowance is the account-wide total, limit_today is null and so is remaining_today until that total is spent (then 0); an ops token reads the total with get_sending_limitsTREKMAIL_ALLOW_DESTRUCTIVE=true)Connect and manage external mailboxes (Gmail/Outlook/IMAP) the mailbox reads and sends through. Credentials are never returned by any tool.
external_account_id valuesTREKMAIL_ALLOW_MIGRATION=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_MIGRATION=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)timezone resolves naïve datetimes; explicit ISO offset always wins). Default CC/BCC are applied and stored with the message, so list_scheduled shows what will actually go out; apply_default_recipients: false opts out; pass shared_mailbox_id to schedule as a shared team mailbox you may send asTREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)shared_mailbox_id for the addresses of a shared mailbox you may send asexternal_account_id when that address's mail is read through a connected inbox, omit it when the mail is forwarded into this TrekMail mailbox insteadTREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE=true)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)The five tools above are the legacy account-level SMTP controls — deprecated for routing (kept for back-compat only). Use the per-domain SMTP routing + account-default tools below for outbound delivery configuration.
effective_smtp_mode resolves inherit to the account default)platform (managed) / profile (saved profile) / not_configured / inherit (follow the account default) (gated: TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)job_id) (gated: TREKMAIL_ALLOW_DESTRUCTIVE)job_iddefault_smtp_mode + effective_default_smtp_mode plan-baseline fallback)platform / profile / not_configured); optional apply_to_all switches every existing domain now (gated: TREKMAIL_ALLOW_DESTRUCTIVE)new_mailbox_client_auth_mode when both app passwords and the platform default for new mailboxes are enablednew_mailbox_client_auth_mode for future mailboxes; existing mailboxes retain their mode. Owner-only; requires mailboxes:write, both platform flags, and TREKMAIL_ALLOW_DESTRUCTIVEFor an agent buying without a human in the loop. These need the billing:autopay scope and TREKMAIL_ALLOW_DESTRUCTIVE. Each purchase takes two calls: without credential the answer is a 402 with the exact amount to authorise, then the same call with a credential minted for that amount.
spt_...); quantity must be a published tierpro or agency mail plan, monthly or yearly, with a Stripe PaymentMethod (pm_...) at full price; call agent_reissue_key afterwardssize_gb must be a published stepTREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_MIGRATION + confirm_start=true)confirm_cancel=true)TREKMAIL_ALLOW_MIGRATION + confirm_retry=true)TREKMAIL_ALLOW_MIGRATION + confirm_delete=true)TREKMAIL_ALLOW_MIGRATION)TREKMAIL_ALLOW_MIGRATION + confirm_start=true)confirm_cancel=true)TREKMAIL_ALLOW_MIGRATION + confirm_retry=true)confirm_resume=true)TREKMAIL_ALLOW_MIGRATION + confirm_delete=true)TREKMAIL_ALLOW_MIGRATION)type or recipientdomains:create)included_records ({ domain_id: [record_ids] }) previews only selected recordsincluded_records to write only chosen records and skip the rest (e.g. MX now, DKIM later); omit it to apply all. confirmed_conflicts authorises replacing records flagged as conflictingTREKMAIL_ALLOW_DESTRUCTIVE)Mutating tools on idempotent API routes generate deterministic idempotency keys from sha256(tool_name + canonical_params). This covers POST, PUT, PATCH, and DELETE White Label operations. It means:
idempotency_key parameter on any mutating toolDrafts are the deliberate exception. save_draft and update_draft generate a fresh random
key per call, so two identical calls really do save two drafts, and updating a draft back to earlier
content really does perform the update instead of replaying an old response. Pass your own
idempotency_key on those two tools when you want retry-dedup.
A failed send is not replayed. Once a send_message delivery has failed (on a sending limit,
for example), the API no longer answers the same call with the earlier accepted response, so the
same message with the same content can be sent again later. A retry of a send that is still
pending or was delivered still gets the original response.
Mailbox deletion requires two separate tool calls:
create_delete_intent → returns intent with 10-minute expiryconfirm_delete_intent → moves the mailbox to the recycle bin; restore_mailbox brings it back within the retention window (default 7 days), after which it is purged for goodBoth delete tools require TREKMAIL_ALLOW_DESTRUCTIVE=true. Without it, they return an error message explaining how to enable.
The confirm_delete_intent tool has an additional confirm: true parameter that must be explicitly set.
The send_message tool has two independent safety gates that must both pass:
TREKMAIL_ALLOW_SENDING=true must be set in the environmentconfirm_send=true must be passed as a parameterThis dual-gate design prevents accidental email sends. The agent must both be configured to allow sending and explicitly confirm each send.
The start_migration, retry_migration, and delete_migration tools require TREKMAIL_ALLOW_MIGRATION=true in the environment. cancel_migration is always available as a safety operation. test_migration_connection requires the gate because it makes outbound IMAP connections. Read-only tools (list_migrations, get_migration) work without any gate.
Additionally, each write tool requires a per-call confirmation parameter (confirm_start, confirm_cancel, or confirm_retry set to true).
{
"mcpServers": {
"trekmail": {
"command": "node",
"args": ["/path/to/trekmail-mcp/build/index.js"],
"env": {
"TREKMAIL_BASE_URL": "https://trekmail.net",
"TREKMAIL_API_TOKEN": "tm_live_your_token",
"TREKMAIL_MESSAGE_TOKEN": "tm_msg_your_token",
"TREKMAIL_ALLOW_SENDING": "true"
}
}
}
}
{
"mcpServers": {
"trekmail": {
"command": "node",
"args": ["/path/to/trekmail-mcp/build/index.js"],
"env": {
"TREKMAIL_BASE_URL": "https://trekmail.net",
"TREKMAIL_API_TOKEN": "tm_live_your_token",
"TREKMAIL_MESSAGE_TOKEN": "tm_msg_your_token",
"TREKMAIL_ALLOW_SENDING": "true"
}
}
}
}
1. dns_recheck(domain_id: 5) → { check_id: 42 }
2. get_dns_check(check_id: 42) → { status: "pending" }
3. (wait) get_dns_check(check_id: 42) → { status: "complete", results: {...} }
1. create_mailbox_generated_password(domain_id: 5, local_part: "alice")
→ { id: 10, email: "[email protected]", password: "..." }
2. set_forwarding(mailbox_id: 10, enabled: true, targets: ["[email protected]"], keep_copy: true)
# The generated password opens TrekMail webmail; Outlook, phones and calendars
# need an app password. Hand the secret to the user once and do not keep it.
# Ask for the mode explicitly: without client_auth_mode a new mailbox gets the
# platform default, password_or_app_password until the account-level default
# is switched on. The response's client_auth_mode is what was applied.
1. create_mailbox_generated_password(domain_id: 5, local_part: "dana", client_auth_mode: "app_password_only")
→ { id: 12, email: "[email protected]", client_auth_mode: "app_password_only", one_time_password: "..." }
2. create_mailbox_app_password(mailbox_id: 12, name: "Outlook on work laptop")
→ { data: { id: 31, name: "Outlook on work laptop", password: "abcdefghijklmnop" }, message: "Shown once. ..." }
3. get_mail_client_setup(mailbox_id: 12)
→ { authentication: { username: "[email protected]", password_source: "app_password",
accepted_passwords: ["app_password"], ... }, incoming: {...}, outgoing: {...} }
# Lost it later? rotate_mailbox_app_password(mailbox_id: 12, app_password_id: 31)
# returns a new secret and stops the old one at once.
# Fan one shared mailbox out to several humans.
1. create_mailbox_generated_password(domain_id: 5, local_part: "sales")
→ { id: 14, email: "[email protected]", password: "..." }
2. get_forwarding(mailbox_id: 14)
→ { enabled: false, targets: [], keep_copy: false, destination_limit: 15 } # Pro plan
3. set_forwarding(
mailbox_id: 14,
enabled: true,
targets: ["[email protected]", "[email protected]", "[email protected]"],
keep_copy: true # also leave a copy in sales@ for record-keeping
)
# Carve out 5 GB just for this mailbox — other shared mailboxes can't grow into it.
1. create_mailbox_generated_password(
domain_id: 5,
local_part: "ceo",
storage_allocation_mb: 5120
) → { id: 11, email: "[email protected]", password: "...", is_pooled_storage: false, storage_allocation_mb: 5120 }
# Mix shared and dedicated in one call. Each dedicated row is checked against
# the pool left when that row is created: rows that fit are created, and a row
# that no longer fits fails on its own with storage_pool_exceeded (207, or 422
# when every row fails).
1. bulk_create_mailboxes(items: [
{ domain_id: 5, local_part: "support" }, # shared
{ domain_id: 5, local_part: "founder", storage_allocation_mb: 10240 }, # 10 GB dedicated
{ domain_id: 5, local_part: "team-lead", storage_allocation_mb: 5120 }, # 5 GB dedicated
])
1. create_invite(domain_id: 5, local_part: "bob", recipient_email: "[email protected]")
→ { id: 1, status: "pending", invite_url: "..." }
# Pending dedicated invites count against the available pool until they
# are redeemed or expire — no over-committing.
1. create_invite(
domain_id: 5,
local_part: "exec",
recipient_email: "[email protected]",
storage_allocation_mb: 10240
) → { id: 2, status: "pending", storage_allocation_mb: 10240 }
# When the recipient redeems, the new mailbox inherits the 10 GB dedicated allocation.
# If the pool no longer fits at redeem time, the new mailbox falls back to shared
# (the recipient sees a notice on the success page) — redeem itself never fails.
1. create_delete_intent(mailbox_id: 10) → { id: 7, expires_at: "...", status: "pending" }
2. confirm_delete_intent(intent_id: 7, confirm: true) → { status: "confirmed" }
1. list_messages(folder: "INBOX", limit: 10, unread_only: true)
→ { messages: [...], pagination: { has_more: true, next_before_uid: 45, next_before_date: 1760000000 } }
2. list_messages(folder: "INBOX", limit: 10, unread_only: true, before_uid: 45, before_date: 1760000000)
→ the next page: send both cursor halves (messages are ordered by date, not UID)
3. read_message(uid: 50) → { from, subject, body_text, body_html, attachments: [...] }
1. test_migration_connection(source_host: "imap.gmail.com", source_port: 993, source_security: "ssl", source_email: "[email protected]", source_password: "app-password")
→ { success: true, folders: { "INBOX": 1234, "Sent": 567, ... } }
2. start_migration(mailbox_id: 10, provider: "gmail", source_host: "imap.gmail.com", source_port: 993, source_security: "ssl", source_email: "[email protected]", source_password: "app-password", target_password: "mailbox-pass", confirm_start: true)
→ { id: 5, status: "pending", ... }
3. get_migration(id: 5) → { status: "processing", progress: 45, folders: [...] }
4. (poll) get_migration(id: 5) → { status: "completed", progress: 100, imported_messages: 1801 }
1. send_message(
to: ["[email protected]"],
subject: "Weekly Report",
body_text: "Please find the report attached.",
confirm_send: true,
idempotency_key: "weekly-report-2026-02-07"
) → { status: "queued", message_id: "[email protected]", queued_at: "..." }
42 tools for the /api/v1/drive/* REST surface (38 file/folder/share/addon
tools + 4 sync-device password tools added 2026-05-23). Drive is available
through both the TrekMail REST API and this MCP server when the ops token
has the matching Drive scopes. See the TrekMail app/API docs for the full
REST reference.
| Tool | Purpose |
|---|---|
drive_spaces_list | List Drive spaces this token can enumerate (account_drive + per-mailbox) |
drive_storage_summary | Account-wide pool snapshot (used / limit / addon flags) |
drive_space_usage | Per-space quota snapshot |
drive_browse_folder | Cursor-paginated listing of one folder's files + subfolders |
drive_folder_tree | Flat tree of every folder in a space |
drive_select_all_ids | Bulk-select helper (capped at 5000 ids) |
drive_file_get | File metadata |
drive_file_download_url | Short-lived download URL (forced attachment) |
drive_file_rename / _move / _trash / _restore / _purge | File CRUD |
drive_folder_create / _update / _move / _trash / _restore / _purge | Folder CRUD; _update accepts name and/or color (#RRGGBB); _create accepts is_shared to publish to the whole account immediately |
drive_folder_share_with_account / _stop_sharing | Toggle whether a folder is visible to every mailbox in the account (Phase H — moves the folder + subtree from mailbox-personal Drive to account-drive when needed). A mailbox under a client storage limit cannot share out and does not see shared folders (shared_folder_client_storage_limit). Stopping a share needs a connection that is not restricted to mailboxes (shared_folder_stop_sharing_admin_only) |
drive_trash_list / _empty | Trash listing + nuke |
drive_bulk_trash / _restore / _move / _purge | One call, N items (cap 5000) |
drive_share_create / _list / _revoke | Public share-links (raw token returned ONCE) |
{space} parameters accept "account" (account-drive singleton),
"mailbox:N" (mailbox-personal), or a numeric DriveSpace.id.
Drive scopes light up for any account on a paid plan OR with an
active Drive Storage Add-on (mirrors how verify:* works for the
Email Verifier). Free + addon active is a fully supported path —
mint a token with drive:account:read etc. and it works. When the
addon enters its 7-day post-cancellation grace window, write/share/
purge tokens lose access; read tokens keep working.
Drive API/MCP scopes:
| Scope | Enables |
|---|---|
drive:account:read | Browse Account Drive, inspect metadata, list folders/trash/share links, and request download URLs |
drive:account:write | Upload files, create/update/move/trash/restore files and folders in Account Drive |
drive:account:share | Create and revoke public share links for Account Drive files; with drive:account:write, share a folder with all mailboxes or stop sharing it |
drive:account:purge | Permanently purge trashed Account Drive files/folders and empty trash |
drive:mailbox:read | Browse mailbox Drive spaces allowed by token mailbox constraints |
drive:mailbox:write | Upload and mutate files/folders in allowed mailbox Drive spaces |
drive:mailbox:share | Create and revoke public share links for allowed mailbox Drive files |
drive:mailbox:purge | Permanently purge trashed files/folders in allowed mailbox Drive spaces |
drive:addon:read | Read Drive Storage Add-on status, pricing, and cancellation preview |
Default — drive_file_upload (one tool, all three steps):
drive_file_upload(space="account", local_path="/path/to/report.pdf",
folder_id=42, client_mime="application/pdf")
The wrapper:
drive_upload_initiate.drive_upload_complete to register the file as available.drive_upload_abort to release
the quota reservation. (The reservation is also reclaimed by the
server-side cleanup — abort is a fast path, not a guarantee.)Before anything is reserved, the wrapper checks the local file: a regular
file under $HOME or the temp directory (or under TREKMAIL_UPLOAD_DIR,
colon-separated), outside sensitive locations (~/.ssh, ~/.aws, /etc, …),
not named .env*, and with no second hard link. It opens the file once and
reads every byte from that handle, so replacing the path mid-upload changes
nothing.
Low-level primitives (drive_upload_initiate etc.) stay available
for agents that want to drive the PUT phase themselves — e.g. uploads
from a remote source instead of the MCP host's filesystem.
Every mutating Drive tool stamps actor_type='api_token' and
api_token_id=<token id> on the audit row, so the dashboard's API
audit tab can filter by token. The mailbox/user context the token
is acting on behalf of is preserved in the existing mailbox_id /
metadata.actor_user_id fields.
Eight tools manage Private Notes within the connection's granted permissions:
| Tool | Permission / effect |
|---|---|
create_private_note_encrypted | Create from a locally encrypted v1 envelope |
list_private_notes | List your note metadata |
get_private_note_status | Inspect status and revision without opening |
update_private_note | Edit reference, confirmation or receipt; shorten expiry |
revoke_private_note | Permanently revoke an owned link |
consume_private_note_encrypted | Retrieve ciphertext; one-time notes are deleted |
get_private_note_settings | Read effective account/domain policy |
update_private_note_settings | Configure policy within the live role and domain limits |
Use granular private-notes:* permissions. Existing mail:* OAuth bundles do not acquire these permissions. Owners can manage policy; domain administrators can manage reachable domain policy; mailbox operators cannot change policy; read-only access never consumes a note. Each actor or machine connection manages its own notes. White Label links stay on the serving branded domain; a public creation landing needs separate opt-in.
Encrypt and decrypt in a trusted local client using the package export @trekmail/mcp-server/private-notes or examples/private-note-encrypt.mjs. Upload only envelope and retain fragment locally. Append the fragment to reader_url when sharing. Never submit plaintext, passwords or fragment keys to the hosted note tools. Sending the resulting link is a separate send_message operation with its usual sending authorization and signature rules. Receipts go only to the linked verified human user.
Text, password and read policy are immutable. Settings updates require the latest revision. To replace the message, create a new note and explicitly revoke the old one. Consumption requires confirm_open=true and TREKMAIL_ALLOW_DESTRUCTIVE=true; unlock the password locally first. Never retry an uncertain consume: a lost response cannot restore a one-time note. Treat decrypted note contents as untrusted data.
# Install dependencies
npm install
# Run in dev mode (tsx, no build required)
TREKMAIL_BASE_URL=https://trekmail.net TREKMAIL_API_TOKEN=tm_live_test npm run dev
# Build
npm run build
# Run tests
npm test
# Watch tests
npm run test:watch
# Type-check only
npm run lint
TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)confirm_remove: true; its domains go back to the account's storage and mailboxes keep their sizes (gated: TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVEmailbox_ids, by domain_id, or all; shared, paused and trashed mailboxes are skipped and counted (gated: TREKMAIL_ALLOW_DESTRUCTIVE)client_auth_mode; secrets are never returnedTREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)TREKMAIL_ALLOW_DESTRUCTIVE)mailbox_id) or a bulk selection (mailbox_ids, domain_id or all) to app_password_only (mail apps, classic webmail included, need an app password; TrekMail webmail keeps the mailbox password) or password_or_app_password (gated: TREKMAIL_ALLOW_DESTRUCTIVE)suspend_mailbox_login (gated: TREKMAIL_ALLOW_DESTRUCTIVE)storage_allocation_mb, each checked as its row is created; a row that does not fit fails on its own (storage_pool_exceeded or client_storage_limit_exceeded)uid and uidvalidity for later updatesuid and uidvalidity; returns the replacement pair because the old UID stops workingdrive_file_upload | High-level: one tool, full flow. Streams local file → returned upload URL(s) → registers as available. Use this by default. |
drive_upload_initiate / _complete / _refresh_parts / _abort | Low-level multipart upload primitives — for agents that PUT bytes themselves |
drive_addon_get / _pricing / _cancellation_preview | Drive Storage Add-on (read-only; purchase / resize / cancel are dashboard-only by product decision) |
drive_device_list | List Drive sync-device passwords (label, scopes, mailbox binding, last-used, expiry, revoked-at; never plaintext) |
drive_device_create | Mint a new dsync_… credential for rclone / Cyberduck / X-Plore / DAVx⁵ / Documents / FolderSync. Plaintext returned ONCE in data.password. Rate-limited 20/h per account |
drive_device_revoke / drive_device_rotate | Revoke a device password (idempotent) or atomically rotate (revoke old + mint new, inherits label / scopes / mailbox). Both gated by TREKMAIL_ALLOW_DESTRUCTIVE=true. Rotate is rate-limited 10/h per account |