{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://msrjson.org/schemas/msr-2.1.json",
  "title": "MSR JSON Protocol Schema",
  "description": "MSR JSON 2.1: the 2.0 schema plus geographic and language availability (RFC 0006), media assets, package managers, execution requirements and push-ping endpoints (RFC 0008), and entity category (RFC 0009). A 2.0 manifest is valid against 2.1 when its entity.descriptions keys are BCP 47 language tags (RFC 0006).",
  "type": "object",
  "required": [
    "$schema",
    "protocol",
    "entity",
    "capabilities",
    "releases"
  ],
  "$defs": {
    "country_code": {
      "type": "string",
      "pattern": "^[A-Z]{2}$",
      "description": "ISO 3166-1 alpha-2 country code, uppercase (e.g. BR, PT, US). The exceptionally reserved EU is accepted for the European Union."
    },
    "region_code": {
      "type": "string",
      "enum": [
        "001",
        "002",
        "003",
        "005",
        "009",
        "011",
        "013",
        "014",
        "015",
        "017",
        "018",
        "019",
        "021",
        "029",
        "030",
        "034",
        "035",
        "039",
        "053",
        "054",
        "057",
        "061",
        "142",
        "143",
        "145",
        "150",
        "151",
        "154",
        "155",
        "202",
        "419"
      ],
      "description": "UN M49 region code as used by BCP 47 and Unicode CLDR: 001 World, 002 Africa, 019 Americas, 142 Asia, 150 Europe, 009 Oceania, and their sub-regions (e.g. 419 Latin America and the Caribbean)."
    },
    "language_tag": {
      "type": "string",
      "pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|[0-9]{3}))?$",
      "description": "BCP 47 language tag: language, optional script, optional region (e.g. en, pt-BR, es-419, zh-Hant-TW)."
    },
    "currency_code": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "ISO 4217 alphabetic currency code (e.g. BRL, EUR, USD), the same form as capabilities.pricing.currency."
    },
    "media_block": {
      "type": "object",
      "description": "Standardized media, visual assets, and video demonstrations (RFC-0008).",
      "additionalProperties": false,
      "properties": {
        "icon": {
          "type": "object",
          "description": "Standardized product icons by dimension.",
          "additionalProperties": false,
          "properties": {
            "svg": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "png_32": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "png_64": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "png_128": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "png_256": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "png_512": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            }
          }
        },
        "screenshots": {
          "type": "array",
          "description": "Annotated screenshots with optional dimensions and language tag.",
          "items": {
            "type": "object",
            "required": [
              "url"
            ],
            "additionalProperties": false,
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "title": {
                "type": "string",
                "maxLength": 120
              },
              "width": {
                "type": "integer",
                "minimum": 1
              },
              "height": {
                "type": "integer",
                "minimum": 1
              },
              "lang": {
                "$ref": "#/$defs/language_tag"
              }
            }
          }
        },
        "video_demo_url": {
          "type": "string",
          "format": "uri",
          "description": "HTTPS URL for product video demo or walkthrough.",
          "pattern": "^https://"
        }
      }
    }
  },
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri",
      "description": "URI of the MSR JSON schema against which this manifest was authored."
    },
    "protocol": {
      "type": "object",
      "description": "Protocol provenance, specification compliance, and licensing metadata.",
      "required": [
        "name",
        "version",
        "author",
        "specification_license",
        "reference_implementation_license"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "const": "MSR JSON",
          "description": "Official protocol identifier."
        },
        "version": {
          "type": "string",
          "pattern": "^2\\.[0-9]+(?:\\.[0-9]+)?$",
          "description": "Protocol version conforming to SemVer (e.g. 2.0 or 2.0.0)."
        },
        "author": {
          "type": "string",
          "minLength": 1,
          "description": "Author or standard organization maintaining the specification."
        },
        "specification_license": {
          "type": "string",
          "description": "SPDX identifier of the protocol specification license (e.g. CC-BY-4.0)."
        },
        "reference_implementation_license": {
          "type": "string",
          "description": "SPDX identifier of the reference tooling license (e.g. MIT)."
        },
        "canonical_url": {
          "type": "string",
          "format": "uri",
          "description": "The authoritative public URL of this manifest."
        }
      }
    },
    "entity": {
      "type": "object",
      "description": "Identity, categorization, and localized descriptions of the software entity.",
      "required": [
        "name",
        "slug",
        "domain",
        "type",
        "descriptions"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120,
          "description": "Official display name of the product, tool, API, or agent."
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "maxLength": 64,
          "description": "Unique lowercase kebab-case machine identifier."
        },
        "domain": {
          "type": "string",
          "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$",
          "description": "Primary authoritative Fully Qualified Domain Name (FQDN)."
        },
        "type": {
          "type": "string",
          "enum": [
            "saas",
            "ai-agent",
            "mcp-server",
            "api",
            "software",
            "open-source",
            "framework",
            "library",
            "plugin",
            "extension",
            "desktop",
            "mobile"
          ],
          "description": "Primary architectural archetype of the entity."
        },
        "license": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "open-source",
                "proprietary",
                "freeware",
                "commercial",
                "dual"
              ]
            },
            "spdx_id": {
              "type": "string"
            },
            "commercial_terms": {
              "type": "string",
              "enum": [
                "free",
                "freemium",
                "paid",
                "subscription",
                "custom"
              ]
            }
          }
        },
        "vendor": {
          "type": "object",
          "required": [
            "name",
            "website"
          ],
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "website": {
              "type": "string",
              "format": "uri"
            },
            "country_code": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            "support_url": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "descriptions": {
          "type": "object",
          "minProperties": 1,
          "propertyNames": {
            "$ref": "#/$defs/language_tag"
          },
          "additionalProperties": {
            "type": "object",
            "required": [
              "summary"
            ],
            "additionalProperties": false,
            "properties": {
              "tagline": {
                "type": "string",
                "maxLength": 140
              },
              "summary": {
                "type": "string",
                "maxLength": 256
              },
              "text": {
                "type": "string"
              }
            }
          },
          "description": "Localized descriptions keyed by BCP 47 language tag (RFC-0006)."
        },
        "media": {
          "$ref": "#/$defs/media_block"
        },
        "category": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
          "maxLength": 64,
          "description": "Primary category of the entity: a slug of the MSR category taxonomy (taxonomy/categories.json, RFC 0009). Describes what the software is for, not the business of its vendor."
        },
        "subcategories": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "minItems": 1,
          "maxItems": 5,
          "uniqueItems": true,
          "description": "Secondary categories from the same taxonomy (RFC 0009). Requires category and must not repeat it."
        }
      },
      "dependentRequired": {
        "subcategories": [
          "category"
        ]
      }
    },
    "capabilities": {
      "type": "object",
      "description": "Deployment models, functional interfaces, pricing, and integrations.",
      "required": [
        "deployment"
      ],
      "additionalProperties": false,
      "properties": {
        "deployment": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "cloud",
              "self-hosted",
              "on-premise",
              "hybrid",
              "desktop",
              "mobile",
              "edge",
              "docker"
            ]
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "interfaces": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mcp": {
              "type": "object",
              "required": [
                "version",
                "transport"
              ],
              "additionalProperties": false,
              "properties": {
                "version": {
                  "type": "string"
                },
                "transport": {
                  "type": "string",
                  "enum": [
                    "sse",
                    "stdio",
                    "streamable-http",
                    "websocket"
                  ]
                },
                "endpoint": {
                  "type": "string",
                  "format": "uri"
                },
                "tools_count": {
                  "type": "integer",
                  "minimum": 0
                },
                "schema_url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            },
            "openapi": {
              "type": "object",
              "required": [
                "version",
                "spec_url"
              ],
              "additionalProperties": false,
              "properties": {
                "version": {
                  "type": "string"
                },
                "spec_url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            },
            "graphql": {
              "type": "object",
              "required": [
                "endpoint"
              ],
              "additionalProperties": false,
              "properties": {
                "endpoint": {
                  "type": "string",
                  "format": "uri"
                },
                "schema_url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            },
            "grpc": {
              "type": "object",
              "required": [
                "proto_url"
              ],
              "additionalProperties": false,
              "properties": {
                "proto_url": {
                  "type": "string",
                  "format": "uri"
                },
                "port": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 65535
                }
              }
            }
          }
        },
        "pricing": {
          "type": "object",
          "required": [
            "model"
          ],
          "additionalProperties": false,
          "properties": {
            "model": {
              "type": "string",
              "enum": [
                "free",
                "freemium",
                "subscription",
                "usage",
                "one-time",
                "quote"
              ]
            },
            "starting_price_cents": {
              "type": "integer",
              "minimum": 0
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          }
        },
        "integrations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "availability": {
          "type": "object",
          "description": "Experimental RFC-0006: where the product may be acquired and used, the languages of its interface and of its support, the currencies it is billed in, and where customer data is stored. An absent field means not declared, never worldwide.",
          "minProperties": 1,
          "additionalProperties": false,
          "properties": {
            "regions": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/region_code"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Regions where the product is offered. [\"001\"] declares worldwide availability."
            },
            "countries": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/country_code"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Countries where the product is offered, in addition to any listed region."
            },
            "excluded_countries": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/country_code"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Countries where the product is not offered even though a listed region contains them. Exclusion wins over inclusion."
            },
            "languages": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/language_tag"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Languages the product's user interface and documentation are available in."
            },
            "support_languages": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/language_tag"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Languages customer support is provided in. Independent of the interface languages."
            },
            "data_residency": {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/country_code"
                  },
                  {
                    "$ref": "#/$defs/region_code"
                  }
                ]
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Countries or regions where customer data is stored and processed at rest."
            },
            "currencies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/currency_code"
              },
              "minItems": 1,
              "uniqueItems": true,
              "description": "Currencies the product can be billed in."
            }
          }
        },
        "requirements": {
          "type": "object",
          "description": "Standardized execution, hardware, and OS requirements (RFC-0008).",
          "additionalProperties": false,
          "properties": {
            "architectures": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "x86_64",
                  "arm64",
                  "aarch64",
                  "riscv64",
                  "wasm32",
                  "universal"
                ]
              },
              "uniqueItems": true
            },
            "operating_systems": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "os"
                ],
                "additionalProperties": false,
                "properties": {
                  "os": {
                    "type": "string",
                    "enum": [
                      "linux",
                      "darwin",
                      "windows",
                      "freebsd",
                      "android",
                      "ios"
                    ]
                  },
                  "min_version": {
                    "type": "string"
                  },
                  "min_kernel": {
                    "type": "string"
                  }
                }
              }
            },
            "hardware": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "min_ram_mb": {
                  "type": "integer",
                  "minimum": 0
                },
                "recommended_ram_mb": {
                  "type": "integer",
                  "minimum": 0
                },
                "min_storage_mb": {
                  "type": "integer",
                  "minimum": 0
                },
                "gpu": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "required": {
                      "type": "boolean"
                    },
                    "min_vram_mb": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "distribution": {
      "type": "object",
      "description": "Distribution channels across package managers and app stores (RFC-0008).",
      "additionalProperties": false,
      "properties": {
        "package_managers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "app_stores": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "releases": {
      "type": "object",
      "description": "Release distribution, versioning, and download artifacts.",
      "required": [
        "latest"
      ],
      "additionalProperties": false,
      "properties": {
        "latest": {
          "type": "object",
          "required": [
            "version",
            "published_at"
          ],
          "additionalProperties": false,
          "properties": {
            "version": {
              "type": "string",
              "minLength": 1
            },
            "published_at": {
              "type": "string",
              "format": "date-time"
            },
            "release_type": {
              "type": "string",
              "enum": [
                "major",
                "minor",
                "patch",
                "security",
                "initial"
              ]
            },
            "changelog_url": {
              "type": "string",
              "format": "uri"
            },
            "artifacts": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "platform",
                  "uri"
                ],
                "additionalProperties": false,
                "properties": {
                  "platform": {
                    "type": "string"
                  },
                  "uri": {
                    "type": "string"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "size_bytes": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        }
      }
    },
    "trust": {
      "type": "object",
      "description": "Cryptographic attestations, domain ownership verification, and audits.",
      "additionalProperties": false,
      "properties": {
        "domain_verification": {
          "type": "object",
          "required": [
            "method",
            "status"
          ],
          "additionalProperties": false,
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "dns-txt",
                "well-known-http",
                "tls-alpn"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "verified",
                "pending",
                "revoked"
              ]
            },
            "verified_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "signatures": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "algorithm": {
              "type": "string",
              "enum": [
                "ed25519",
                "ecdsa-p256",
                "rsa-pss-4096"
              ]
            },
            "public_key": {
              "type": "string"
            },
            "manifest_signature": {
              "type": "string"
            }
          }
        },
        "audit_receipt": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "auditor": {
              "type": "string"
            },
            "audit_url": {
              "type": "string",
              "format": "uri"
            },
            "audit_date": {
              "type": "string",
              "format": "date"
            },
            "status": {
              "type": "string",
              "enum": [
                "passed",
                "passed_with_findings",
                "failed"
              ]
            }
          }
        }
      }
    },
    "telemetry": {
      "type": "object",
      "description": "Uptime monitoring links and event notification webhook endpoints.",
      "additionalProperties": false,
      "properties": {
        "status_page": {
          "type": "string",
          "format": "uri"
        },
        "webhook": {
          "type": "object",
          "required": [
            "url",
            "events"
          ],
          "additionalProperties": false,
          "properties": {
            "url": {
              "type": "string",
              "format": "uri"
            },
            "events": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1,
              "uniqueItems": true
            }
          }
        },
        "ping_endpoints": {
          "type": "array",
          "description": "Registered Push-Ping endpoints for real-time release notifications (RFC-0008).",
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "uniqueItems": true
        }
      }
    }
  }
}
