{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hogarmas.net/mcp-trust/schema.json",
  "title": "H/M MCP Trust source-minimized export",
  "description": "Schema for a browser-local structural inspection of supplied MCP server and OAuth declarations. Raw source values are excluded.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "ruleset", "generatedAt", "input", "analysis", "limitations"],
  "properties": {
    "schema": { "const": "hm.mcp-trust.v1" },
    "ruleset": { "type": "string", "const": "2026-07-21.1" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "input": { "$ref": "#/$defs/input" },
    "analysis": { "$ref": "#/$defs/analysis" },
    "limitations": { "$ref": "#/$defs/limitations" }
  },
  "$defs": {
    "input": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sha256", "sample", "serverDocumentProvided", "protectedResourceMetadataProvided", "authorizationServerMetadataProvided", "rawDocumentsIncluded", "rawValuesIncluded", "fileNamesIncluded", "serverNamesIncluded", "urlsIncluded", "secretValuesIncluded"],
      "properties": {
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "sample": { "type": "boolean" },
        "serverDocumentProvided": { "const": true },
        "protectedResourceMetadataProvided": { "type": "boolean" },
        "authorizationServerMetadataProvided": { "type": "boolean" },
        "rawDocumentsIncluded": { "const": false },
        "rawValuesIncluded": { "const": false },
        "fileNamesIncluded": { "const": false },
        "serverNamesIncluded": { "const": false },
        "urlsIncluded": { "const": false },
        "secretValuesIncluded": { "const": false }
      }
    },
    "analysis": {
      "type": "object",
      "additionalProperties": false,
      "required": ["schema", "ruleset", "decision", "profile", "coverage", "summary", "dimensions", "findings", "limitations"],
      "properties": {
        "schema": { "const": "hm.mcp-trust.analysis.v1" },
        "ruleset": { "const": "2026-07-21.1" },
        "decision": { "enum": ["review-required", "incomplete-evidence", "contract-consistent"] },
        "profile": { "$ref": "#/$defs/profile" },
        "coverage": { "$ref": "#/$defs/coverage" },
        "summary": { "$ref": "#/$defs/summary" },
        "dimensions": {
          "type": "array",
          "minItems": 5,
          "maxItems": 5,
          "items": { "$ref": "#/$defs/dimension" }
        },
        "findings": {
          "type": "array",
          "items": { "$ref": "#/$defs/finding" }
        },
        "limitations": { "$ref": "#/$defs/limitations" }
      }
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "required": ["authMode", "packageCount", "remoteCount", "packageRegistryTypes", "transportTypes", "protectedResourceMetadataProvided", "authorizationServerMetadataProvided"],
      "properties": {
        "authMode": { "enum": ["unknown", "public", "protected"] },
        "packageCount": { "type": "integer", "minimum": 0 },
        "remoteCount": { "type": "integer", "minimum": 0 },
        "packageRegistryTypes": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
        "transportTypes": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
        "protectedResourceMetadataProvided": { "type": "boolean" },
        "authorizationServerMetadataProvided": { "type": "boolean" }
      }
    },
    "coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": ["identity", "distribution", "transport", "authorization", "secrets", "serverSchemaValidated", "registryOwnershipVerified", "remoteMetadataFetched"],
      "properties": {
        "identity": { "type": "boolean" },
        "distribution": { "type": "boolean" },
        "transport": { "type": "boolean" },
        "authorization": { "type": "boolean" },
        "secrets": { "const": true },
        "serverSchemaValidated": { "const": false },
        "registryOwnershipVerified": { "const": false },
        "remoteMetadataFetched": { "const": false }
      }
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["total", "critical", "high", "medium", "info", "reviewItems"],
      "properties": {
        "total": { "type": "integer", "minimum": 0 },
        "critical": { "type": "integer", "minimum": 0 },
        "high": { "type": "integer", "minimum": 0 },
        "medium": { "type": "integer", "minimum": 0 },
        "info": { "type": "integer", "minimum": 0 },
        "reviewItems": { "type": "integer", "minimum": 0 }
      }
    },
    "dimension": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "state", "findingCount", "reviewCount"],
      "properties": {
        "id": { "enum": ["identity", "distribution", "transport", "authorization", "secrets"] },
        "state": { "enum": ["review", "incomplete", "observed-consistent"] },
        "findingCount": { "type": "integer", "minimum": 0 },
        "reviewCount": { "type": "integer", "minimum": 0 }
      }
    },
    "finding": {
      "type": "object",
      "additionalProperties": false,
      "required": ["rule", "severity", "dimension", "pointer", "confidence", "observation", "standard"],
      "properties": {
        "rule": { "type": "string", "pattern": "^[a-z0-9-]+$" },
        "severity": { "enum": ["critical", "high", "medium", "info"] },
        "dimension": { "enum": ["identity", "distribution", "transport", "authorization", "secrets"] },
        "pointer": { "type": "string", "pattern": "^/" },
        "confidence": { "enum": ["strong", "inferred"] },
        "observation": { "type": "string" },
        "standard": { "type": "string" }
      }
    },
    "limitations": {
      "type": "object",
      "additionalProperties": false,
      "required": ["urlsFetched", "remoteServerContacted", "packageContentsInspected", "repositoryContentsInspected", "schemaValidationPerformed", "registryOwnershipVerified", "signaturesVerified", "credentialsValidated", "runtimeBehaviorObserved", "securityVerdictProduced", "sourceDataUploaded", "modelCallsPerformed", "toolExecutionPerformed"],
      "properties": {
        "urlsFetched": { "const": false },
        "remoteServerContacted": { "const": false },
        "packageContentsInspected": { "const": false },
        "repositoryContentsInspected": { "const": false },
        "schemaValidationPerformed": { "const": false },
        "registryOwnershipVerified": { "const": false },
        "signaturesVerified": { "const": false },
        "credentialsValidated": { "const": false },
        "runtimeBehaviorObserved": { "const": false },
        "securityVerdictProduced": { "const": false },
        "sourceDataUploaded": { "const": false },
        "modelCallsPerformed": { "const": false },
        "toolExecutionPerformed": { "const": false }
      }
    }
  }
}
