{
  "openapi": "3.1.0",
  "info": {
    "title": "e-nvoice Factur-X Generator & Validator API (Beta)",
    "description": "Client-side WebMCP API for generating and validating Factur-X / EN 16931 electronic invoices. Note: This is a client-side only API accessible via window.mcp in the browser. External HTTP calls will not work.",
    "version": "1.1.2",
    "contact": {
      "name": "e-nvoice",
      "url": "https://github.com/SetiZ/e-nvoice"
    },
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://e-nvoice.pages.dev",
      "description": "GitHub Pages Static Server - Access API via window.mcp in browser"
    }
  ],
  "paths": {
    "/.well-known/mcp.json": {
      "get": {
        "summary": "Get MCP Tool Definitions Manifest",
        "description": "Returns the MCP server manifest with all available tools and their schemas",
        "operationId": "getMcpManifest",
        "responses": {
          "200": {
            "description": "MCP Manifest JSON with tool definitions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "description": { "type": "string" },
                    "version": { "type": "string" },
                    "protocolVersion": { "type": "string" },
                    "transport": { "type": "string" },
                    "tools": {
                      "type": "array",
                      "items": { "type": "object" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Invoice": {
        "type": "object",
        "properties": {
          "number": { "type": "string", "description": "Invoice number" },
          "date": { "type": "string", "format": "date", "description": "Invoice issue date" },
          "dueDate": { "type": "string", "format": "date", "description": "Payment due date" },
          "currency": { "type": "string", "enum": ["EUR", "USD", "GBP", "CHF"], "default": "EUR", "description": "Invoice currency code" },
          "buyerType": { "type": "string", "enum": ["business", "individual"], "default": "business", "description": "Client type (B2B vs B2C)" },
          "operationType": { "type": "string", "enum": ["services", "goods", "mixed"], "default": "services", "description": "Operation category" },
          "vatOnDebits": { "type": "boolean", "description": "VAT on debits option" },
          "paymentTermsText": { "type": "string", "description": "Payment terms" },
          "latePenaltiesText": { "type": "string", "description": "Late payment penalties mention" },
          "recoveryIndemnityText": { "type": "string", "description": "40 EUR statutory recovery fee" },
          "earlyDiscountText": { "type": "string", "description": "Early payment discount policy" },
          "vatExemptionReason": { "type": "string", "description": "Legal VAT exemption mention for 0% VAT" },
          "seller": { "$ref": "#/components/schemas/Party" },
          "buyer": { "$ref": "#/components/schemas/Party" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/LineItem" }
          }
        },
        "required": ["number", "date", "seller", "buyer", "items"]
      },
      "Party": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "address": { "type": "string" },
          "city": { "type": "string" },
          "zip": { "type": "string" },
          "country": { "type": "string", "default": "FR" },
          "siret": { "type": "string" },
          "vatNumber": { "type": "string" },
          "taxId": { "type": "string", "description": "Foreign Tax ID for international buyers" },
          "iban": { "type": "string", "description": "Bank account IBAN" },
          "bic": { "type": "string", "description": "Bank BIC / SWIFT code" },
          "bankName": { "type": "string", "description": "Bank institution name" }
        },
        "required": ["name"]
      },
      "LineItem": {
        "type": "object",
        "properties": {
          "description": { "type": "string" },
          "quantity": { "type": "number", "minimum": 0 },
          "unitPrice": { "type": "number", "minimum": 0 },
          "vatRate": { "type": "number", "minimum": 0, "maximum": 100 },
          "unitCode": { "type": "string", "enum": ["C62", "HUR", "DAY", "E48"], "default": "C62" }
        },
        "required": ["description", "quantity", "unitPrice", "vatRate"]
      }
    }
  },
  "tags": [
    {
      "name": "Factur-X",
      "description": "Factur-X / EN 16931 electronic invoice operations"
    },
    {
      "name": "Validation",
      "description": "Invoice data validation operations"
    },
    {
      "name": "Calculation",
      "description": "Invoice totals calculation operations"
    }
  ]
}
