{
  "$schema": "https://modelcontextprotocol.io/schemas/2026-01-01/server-card.json",
  "serverInfo": {
    "name": "EnvoiSMS Platform MCP Server",
    "description": "Official Model Context Protocol server for EnvoiSMS.ma. 15 tools: send_sms, send_bulk_sms, send_whatsapp_template, get_message_status, list_messages, get_balance, create_topup, send_otp, verify_otp, list_campaigns, list_contacts, get_analytics, lookup_number, list_sender_ids, get_pricing. Routes to Moroccan carriers (IAM, Orange, Inwi) with automatic failover. Bills in MAD.",
    "version": "1.1.0",
    "lastUpdated": "2026-09-23"
  },
  "transport": {
    "type": "http",
    "endpoint": "https://api.envoisms.ma/v1/mcp",
    "sseEndpoint": "https://api.envoisms.ma/v1/mcp/sse",
    "note": "JSON-RPC 2.0 over HTTP POST and Server-Sent Events (SSE)"
  },
  "capabilities": {
    "tools": true,
    "prompts": true,
    "resources": true
  },
  "tools": [
    {
      "name": "send_sms",
      "description": "Send a single SMS message to a phone number in E.164 format (+212600000000).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": { "type": "string", "description": "Recipient phone number in E.164 format (+212600000000)" },
          "message": { "type": "string", "description": "Text content of the SMS" },
          "sender_id": { "type": "string", "description": "Optional approved custom Sender ID" }
        },
        "required": ["to", "message"]
      },
      "requiresAuth": true
    },
    {
      "name": "send_bulk_sms",
      "description": "Send an SMS message to multiple recipients in E.164 format at once (up to 100 recipients).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "recipients": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Array of recipient phone numbers in E.164 format (+212600000000)"
          },
          "message": { "type": "string", "description": "Text content of the SMS" },
          "sender_id": { "type": "string", "description": "Optional approved custom Sender ID" }
        },
        "required": ["recipients", "message"]
      },
      "requiresAuth": true
    },
    {
      "name": "send_whatsapp_template",
      "description": "Send an approved WhatsApp template message from the account's connected WhatsApp Business number.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": { "type": "string", "description": "Recipient phone number in E.164 format (+212600000000)" },
          "template_name": { "type": "string", "description": "Name of an approved WhatsApp template on the account" },
          "language": { "type": "string", "description": "Template language code (e.g. fr, en_US, ar)" },
          "variables": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Values for template placeholders {{1}}, {{2}}, …"
          },
          "phone_number_id": { "type": "string", "description": "Optional connected WhatsApp number ID" }
        },
        "required": ["to", "template_name"]
      },
      "requiresAuth": true
    },
    {
      "name": "get_message_status",
      "description": "Check the real-time delivery status, segments, and cost of a sent message by ID.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "message_id": { "type": "string", "description": "Message ID returned by send_sms" }
        },
        "required": ["message_id"]
      },
      "requiresAuth": true
    },
    {
      "name": "list_messages",
      "description": "List recent outbound messages for the authenticated account with optional filters.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": { "type": "number", "description": "Number of messages to retrieve (1-50, default 20)" },
          "status": { "type": "string", "enum": ["queued", "sent", "delivered", "failed", "undeliverable"], "description": "Filter by delivery status" },
          "channel": { "type": "string", "enum": ["sms", "whatsapp"], "description": "Filter by communication channel" }
        }
      },
      "requiresAuth": true
    },
    {
      "name": "get_balance",
      "description": "Check remaining SMS credit balance in MAD and account status.",
      "inputSchema": {
        "type": "object",
        "properties": {}
      },
      "requiresAuth": true
    },
    {
      "name": "create_topup",
      "description": "Create a balance top-up checkout link (Stripe card or crypto USDC) for the authenticated account.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "pack_id": { "type": "string", "description": "SMS top-up pack ID ('sms-300' for 300 MAD, 'sms-1000' for 1000 MAD, 'sms-5000' for 5000 MAD)" },
          "amount_mad": { "type": "number", "description": "Custom recharge amount in MAD (minimum 300 MAD)" },
          "currency": { "type": "string", "enum": ["mad", "eur"], "description": "Payment currency ('mad' or 'eur')" },
          "payment_method": { "type": "string", "enum": ["stripe", "crypto"], "description": "Payment method ('stripe' or 'crypto')" }
        }
      },
      "requiresAuth": true
    },
    {
      "name": "send_otp",
      "description": "Send a 6-digit OTP verification code via SMS or WhatsApp.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": { "type": "string", "description": "Recipient phone number in E.164 format" },
          "brand": { "type": "string", "description": "Brand name shown in the OTP message" }
        },
        "required": ["to"]
      },
      "requiresAuth": true
    },
    {
      "name": "verify_otp",
      "description": "Verify an OTP passcode against a previously sent code.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "session_id": { "type": "string", "description": "Session ID from send_otp" },
          "code": { "type": "string", "description": "6-digit OTP code to verify" }
        },
        "required": ["session_id", "code"]
      },
      "requiresAuth": true
    },
    {
      "name": "list_campaigns",
      "description": "List SMS marketing campaigns created on the account.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": { "type": "number", "description": "Number of campaigns to retrieve (1-50, default 20)" }
        }
      },
      "requiresAuth": true
    },
    {
      "name": "list_contacts",
      "description": "List saved contacts or search contacts by name, phone, or email.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": { "type": "number", "description": "Number of contacts to retrieve (1-100, default 20)" },
          "q": { "type": "string", "description": "Search query matching phone, name, or email" },
          "list_id": { "type": "string", "description": "Filter contacts by contact list ID" }
        }
      },
      "requiresAuth": true
    },
    {
      "name": "get_analytics",
      "description": "Get SMS & WhatsApp message delivery metrics, success rates, and volume statistics.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "days": { "type": "number", "description": "Lookback window in days (1-365, default 30)" }
        }
      },
      "requiresAuth": true
    },
    {
      "name": "lookup_number",
      "description": "Inspect a phone number: validate format, identify Moroccan operator (IAM / Maroc Telecom, Orange, Inwi) or international country, and view applicable rate. Public — no authentication required.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": { "type": "string", "description": "Phone number to lookup in national (06...) or E.164 (+212...) format." }
        },
        "required": ["to"]
      },
      "requiresAuth": false
    },
    {
      "name": "list_sender_ids",
      "description": "List approved and pending custom alphanumeric Sender IDs registered on the authenticated account.",
      "inputSchema": {
        "type": "object",
        "properties": {}
      },
      "requiresAuth": true
    },
    {
      "name": "get_pricing",
      "description": "Get EnvoiSMS pricing packs and per-SMS rates in MAD. Pass 'to' for destination-specific international rates. Public — no authentication required.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": { "type": "string", "description": "Destination phone number in E.164 format, e.g. +2348012345678. Optional." }
        }
      },
      "requiresAuth": false
    }
  ],
  "prompts": [
    {
      "name": "moroccan-sms-campaign",
      "description": "Structure a high-converting SMS marketing campaign tailored for Moroccan consumers (French / Darija) with ANRT compliance, STOP mention, and GSM-7 length optimization.",
      "arguments": [
        { "name": "brand", "description": "Brand or company name", "required": true },
        { "name": "offer", "description": "Special offer or announcement details", "required": true },
        { "name": "language", "description": "Language: 'darija' (Latin script), 'french', or 'arabic'", "required": false },
        { "name": "call_to_action", "description": "CTA URL or contact number", "required": false }
      ]
    },
    {
      "name": "otp-verification-flow",
      "description": "Generate an end-to-end OTP verification integration flow using EnvoiSMS send_otp and verify_otp tools with 6-digit codes and KV-backed session expiration.",
      "arguments": [
        { "name": "app_name", "description": "Your service or app name", "required": true },
        { "name": "channel", "description": "Channel to use: 'sms' or 'whatsapp'", "required": false }
      ]
    },
    {
      "name": "whatsapp-template-setup",
      "description": "Structure a Meta WABA compliant message template for marketing, utility, or authentication on Moroccan WhatsApp Business lines.",
      "arguments": [
        { "name": "category", "description": "Template category: 'UTILITY', 'MARKETING', or 'AUTHENTICATION'", "required": true },
        { "name": "template_name", "description": "Template name in lowercase snake_case", "required": true }
      ]
    }
  ],
  "resources": [
    {
      "uri": "envoisms://api/status",
      "name": "EnvoiSMS API Status & Operational Health",
      "description": "Live operational status of EnvoiSMS routing nodes, carriers, and gateway endpoints.",
      "mimeType": "application/json"
    },
    {
      "uri": "envoisms://pricing/morocco",
      "name": "EnvoiSMS Moroccan Pricing Catalog",
      "description": "Current pricing tiers, credit recharge packs (MAD), and operator tariffs for IAM, Orange, and Inwi.",
      "mimeType": "application/json"
    },
    {
      "uri": "envoisms://docs/sender-ids",
      "name": "Moroccan Custom Sender ID Regulations",
      "description": "Documentation and compliance requirements from ANRT for customized alphanumeric Sender IDs in Morocco.",
      "mimeType": "text/markdown"
    }
  ],
  "authentication": {
    "type": "bearer",
    "description": "All tools except get_pricing and lookup_number require an EnvoiSMS API key sent as 'Authorization: Bearer <API key>'. Create one in the dashboard.",
    "tokenUrl": "https://envoisms.ma/fr/dashboard",
    "publicTools": [
      "get_pricing",
      "lookup_number"
    ]
  }
}
