{
    "$schema": "https://static.modelcontextprotocol.io/schemas/mcp-server-card/v1.json",
    "version": "1.0",
    "protocolVersion": "2025-06-18",
    "serverInfo": {
        "name": "mailbaby-mail-api",
        "title": "MailBaby Mail API",
        "version": "1.0.0"
    },
    "title": "MailBaby Mail API",
    "description": "MCP server backed by the MailBaby Mail Delivery API. Every OpenAPI operation is exposed as an MCP tool. Authenticate with X-API-KEY.",
    "documentationUrl": "https://api.mailbaby.net/spec/openapi.yaml",
    "iconUrl": "https://api.mailbaby.net/favicon.ico",
    "transport": {
        "type": "streamable-http",
        "endpoint": "/mcp",
        "url": "https://api.mailbaby.net/mcp",
        "methods": [
            "POST",
            "GET",
            "DELETE",
            "OPTIONS"
        ]
    },
    "authentication": {
        "required": true,
        "schemes": [
            {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-KEY",
                "description": "MailBaby API key from https://my.interserver.net/account_security"
            }
        ]
    },
    "capabilities": {
        "tools": {
            "listChanged": false
        },
        "resources": {},
        "prompts": {}
    },
    "instructions": "Authenticate every call with X-API-KEY. Use getMailOrders to discover your sending account ids before sending. Tools that mutate state (deleteRule, delistBlock) carry the [DESTRUCTIVE] tag in their description.",
    "tools": [
        {
            "name": "pingServer",
            "title": "Health check — verify the API is reachable",
            "description": "[GET /ping] [Status] Health check — verify the API is reachable\n\n**No authentication required.** Returns the plain-text string `Server is up and running` with a `200` status when the API host is reachable. Use this as a connectivity smoke-test before attempting any authenticated call. Useful for uptime monitoring, load-balancer health checks, and CI smoke tests.",
            "inputSchema": {
                "type": "object"
            }
        },
        {
            "name": "getMailOrders",
            "title": "List your provisioned mail orders (sending accounts)",
            "description": "[GET /mail] [Services] List your provisioned mail orders (sending accounts)\n\nUse this **before sending** if you need to discover which mail order `id` to pass to `/mail/send`, `/mail/advsend`, `/mail/rawsend`, `/mail/log`, or `/mail/stats`. Returns every mail order (active **and** canceled) on your account. Each record includes the numeric `id`, the `status` (`active` or `canceled`), the SMTP `username` (always `mb<id>`), and an optional `comment`.\n\nThe `id` values returned here are used as the `id` input parameter on all sending endpoints (`/mail/send`, `/mail/advsend`, `/mail/rawsend`) as well as the log and stats queries.  When the `id` parameter is omitted on those calls the API automatically picks the **first active** order returned by this endpoint.\n\nTo retrieve full details — including the current SMTP password — for a single order use `GET /mail/{id}`.",
            "inputSchema": {
                "type": "object"
            }
        },
        {
            "name": "getMailOrderById",
            "title": "Get one mail order's full detail including SMTP password",
            "description": "[GET /mail/{id}] [Services] Get one mail order's full detail including SMTP password\n\n**Returns the SMTP password** in addition to the basic `GET /mail` fields. Use when you need to authenticate against `relay.mailbaby.net:25` from an SMTP client directly. Required: `id` (path; obtain from `GET /mail`). Returns the full detail record for one specific mail order identified by its numeric `id`.\n\nThe `username` and `password` values returned here can be used directly to authenticate against `relay.mailbaby.net:25` (SMTP AUTH) if you need to send email via a native SMTP client rather than through the REST API.\n\nThe `id` path parameter is the same integer `id` value returned by `GET /mail`.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int64",
                        "description": "The numeric ID of the mail order.",
                        "example": 39
                    }
                },
                "required": [
                    "id"
                ]
            }
        },
        {
            "name": "sendMail",
            "title": "Send a simple email (single recipient, plain or HTML)",
            "description": "[POST /mail/send] [Sending] Send a simple email (single recipient, plain or HTML)\n\n**Use this for the simplest case** — one or a few plain-string recipients, no attachments, no CC/BCC, no named contacts. Required: `from`, `to`, `subject`, `body`. Optional: `id` (selects which mail order to send through; auto-selects your first active order if omitted). Sends through one of your mail orders using a flat set of fields.\n\n**HTML detection** is automatic — if the `body` value contains any HTML tags the message will be sent as `text/html`; otherwise it is sent as `text/plain`.\n\nThe `from` address is also automatically set as the `Reply-To` header.\n\n*Note*: If you need to send to multiple recipients, add CC/BCC, or include file attachments, use `POST /mail/advsend` instead.  If you have a pre-built RFC 822 message (e.g. already DKIM-signed), use `POST /mail/rawsend`.\n",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "to": {
                        "description": "The primary recipient address for a simple send request. Accepts a single email address string or an array of email address strings for multiple recipients.",
                        "example": "johndoe@company.com",
                        "oneOf": [
                            {
                                "type": "string",
                                "description": "Single recipient email address.",
                                "format": "email",
                                "example": "johndoe@company.com"
                            },
                            {
                                "type": "array",
                                "description": "Multiple recipient email addresses.",
                                "example": [
                                    "johndoe@company.com",
                                    "janedoe@company.com"
                                ],
                                "items": {
                                    "type": "string",
                                    "format": "email"
                                }
                            }
                        ]
                    },
                    "from": {
                        "type": "string",
                        "description": "The sender address.  This is used as both the `From` header and the `Reply-To` header automatically.  Must be a valid email address authorized for your mail order.",
                        "format": "email",
                        "example": "janedoe@company.com"
                    },
                    "subject": {
                        "type": "string",
                        "description": "The subject line of the email.",
                        "example": "Attention Client"
                    },
                    "body": {
                        "type": "string",
                        "description": "The email body.  If the string contains any HTML tags the message is automatically sent as `text/html`; otherwise it is sent as `text/plain`.",
                        "example": "This is an email to inform you that something noteworthy happened."
                    },
                    "id": {
                        "type": "integer",
                        "description": "Optional numeric ID of the mail order to send through.  If omitted the first active order on your account is used automatically.  Valid IDs are returned by `GET /mail`.",
                        "format": "int64",
                        "example": 2604
                    }
                },
                "required": [
                    "to",
                    "from",
                    "subject",
                    "body"
                ]
            }
        },
        {
            "name": "rawMail",
            "title": "Send a pre-built RFC 822 message verbatim (preserves DKIM)",
            "description": "[POST /mail/rawsend] [Sending] Send a pre-built RFC 822 message verbatim (preserves DKIM)\n\n**Use this when you have already built (and possibly DKIM-signed) the full RFC 822 message yourself** and want the relay to transmit it byte-for-byte. Required: `raw_email` (full RFC 822 string with headers + body). Optional: `id` (mail order to authenticate as). Accepts a complete, pre-built RFC 822 email message (headers + body) as a string and injects it into the relay without any modification.\n\nThis endpoint is particularly useful when the message has already been **DKIM-signed** — because the relay transmits the exact bytes you provide, the DKIM signature remains intact. If you use the other sending endpoints the relay may add or reorder headers, breaking an existing signature.\n\nThe `From` and recipient addresses are parsed automatically from the message headers (`From`, `To`, `Cc`, `Bcc`).",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "raw_email": {
                        "type": "string",
                        "description": "The complete RFC 822 email message including all headers and the body. Must include at minimum `From`, `To`, `Subject`, `Date`, and `MIME-Version` headers.  DKIM signatures in the `DKIM-Signature` header are transmitted verbatim and will pass verification at the destination."
                    },
                    "id": {
                        "type": "integer",
                        "description": "Optional numeric ID of the mail order to use for SMTP authentication. If omitted the first active order on your account is used.  Valid IDs are returned by `GET /mail`.",
                        "format": "int64"
                    }
                },
                "required": [
                    "raw_email"
                ]
            }
        },
        {
            "name": "sendAdvMail",
            "title": "Send email with multiple recipients, CC/BCC, attachments, named contacts",
            "description": "[POST /mail/advsend] [Sending] Send email with multiple recipients, CC/BCC, attachments, named contacts\n\n**Use this when the simple send is not enough** — multiple recipients, CC/BCC, named contacts, custom Reply-To, or file attachments. Required: `from`, `to`, `subject`, `body`. Optional: `cc`, `bcc`, `replyto`, `attachments` (array of `{filename,data}` with base64 data), `id`. Sends through one of your mail orders with full control over recipients, headers, and attachments.\n\n**Content-type flexibility** — the request body may be submitted as either `application/x-www-form-urlencoded` or `application/json`.  When using form encoding, address fields (`from`, `to`, `replyto`, `cc`, `bcc`) accept both a plain RFC 822 comma-separated string (e.g. `\"Joe <joe@example.com>, jane@example.com\"`) and the structured `[{\"email\":\"...\",\"name\":\"...\"}]` array format.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "subject": {
                        "type": "string",
                        "description": "The subject line of the email.",
                        "example": "Your Package has been Delivered!"
                    },
                    "body": {
                        "type": "string",
                        "description": "The email body.  If the string contains any HTML tags the message is automatically sent as `text/html`; otherwise it is sent as `text/plain`.",
                        "example": "The package you ordered on 2021-01-23 has been delivered."
                    },
                    "from": {
                        "description": "The sender address.  Accepts a plain email string, an RFC 822 named string (`\"Name <email>\"`), or a `{\"email\": \"...\", \"name\": \"...\"}` object.",
                        "allOf": [
                            {
                                "description": "A flexible single email address that accepts either a plain address string, an RFC 822 named-address string (`\"Name <email>\"`), or a structured contact object.",
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "description": "A single email address or RFC 822 named-address string. Example: `\"user@domain.com\"` or `\"Joe <user@domain.com>\"`.",
                                        "example": "Joe <user@domain.com>"
                                    },
                                    {
                                        "type": "object",
                                        "description": "An email contact with an optional display name.  Used in structured address fields (`from`, `to`, `cc`, `bcc`, `replyto`) in `SendMailAdv`.",
                                        "example": {
                                            "email": "user@domain.com",
                                            "name": "John Smith"
                                        },
                                        "properties": {
                                            "email": {
                                                "type": "string",
                                                "description": "The email address.",
                                                "format": "email",
                                                "example": "user@domain.com"
                                            },
                                            "name": {
                                                "type": "string",
                                                "description": "Optional display name shown to recipients (e.g. in the `From:` header).",
                                                "example": "John Smith"
                                            }
                                        },
                                        "required": [
                                            "email"
                                        ]
                                    }
                                ]
                            }
                        ]
                    },
                    "to": {
                        "description": "One or more destination addresses.  Accepts a comma-separated RFC 822 string or an array of contact objects.",
                        "allOf": [
                            {
                                "description": "A flexible email address list that accepts either a plain RFC 822 string or a structured array of contact objects.  When a string is provided it is parsed as a comma-separated list of RFC 822 addresses (supporting the `\"Name <email>\"` and bare `email` formats).  When an array is provided each entry must have at least an `email` field with an optional `name` field.",
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "description": "A single email address or RFC 822 comma-separated list. Example: `\"joe@example.com\"` or `\"Joe <joe@example.com>, jane@example.com\"`.",
                                        "example": "Joe <joe@example.com>"
                                    },
                                    {
                                        "type": "array",
                                        "description": "An array of email contacts, each with an email address and optional display name.",
                                        "example": [
                                            {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            }
                                        ],
                                        "items": {
                                            "type": "object",
                                            "description": "An email contact with an optional display name.  Used in structured address fields (`from`, `to`, `cc`, `bcc`, `replyto`) in `SendMailAdv`.",
                                            "example": {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            },
                                            "properties": {
                                                "email": {
                                                    "type": "string",
                                                    "description": "The email address.",
                                                    "format": "email",
                                                    "example": "user@domain.com"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Optional display name shown to recipients (e.g. in the `From:` header).",
                                                    "example": "John Smith"
                                                }
                                            },
                                            "required": [
                                                "email"
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "replyto": {
                        "description": "Optional.  One or more addresses to set as the `Reply-To` header. When recipients reply to the message their email client will address the reply to these addresses instead of `from`.",
                        "allOf": [
                            {
                                "description": "A flexible email address list that accepts either a plain RFC 822 string or a structured array of contact objects.  When a string is provided it is parsed as a comma-separated list of RFC 822 addresses (supporting the `\"Name <email>\"` and bare `email` formats).  When an array is provided each entry must have at least an `email` field with an optional `name` field.",
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "description": "A single email address or RFC 822 comma-separated list. Example: `\"joe@example.com\"` or `\"Joe <joe@example.com>, jane@example.com\"`.",
                                        "example": "Joe <joe@example.com>"
                                    },
                                    {
                                        "type": "array",
                                        "description": "An array of email contacts, each with an email address and optional display name.",
                                        "example": [
                                            {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            }
                                        ],
                                        "items": {
                                            "type": "object",
                                            "description": "An email contact with an optional display name.  Used in structured address fields (`from`, `to`, `cc`, `bcc`, `replyto`) in `SendMailAdv`.",
                                            "example": {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            },
                                            "properties": {
                                                "email": {
                                                    "type": "string",
                                                    "description": "The email address.",
                                                    "format": "email",
                                                    "example": "user@domain.com"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Optional display name shown to recipients (e.g. in the `From:` header).",
                                                    "example": "John Smith"
                                                }
                                            },
                                            "required": [
                                                "email"
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "cc": {
                        "description": "Optional.  Carbon-copy recipients.  These addresses are listed in the `Cc` header and are visible to all recipients.",
                        "allOf": [
                            {
                                "description": "A flexible email address list that accepts either a plain RFC 822 string or a structured array of contact objects.  When a string is provided it is parsed as a comma-separated list of RFC 822 addresses (supporting the `\"Name <email>\"` and bare `email` formats).  When an array is provided each entry must have at least an `email` field with an optional `name` field.",
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "description": "A single email address or RFC 822 comma-separated list. Example: `\"joe@example.com\"` or `\"Joe <joe@example.com>, jane@example.com\"`.",
                                        "example": "Joe <joe@example.com>"
                                    },
                                    {
                                        "type": "array",
                                        "description": "An array of email contacts, each with an email address and optional display name.",
                                        "example": [
                                            {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            }
                                        ],
                                        "items": {
                                            "type": "object",
                                            "description": "An email contact with an optional display name.  Used in structured address fields (`from`, `to`, `cc`, `bcc`, `replyto`) in `SendMailAdv`.",
                                            "example": {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            },
                                            "properties": {
                                                "email": {
                                                    "type": "string",
                                                    "description": "The email address.",
                                                    "format": "email",
                                                    "example": "user@domain.com"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Optional display name shown to recipients (e.g. in the `From:` header).",
                                                    "example": "John Smith"
                                                }
                                            },
                                            "required": [
                                                "email"
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "bcc": {
                        "description": "Optional.  Blind-carbon-copy recipients.  These addresses receive the message but are not listed in any visible header.",
                        "allOf": [
                            {
                                "description": "A flexible email address list that accepts either a plain RFC 822 string or a structured array of contact objects.  When a string is provided it is parsed as a comma-separated list of RFC 822 addresses (supporting the `\"Name <email>\"` and bare `email` formats).  When an array is provided each entry must have at least an `email` field with an optional `name` field.",
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "description": "A single email address or RFC 822 comma-separated list. Example: `\"joe@example.com\"` or `\"Joe <joe@example.com>, jane@example.com\"`.",
                                        "example": "Joe <joe@example.com>"
                                    },
                                    {
                                        "type": "array",
                                        "description": "An array of email contacts, each with an email address and optional display name.",
                                        "example": [
                                            {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            }
                                        ],
                                        "items": {
                                            "type": "object",
                                            "description": "An email contact with an optional display name.  Used in structured address fields (`from`, `to`, `cc`, `bcc`, `replyto`) in `SendMailAdv`.",
                                            "example": {
                                                "email": "user@domain.com",
                                                "name": "John Smith"
                                            },
                                            "properties": {
                                                "email": {
                                                    "type": "string",
                                                    "description": "The email address.",
                                                    "format": "email",
                                                    "example": "user@domain.com"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Optional display name shown to recipients (e.g. in the `From:` header).",
                                                    "example": "John Smith"
                                                }
                                            },
                                            "required": [
                                                "email"
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "attachments": {
                        "type": "array",
                        "description": "Optional list of file attachments.  Each file must be base64-encoded. Include `filename` so recipients see a meaningful attachment name.",
                        "items": {
                            "type": "object",
                            "description": "A file attachment for use with `POST /mail/advsend`.  The file content must be base64-encoded.  The `filename` is shown to recipients in their email client.",
                            "example": {
                                "filename": "file.txt",
                                "data": "aGVsbG8gdGhlcmUK"
                            },
                            "properties": {
                                "filename": {
                                    "type": "string",
                                    "description": "The filename shown to recipients (e.g. `report.pdf`, `invoice.xlsx`).",
                                    "example": "message.txt"
                                },
                                "data": {
                                    "type": "string",
                                    "description": "The file contents as a base64-encoded string.  Decode this to retrieve the original binary file.",
                                    "format": "byte",
                                    "example": "aGVsbG8gdGhlcmUK"
                                }
                            },
                            "required": [
                                "data",
                                "filename"
                            ]
                        }
                    },
                    "id": {
                        "type": "integer",
                        "description": "Optional numeric ID of the mail order to send through.  If omitted the first active order on your account is used automatically.  Valid IDs are returned by `GET /mail`.",
                        "format": "int64",
                        "example": 5000
                    }
                },
                "required": [
                    "from",
                    "to",
                    "subject",
                    "body"
                ]
            }
        },
        {
            "name": "viewMailLog",
            "title": "Query the mail delivery log (filterable, paginated)",
            "description": "[GET /mail/log] [History] Query the mail delivery log (filterable, paginated)\n\n**Use this to find or audit sent messages.** All filters are optional and combinable. The most useful filters: `mailid` (the transaction id returned by a send call), `from` / `to` (envelope addresses), `subject`, `messageId` (case-insensitive substring on the `Message-ID` header), `delivered` (`1`=delivered, `0`=queued/failed), and the `startDate`/`endDate` date range. Returns a paginated list of every email message accepted by the relay for your mail account(s).\n\n**Row grouping** is controlled by the `groupby` parameter.  By default (`groupby=recipient`), the response contains one row per delivery attempt — so a single message sent to 4 recipients produces 4 rows, each with its own `recipient`, `delivered`, `response`, and `mxHostname` values.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int64",
                        "description": "The numeric ID of the mail order to filter by.  When omitted, logs from the first active mail order are returned.  Obtain valid IDs from `GET /mail` or `GET /mail/{id}`.",
                        "example": 2604
                    },
                    "origin": {
                        "type": "string",
                        "description": "Filter by the originating IP address from which the message was submitted to the relay.  Must be a valid IPv4 or IPv6 address.",
                        "example": "1.2.3.4"
                    },
                    "mx": {
                        "type": "string",
                        "description": "Filter by the MX hostname the relay attempted delivery to.  For example `mx.google.com` would return messages destined for Gmail recipients. Maps to `mxHostname` in the `MailLogEntry` response.",
                        "example": "mx.google.com"
                    },
                    "from": {
                        "type": "string",
                        "format": "email",
                        "description": "Filter by SMTP envelope `MAIL FROM` address (exact match).  This is the address the relay used for bounce handling and may differ from the `From:` message header.  For header-level filtering use `headerfrom`.",
                        "example": "me@sender.com"
                    },
                    "to": {
                        "type": "string",
                        "format": "email",
                        "description": "Filter by SMTP envelope `RCPT TO` address (exact match).  This is the delivery address used by the relay and may differ from the `To:` header when BCC recipients are involved.",
                        "example": "you@receiver.com"
                    },
                    "subject": {
                        "type": "string",
                        "description": "Filter by email `Subject` header (exact match).  To search for a substring, include it in the full subject text.",
                        "example": "Your order has shipped"
                    },
                    "mailid": {
                        "type": "string",
                        "minLength": 18,
                        "maxLength": 19,
                        "description": "Filter by the relay-assigned mail ID string (exact match).  This corresponds to the `id` field in `MailLogEntry` and to the `text` value returned by the sending endpoints on success.  Format is an 18–19 character hexadecimal string such as `185997065c60008840`.",
                        "example": "185997065c60008840"
                    },
                    "messageId": {
                        "type": "string",
                        "description": "Filter by the `Message-ID` email header using a substring (case-insensitive) match. The `Message-ID` is assigned by the sending mail client and is visible in the `messageId` field of `MailLogEntry`.  Useful when you know the message ID generated by your application but not the relay `mailid`.",
                        "example": "<abc123@yourdomain.com>"
                    },
                    "replyto": {
                        "type": "string",
                        "format": "email",
                        "description": "Filter by the `Reply-To` message header address (exact match).  Only returns messages where this header was explicitly set.",
                        "example": "replies@sender.com"
                    },
                    "headerfrom": {
                        "type": "string",
                        "format": "email",
                        "description": "Filter by the `From` message header address (exact match).  This is the human-visible sender address and may differ from the SMTP envelope `from` parameter when sending on behalf of another address.",
                        "example": "newsletter@sender.com"
                    },
                    "delivered": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ],
                        "description": "Filter by delivery status.  `1` returns only messages that were successfully delivered to the destination MX.  `0` returns messages that are still queued, deferred, or failed.  Omit to return all messages regardless of delivery status.",
                        "example": 1
                    },
                    "skip": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0,
                        "default": 0,
                        "description": "Number of records to skip for pagination.  Use in combination with `limit` to page through large result sets.  Defaults to `0` (no skip)."
                    },
                    "limit": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 1,
                        "maximum": 10000,
                        "default": 100,
                        "description": "Maximum number of records to return per page.  Defaults to `100`. Maximum allowed value is `10000`.  The response also includes a `total` field with the full matched count so you can calculate the number of pages.",
                        "example": 100
                    },
                    "startDate": {
                        "description": "Earliest date to include.  Accepts either a Unix timestamp (integer seconds since epoch) or a date string parseable by `strtotime()` such as `2024-01-15` or `last monday`.  Messages with a `time` value **greater than or equal to** this value will be included.",
                        "oneOf": [
                            {
                                "type": "integer",
                                "description": "Unix timestamp (integer seconds since epoch, 0–9999999999).",
                                "format": "int64",
                                "minimum": 0,
                                "maximum": 9999999999
                            },
                            {
                                "type": "string",
                                "description": "Date string parseable by strtotime() such as `2024-01-15` or `last monday`."
                            }
                        ],
                        "example": 1641781008
                    },
                    "endDate": {
                        "description": "Latest date to include.  Accepts either a Unix timestamp (integer seconds since epoch) or a date string parseable by `strtotime()` such as `2024-01-31` or `yesterday`. Messages with a `time` value **less than or equal to** this value will be included.",
                        "oneOf": [
                            {
                                "type": "integer",
                                "description": "Unix timestamp (integer seconds since epoch, 0–9999999999).",
                                "format": "int64",
                                "minimum": 0,
                                "maximum": 9999999999
                            },
                            {
                                "type": "string",
                                "description": "Date string parseable by strtotime() such as `2024-01-15` or `last monday`."
                            }
                        ],
                        "example": 1673317008
                    },
                    "sort": {
                        "type": "string",
                        "enum": [
                            "time"
                        ],
                        "default": "time",
                        "description": "Field to sort results by.  Currently only `time` is supported (sorts by internal row ID which corresponds to chronological order).",
                        "example": "time"
                    },
                    "dir": {
                        "type": "string",
                        "enum": [
                            "asc",
                            "desc"
                        ],
                        "default": "desc",
                        "description": "Sort direction.  `desc` returns newest first (default), `asc` returns oldest first.",
                        "example": "desc"
                    },
                    "groupby": {
                        "type": "string",
                        "enum": [
                            "message",
                            "recipient"
                        ],
                        "default": "recipient",
                        "description": "Controls how results are grouped.  `recipient` (default) returns one row per delivery attempt — a message sent to 4 recipients produces 4 rows, each with its own `recipient`, `delivered`, `response`, and delivery metadata.  `message` collapses to one row per unique message ID; delivery-level fields will reflect one arbitrary recipient per message.  The `total` count in the response matches the grouping mode.",
                        "example": "recipient"
                    }
                }
            }
        },
        {
            "name": "getStats",
            "title": "Account usage, cost, and volume statistics for a time window",
            "description": "[GET /mail/stats] [History] Account usage, cost, and volume statistics for a time window\n\n**Use this for dashboards or billing-cycle reviews.** Returns aggregate sending statistics for your mail account(s). The `time` query param controls the window for `received`, `sent`, and `volume` (`1h`, `24h`, `7d`, `month`, `day`, `billing`, `all`). The `usage` and `cost` fields are always for the current billing cycle, regardless of `time`.\n\nThe response includes:\n- **`usage`** — total messages accepted by the relay during the current billing\n  cycle (used for cost calculation).\n- **`cost`** — estimated cost for the billing cycle based on the base plan price\n  plus per-email charges.\n- **`received`** / **`sent`** — count of messages accepted by the relay /\n  successfully delivered to the destination MX within the selected `time` window.\n- **`volume`** — top-500 breakdown of message counts grou...",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "time": {
                        "type": "string",
                        "enum": [
                            "all",
                            "billing",
                            "month",
                            "7d",
                            "24h",
                            "day",
                            "1h"
                        ],
                        "default": "1h",
                        "description": "The time window to scope `received`, `sent`, and `volume` statistics. Does not affect `usage` or `cost`, which are always calculated over the current billing cycle. Defaults to `1h`."
                    }
                }
            }
        },
        {
            "name": "getMailBlocks",
            "title": "List addresses currently flagged by spam-filter block lists",
            "description": "[GET /mail/blocks] [Blocking] List addresses currently flagged by spam-filter block lists\n\n**Use this to discover which addresses to delist.** The `from` value of any returned entry can be passed to `POST /mail/blocks/delete` (as the `email` field) to remove the block. Returns addresses and messages that have been flagged by the spam filtering system for your mail account(s). Three categories are returned:\n\n- **`local`** — messages flagged by the `LOCAL_BL_RCPT` rspamd rule.  These are\n  messages sent to recipients on your account's local block list.\n- **`mbtrap`** — messages flagged by the `MBTRAP` rspamd rule.  These are messages\n  that triggered MailBaby's internal trap / honeypot detection.\n- **`subject`** — senders whose recent messages contain spam-indicative subjects\n  (strings containing `@`, `smtp`, `socks4`, or `socks5`) with high repetition\n  (more than 4 identical subjects...",
            "inputSchema": {
                "type": "object"
            }
        },
        {
            "name": "delistBlock",
            "title": "Delist an email address from the spam-filter block lists",
            "description": "[POST /mail/blocks/delete] [Blocking] [DESTRUCTIVE] Delist an email address from the spam-filter block lists\n\n**Destructive — wipes block records for the given address.** Required: `email` (must be a valid address; typically a `from` value previously returned by `GET /mail/blocks` or `GET /mail/log`). Delists an email address from all three block list stores:\n1. The rspamd spam-filter database (`fromemail` / envelope sender records). 2. The MailChannels integration block table. 3. The MailBaby internal block table.\n\nUse `GET /mail/blocks` to discover which addresses are currently blocked.  The `from` field in any returned block entry is a valid input for this call.\n\n**Note:** Delisting an address removes it from the block tracking databases but does not prevent the spam filter from re-blocking it if future messages continue to trigger filter rules.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "email": {
                        "type": "string",
                        "description": "The email address to delist from all block lists.",
                        "format": "email",
                        "example": "user@domain.com"
                    }
                },
                "required": [
                    "email"
                ]
            }
        },
        {
            "name": "getRules",
            "title": "List custom deny rules (sender / domain / destination / prefix)",
            "description": "[GET /mail/rules] [Blocking] List custom deny rules (sender / domain / destination / prefix)\n\n**Use this to inspect or pick a `ruleId` to delete.** Returns all deny rules you have configured for your active mail account(s). Deny rules are evaluated **before** a message is transmitted and cause it to be rejected immediately when it matches.\n\nFour rule types are supported:\n| `type` | `data` format | Effect | |--------|---------------|--------| | `email` | `user@domain.com` | Rejects any message from this exact sender address | | `domain` | `domain.com` | Rejects any message from any address at this domain | | `destination` | `user@domain.com` | Rejects any message addressed to this recipient | | `startswith` | `prefix` | Rejects any message whose sender address begins with this string (alphanumeric, `+`, `_`, `.`, `-` only) |\n",
            "inputSchema": {
                "type": "object"
            }
        },
        {
            "name": "addRule",
            "title": "Create a deny rule to block a sender, domain, destination, or prefix",
            "description": "[POST /mail/rules] [Blocking] Create a deny rule to block a sender, domain, destination, or prefix\n\n**Use this to prevent future relay attempts that match a pattern.** Required: `type` (`email`, `domain`, `destination`, or `startswith`) and `data` (the value to match). Optional: `user` (SMTP username; auto-selects first active order if omitted). Adds a deny rule to block specific senders, domains, destinations, or sender prefixes from being relayed through your mail account.\n\nThe `type` field selects the matching strategy:\n- **`email`** — exact match against the SMTP envelope `MAIL FROM` address. - **`domain`** — matches any sender address at the specified domain. - **`destination`** — exact match against the SMTP envelope `RCPT TO` address. - **`startswith`** — matches any sender address whose local-part (the portion\n  before the `@`) starts with the given string.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "user": {
                        "type": "string",
                        "description": "Optional SMTP username of the mail order to associate this rule with (e.g. `mb20682`).  If omitted the first active order is used.  Valid usernames are the `username` values returned by `GET /mail`.",
                        "example": "mb20682"
                    },
                    "type": {
                        "type": "string",
                        "description": "The matching strategy for this rule.  `email` blocks an exact sender address, `domain` blocks all senders at a domain, `destination` blocks an exact recipient address, and `startswith` blocks any sender whose local-part begins with the given prefix.",
                        "enum": [
                            "domain",
                            "email",
                            "startswith",
                            "destination"
                        ],
                        "example": "email"
                    },
                    "data": {
                        "type": "string",
                        "description": "The value to match against, interpreted according to `type`: a full email address for `email`/`destination`, a domain name for `domain`, or an alphanumeric prefix string for `startswith`.",
                        "example": "domeinwo@server.guesshost.net"
                    }
                },
                "required": [
                    "type",
                    "data"
                ]
            }
        },
        {
            "name": "deleteRule",
            "title": "Delete a deny rule by its numeric ruleId",
            "description": "[DELETE /mail/rules/{ruleId}] [Blocking] [DESTRUCTIVE] Delete a deny rule by its numeric ruleId\n\n**Destructive — permanently removes the rule.** Required: `ruleId` (path param; obtain from the `id` field returned by `GET /mail/rules` or the `text` field returned by `POST /mail/rules`). Permanently removes a single deny rule identified by its numeric `ruleId`.\n\nThe `ruleId` is the `id` field returned by `GET /mail/rules` or the `text` field from a successful `POST /mail/rules` response.\n\nOnly rules belonging to your own active mail account(s) can be deleted — the server will reject attempts to delete rules that belong to a different account.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "ruleId": {
                        "type": "integer",
                        "description": "The numeric ID of the deny rule to delete.  Obtain this from the `id` field in `GET /mail/rules` or the `text` field of a `POST /mail/rules` response."
                    }
                },
                "required": [
                    "ruleId"
                ]
            }
        }
    ]
}