mcpField
A
agentmail-cli

agentmail-cli

github.com/agentmail-toProductivity251.7k installsUpdated 2d ago
Repository

About agentmail-cli

AgentMail CLI is a command-line interface for managing AgentMail email resources. It supports inboxes, messages, drafts, pods, webhooks, and domains, with selectable output formats and response transformations.

Key features

  1. 01Manage inboxes and email messages
  2. 02List, read, and send threads
  3. 03Create and send drafts
  4. 04Organize inboxes with pods
  5. 05Configure webhooks and domains
  6. 06Choose output formats and transform responses

Use cases

  1. 01Managing an agent inbox from the command line
  2. 02Sending email or preparing drafts
  3. 03Reviewing messages and threads
  4. 04Administering pods, webhooks, and domains

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/agentmail-to/agentmail-skills --skill agentmail-cli

After installing, type/agentmail-cliin Claude Code to confirm it loaded.

Details

From the project README

AgentMail CLI

Install the CLI and provide the API key through the environment.

npm install -g agentmail-cli
export AGENTMAIL_API_KEY="am_..."

A resource nested under another is a nested subcommand, e.g. inboxes messages, inboxes threads, pods inboxes, pods threads (CLI 1.x; the colon form inboxes:messages is rejected). Run agentmail <resource> --help to list what a resource supports.

Inboxes

agentmail inboxes list
agentmail inboxes get --inbox-id <inbox_id>
agentmail inboxes create --display-name "Support Agent" --username support
agentmail inboxes delete --inbox-id <inbox_id>

Confirm the exact inbox before running the destructive delete command.

Messages and threads

agentmail inboxes messages list --inbox-id <inbox_id>
agentmail inboxes messages get --inbox-id <inbox_id> --message-id <message_id>

agentmail inboxes messages send --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Hello" \
  --text "Message body"

# HTML body instead of plain text
agentmail inboxes messages send --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Hello" \
  --html "<h1>Hello</h1>"

agentmail inboxes messages reply --inbox-id <inbox_id> \
  --message-id <message_id> \
  --text "Reply body"

agentmail inboxes messages forward --inbox-id <inbox_id> \
  --message-id <message_id> \
  --to "[email protected]"

agentmail inboxes threads list --inbox-id <inbox_id>
agentmail inboxes threads get --inbox-id <inbox_id> --thread-id <thread_id>

Use a message ID for replies. Fetch the full message before relying on body content.

Drafts

agentmail inboxes drafts create --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Pending approval" \
  --text "Draft body"

agentmail inboxes drafts list --inbox-id <inbox_id>
agentmail inboxes drafts get --inbox-id <inbox_id> --draft-id <draft_id>
agentmail inboxes drafts send --inbox-id <inbox_id> --draft-id <draft_id>

Pods

Pods group inboxes together.

agentmail pods create --name "My Pod"
agentmail pods list

agentmail pods inboxes create --pod-id <pod_id> --display-name "Pod Inbox"
agentmail pods inboxes list --pod-id <pod_id>

agentmail pods threads list --pod-id <pod_id>
agentmail pods threads get --pod-id <pod_id> --thread-id <thread_id>

Webhooks

agentmail webhooks create --url "https://example.com/webhook" --event-type message.received
agentmail webhooks list

Domains

agentmail domains create --domain example.com

# Optional: route bounce/complaint notifications to your inboxes.
agentmail domains create --domain example.com --feedback-enabled

agentmail domains verify --domain-id <domain_id>
agentmail domains get-zone-file --domain-id <domain_id>

Global flags

FlagPurpose
--api-keyOverride AGENTMAIL_API_KEY for this call
--base-urlPoint at a non-default API host
--environmentSelect a named environment
--formatOutput format (see below)
--format-errorControl structured error output
--transformGJSON projection of a successful response
--transform-errorGJSON projection of an error response
--debugVerbose request/response logging

Output formats

--format accepts: auto (default), pretty, json, jsonl, yaml, raw, explore.

Run agentmail --help and the relevant resource's --help before using an administrative command not covered here.

Comments

Markdown supported