{
  "openapi": "3.1.0",
  "info": {
    "title": "AGOS API & Remote MCP Server",
    "version": "1.0.0",
    "summary": "Deterministic European compliance, Swiss financial/procurement data, email deliverability, and ATS job intelligence.",
    "description": "Applied General Operations & Systems (AGOS) unified REST JSON API and Streamable-HTTP MCP server (`POST /mcp`, protocol `2025-03-26`). Zero external runtime dependencies, strict Swiss revDSG B2B data hygiene.",
    "contact": {
      "name": "AGOS (Applied General Operations & Systems)",
      "url": "https://agos.tools"
    }
  },
  "servers": [
    {
      "url": "https://api.agos.tools",
      "description": "AGOS Production Edge API"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Optional API key required when REQUIRE_API_KEY=true."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "error"
        ]
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health and tool count",
        "responses": {
          "200": {
            "description": "Healthy service response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "protocolVersion": {
                      "type": "string"
                    },
                    "tools": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/eaa-audit": {
      "post": {
        "operationId": "auditEaaAccessibility",
        "summary": "Audit HTML or a public URL against 18 EU EAA / WCAG 2.1 AA / BFSG checks",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "html": {
                    "type": "string",
                    "description": "Raw HTML document or snippet to audit."
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http/https URL to fetch and audit."
                  },
                  "sourceName": {
                    "type": "string"
                  },
                  "includeMarkdown": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audit score, findings with before/after PR diffs, and compliance status"
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/v1/camt-parse": {
      "post": {
        "operationId": "parseSwissCamtXml",
        "summary": "Parse Swiss ISO 20022 camt.053 / camt.054 XML and optionally reconcile open invoices",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "xml"
                ],
                "properties": {
                  "xml": {
                    "type": "string",
                    "description": "Raw camt.053 or camt.054 XML string."
                  },
                  "sourceFileName": {
                    "type": "string"
                  },
                  "invoices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "invoice_no": {
                          "type": "string"
                        },
                        "qrr_ref": {
                          "type": "string"
                        },
                        "customer": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "due_date": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "invoicesCsv": {
                    "type": "string",
                    "description": "Optional CSV of open invoices."
                  }
                }
              }
            },
            "application/xml": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Parsed account balances, transactions with Mod-10 QRR/IBAN checks, and optional reconciliation"
          },
          "400": {
            "description": "Invalid XML or unsupported document type"
          }
        }
      }
    },
    "/v1/swiss-permits": {
      "get": {
        "operationId": "searchSwissBuildingPermits",
        "summary": "Fetch live B2B Swiss building permits from SECO amtsblattportal.ch (revDSG redacted)",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cantons",
            "in": "query",
            "description": "Comma-separated cantons (ZH, ZG, BL, BE, BS, TI, AR, or ALL). Default: ZH,ZG",
            "schema": {
              "type": "string",
              "default": "ZH,ZG"
            }
          },
          {
            "name": "days",
            "in": "query",
            "description": "Lookback window in days (1–90).",
            "schema": {
              "type": "integer",
              "default": 7,
              "minimum": 1,
              "maximum": 90
            }
          },
          {
            "name": "trade",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "abbruch_asbest",
                "mfh_neubau",
                "tiefgarage_ev",
                "dach_fassade_fenster",
                "solar_wp",
                "general"
              ]
            }
          },
          {
            "name": "minScore",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "b2bOnly",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 15,
              "minimum": 1,
              "maximum": 35
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Classified B2B building permits with architect CHE-UID and zero private names"
          },
          "400": {
            "description": "Invalid query parameter"
          }
        }
      }
    },
    "/v1/swiss-tenders": {
      "get": {
        "operationId": "searchSwissPublicTenders",
        "summary": "Fetch live Swiss government tenders and contract awards from simap.ch v2/v1",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 14,
              "minimum": 1,
              "maximum": 90
            }
          },
          {
            "name": "canton",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "2-letter Swiss canton code"
            }
          },
          {
            "name": "vertical",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "it_software_cloud",
                "bau_architektur",
                "energie_gebaeudetechnik",
                "beratung_treuhand",
                "gesundheit_medtech",
                "logistik_mobilitaet",
                "sonstiges"
              ]
            }
          },
          {
            "name": "pubType",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "tender",
                "award",
                "advance_notice"
              ],
              "default": "all"
            }
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 15,
              "minimum": 1,
              "maximum": 35
            }
          },
          {
            "name": "fetchDetails",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "includeBidBrief",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "de",
                "fr",
                "en"
              ],
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Normalized tenders with vertical classification, eligibility checklist, and deadline countdown"
          }
        }
      }
    },
    "/v1/verify-email": {
      "post": {
        "operationId": "verifyEmailDeliverability",
        "summary": "Verify bulk email syntax, domain typos, disposable burners, and live DoH MX/SPF/DMARC",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "emails"
                ],
                "properties": {
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 100
                  },
                  "deduplicate": {
                    "type": "boolean",
                    "default": true
                  },
                  "onlyDeliverable": {
                    "type": "boolean",
                    "default": false
                  },
                  "checkSecurityRecords": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deliverability verdicts, scores, didYouMean typos, and DoH mail provider details"
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/v1/ats-jobs": {
      "get": {
        "operationId": "searchAtsJobs",
        "summary": "Fetch live normalized job postings from Greenhouse, Lever (US/EU), and Ashby official JSON APIs",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "targets",
            "in": "query",
            "required": true,
            "description": "Comma-separated targets (e.g. greenhouse:stripe,ashby:linear,lever:palantir).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "location",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "remoteOnly",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeDescription",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "maxJobsPerCompany",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "maxTotalJobs",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Normalized open job postings with remote flags and compensation"
          },
          "400": {
            "description": "Missing or invalid targets"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcpJsonRpc",
        "summary": "Streamable-HTTP Model Context Protocol (MCP 2025-03-26) JSON-RPC 2.0 endpoint",
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "const": "2.0"
                  },
                  "id": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "initialize",
                      "notifications/initialized",
                      "ping",
                      "tools/list",
                      "tools/call"
                    ]
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MCP JSON-RPC 2.0 response"
          },
          "202": {
            "description": "Accepted notification"
          }
        }
      }
    }
  }
}