Api patterns

From wyre-technology/msp-claude-plugins · View interactive version

Api patterns is an AI agent skill from the GitHub repository wyre-technology/msp-claude-plugins. SpamTitan MCP fundamentals: the available tool catalog and its exact parameters, API-key header authentication, API structure, pagination, rate limiting, and error handling. Includes the tenant-isolation limit — spamtitan_get_queue takes no domain filter.

How to use this skill

Skill file

SpamTitan MCP Tools & API Patterns

Overview

The SpamTitan MCP server provides AI tool integration with the SpamTitan email security platform by TitanHQ. It exposes tools covering quarantine queue management, email flow statistics, and sender allowlist/blocklist management. The API uses an API key passed as an HTTP header.

Connection & Authentication

API Key Header Auth

SpamTitan authenticates using an API key passed via HTTP header:

| Header | Description |

|--------|-------------|

| X-SpamTitan-API-Key | Your SpamTitan API key |

Generate credentials at: SpamTitan Admin Interface > Settings > API

Environment Variables:

export SPAMTITAN_API_KEY="your-api-key"

IMPORTANT: Never hardcode credentials. Always use environment variables.

Available MCP Tools

The server registers nine tools. There is no separate list tool for either

sender list and no separate per-domain statistics tool — both capabilities are

arguments on the tools below.

Quarantine Management

| Tool | Parameters | Description |

|------|------------|-------------|

| spamtitan_get_queue | page, per_page, sender, recipient, subject, reason | List messages in the quarantine queue. No domain parameter — see the warning below. |

| spamtitan_get_message | message_id (required) | Get details for a specific quarantined message |

| spamtitan_release_message | message_id (required) | Release a quarantined message to the recipient |

| spamtitan_delete_message | message_id (required) | ⚠ Permanently delete a quarantined message. Irreversible |

On a multi-tenant appliance the listing therefore spans every tenant, and per-customer filtering has to be done client-side on recipient after the fetch. This is easy to miss because the sibling spamtitan_get_stats does take domain. See the quarantine skill and GOVERNANCE.md.

Email Statistics

| Tool | Parameters | Description |

|------|------------|-------------|

| spamtitan_get_stats | period (today\|yesterday\|last_7_days\|last_30_days\|last_90_days), domain | Email flow statistics. Pass domain for a single customer's numbers |

Per-domain statistics are real — they are the domain argument on this tool,

not a separate tool.

List Management

| Tool | Parameters | Description |

|------|------------|-------------|

| spamtitan_manage_allowlist | action (required: add\|remove\|list), sender, note | Add, remove, or list sender allowlist entries |

| spamtitan_manage_blocklist | action (required: add\|remove\|list), sender, note | ⚠ HIGH-IMPACT. Add, remove, or list sender blocklist entries. Changes deliverability for real users |

Listing is action: "list" on the same tool — there is no separate list tool.

action is the only required parameter; sender is required by the handler

for add and remove. Omitting action makes the server elicit it from the

caller, which an unattended agent cannot answer.

Discovery

| Tool | Parameters | Description |

|------|------------|-------------|

| spamtitan_status | — | Show credentials status and available domains |

| spamtitan_navigate | domain (required) | Discover tools by domain. This domain is a tool category, not a mail domain |

Pagination

The quarantine queue uses page/per-page pagination:

Example workflow:

  1. Call spamtitan_get_queue with page=1, per_page=100
  2. If 100 results returned, call again with page=2
  3. Repeat until fewer than per_page results are returned

Rate Limiting

SpamTitan enforces API rate limits per API key:

Error Handling

Common Error Codes

| Code | Meaning | Resolution |

|------|---------|------------|

| 401 | Unauthorized | Check X-SpamTitan-API-Key header value |

| 403 | Forbidden | Insufficient API key permissions |

| 404 | Not Found | Resource doesn't exist or wrong ID |

| 422 | Unprocessable Entity | Invalid request parameters |

| 429 | Rate Limited | Wait and retry after delay |

| 500 | Server Error | Retry; contact TitanHQ support if persistent |

Error Response Format

{
  "error": {
    "code": 401,
    "message": "Invalid or missing API key"
  }
}

Best Practices

recipient, subject, reason — rather than paging the whole appliance.

There is no date filter and no domain filter on spamtitan_get_queue.

address) or filter the results client-side on the recipient's domain. Do not

tell an operator the listing is scoped to their customer when it is not.

genuinely scoped server-side. The asymmetry with the queue is the trap.

per call. Iterate deliberately and confirm each destructive call.

using the note parameter on spamtitan_manage_allowlist /

spamtitan_manage_blocklist

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.