{
  "openapi": "3.1.0",
  "info": {
    "title": "Happy Webs Agent API",
    "version": "1.2.0",
    "summary": "Read-only website checks and the consent-enforced Happy Webs MCP endpoint.",
    "description": "Machine-facing API discovery for Happy Webs. Human website form endpoints are intentionally not advertised as agent actions. Agents should use MCP prepare_contact_action followed by the matching submit tool only after the user approves the exact prepared payload.",
    "contact": {
      "email": "hello@happywebs.co.uk",
      "url": "https://happywebs.co.uk"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://happywebs.co.uk/terms/"
    }
  },
  "servers": [
    {
      "url": "https://happywebs.co.uk",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/agent-ready-scan/": {
      "get": {
        "operationId": "scanAgentReadiness",
        "summary": "Run a read-only agent-readiness scan",
        "description": "Inspect a public website for crawler access, machine-readable content and agent/API discovery signals. This operation does not modify the target website.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Full public URL or bare domain to scan."
          }
        ],
        "responses": {
          "200": {
            "description": "Readiness result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentReadinessResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unreachable URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "x-agent-risk": {
          "readOnly": true,
          "externalNetworkAccess": true
        }
      }
    },
    "/api/mcp/": {
      "post": {
        "operationId": "mcpRpc",
        "summary": "Happy Webs MCP JSON-RPC endpoint",
        "description": "Streamable HTTP MCP endpoint supporting protocol versions 2025-11-25 and 2025-06-18. Discover tools, resources and prompts through MCP. External contact actions use a prepare, review, approve, submit sequence with a single-use payload-bound confirmation ID.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          }
        },
        "x-agent-safety": {
          "externalWritesRequirePreparation": true,
          "explicitUserApprovalRequired": true,
          "confirmationBoundToPayload": true,
          "destination": "sales@happywebs.co.uk"
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {},
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {}
            }
          }
        }
      },
      "AgentReadinessResult": {
        "type": "object",
        "required": [
          "url",
          "totalScore",
          "level",
          "levelName",
          "categories",
          "checks"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "scannedAt": {
            "type": "string",
            "format": "date-time"
          },
          "totalScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "levelName": {
            "type": "string"
          },
          "categories": {
            "type": "object",
            "additionalProperties": true
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}