KosmoKrator

communication

Mailgun CLI for AI Agents

Use the Mailgun CLI from KosmoKrator to call Mailgun tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write API key auth

Mailgun CLI Setup

Mailgun can be configured headlessly with `kosmokrator integrations:configure mailgun`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure mailgun --set api_key="$MAILGUN_API_KEY" --set domain="$MAILGUN_DOMAIN" --enable --read allow --write ask --json
kosmokrator integrations:doctor mailgun --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key MAILGUN_API_KEY Secret secret yes API Key
domain MAILGUN_DOMAIN Text text yes Sending Domain

Call Mailgun Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call mailgun.mailgun_get_current_user '{}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:mailgun mailgun_get_current_user '{}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs mailgun --json
kosmo integrations:docs mailgun.mailgun_get_current_user --json
kosmo integrations:schema mailgun.mailgun_get_current_user --json
kosmo integrations:search "Mailgun" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Mailgun.

mailgun.mailgun_get_current_user

Read read

Verify the Mailgun API connection and retrieve basic account info by listing domains.

Parameters
none

Generic CLI call

kosmo integrations:call mailgun.mailgun_get_current_user '{}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_get_current_user '{}' --json

mailgun.mailgun_get_domain

Read read

Get details and DNS records for a specific Mailgun domain.

Parameters
domain

Generic CLI call

kosmo integrations:call mailgun.mailgun_get_domain '{"domain":"example_domain"}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_get_domain '{"domain":"example_domain"}' --json

mailgun.mailgun_list_domains

Read read

List all domains in your Mailgun account with optional pagination.

Parameters
limit, skip

Generic CLI call

kosmo integrations:call mailgun.mailgun_list_domains '{"limit":1,"skip":1}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_list_domains '{"limit":1,"skip":1}' --json

mailgun.mailgun_list_messages

Read read

List message events in your Mailgun domain with optional filtering and pagination.

Parameters
limit, page, event, begin, end, ascending, recipient, subject

Generic CLI call

kosmo integrations:call mailgun.mailgun_list_messages '{"limit":1,"page":"example_page","event":"example_event","begin":"example_begin","end":"example_end","ascending":true,"recipient":"example_recipient","subject":"example_subject"}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_list_messages '{"limit":1,"page":"example_page","event":"example_event","begin":"example_begin","end":"example_end","ascending":true,"recipient":"example_recipient","subject":"example_subject"}' --json

mailgun.mailgun_list_routes

Read read

List all routes in your Mailgun account with optional pagination.

Parameters
limit, skip

Generic CLI call

kosmo integrations:call mailgun.mailgun_list_routes '{"limit":1,"skip":1}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_list_routes '{"limit":1,"skip":1}' --json

mailgun.mailgun_list_webhooks

Read read

List all webhooks configured for a Mailgun domain.

Parameters
domain

Generic CLI call

kosmo integrations:call mailgun.mailgun_list_webhooks '{"domain":"example_domain"}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_list_webhooks '{"domain":"example_domain"}' --json

mailgun.mailgun_send_email

Write write

Send an email via Mailgun. Specify from, to, subject, and text or HTML content.

Parameters
from, to, subject, text, html, cc, bcc, tag, reply_to

Generic CLI call

kosmo integrations:call mailgun.mailgun_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","text":"example_text","html":"example_html","cc":"example_cc","bcc":"example_bcc","tag":"example_tag"}' --json

Provider shortcut

kosmo integrations:mailgun mailgun_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","text":"example_text","html":"example_html","cc":"example_cc","bcc":"example_bcc","tag":"example_tag"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

mailgun.mailgun_get_current_user

Verify the Mailgun API connection and retrieve basic account info by listing domains.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

mailgun.mailgun_get_domain

Get details and DNS records for a specific Mailgun domain.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_get_domain --json
ParameterTypeRequiredDescription
domain string no The domain name to retrieve. Defaults to the configured sending domain.

mailgun.mailgun_list_domains

List all domains in your Mailgun account with optional pagination.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_list_domains --json
ParameterTypeRequiredDescription
limit integer no Maximum number of domains to return (default: 100, max: 1000).
skip integer no Number of domains to skip for pagination.

mailgun.mailgun_list_messages

List message events in your Mailgun domain with optional filtering and pagination.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_list_messages --json
ParameterTypeRequiredDescription
limit integer no Maximum number of events to return (default: 300, max: 300).
page string no Pagination cursor from a previous response.
event string no Filter by event type (e.g., "stored", "delivered", "failed", "rejected").
begin string no Start of time range in RFC 2822 or epoch format.
end string no End of time range in RFC 2822 or epoch format.
ascending boolean no Sort results in ascending order (default: no / descending).
recipient string no Filter by recipient email address.
subject string no Filter by email subject.

mailgun.mailgun_list_routes

List all routes in your Mailgun account with optional pagination.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_list_routes --json
ParameterTypeRequiredDescription
limit integer no Maximum number of routes to return (default: 100, max: 1000).
skip integer no Number of routes to skip for pagination.

mailgun.mailgun_list_webhooks

List all webhooks configured for a Mailgun domain.

Operation
Read read
Schema command
kosmo integrations:schema mailgun.mailgun_list_webhooks --json
ParameterTypeRequiredDescription
domain string no The domain name to list webhooks for. Defaults to the configured sending domain.

mailgun.mailgun_send_email

Send an email via Mailgun. Specify from, to, subject, and text or HTML content.

Operation
Write write
Schema command
kosmo integrations:schema mailgun.mailgun_send_email --json
ParameterTypeRequiredDescription
from string yes Sender email address, e.g. "My App <[email protected]>".
to array yes Array of recipient email addresses, e.g. ["[email protected]"] or ["John <[email protected]>"].
subject string yes The email subject line.
text string no Plain text body of the email. Required unless html is provided.
html string no HTML body of the email. Required unless text is provided.
cc array no Array of CC recipient email addresses.
bcc array no Array of BCC recipient email addresses.
tag array no Array of tag strings for categorization.
reply_to string no Reply-to email address.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.