{
  "openapi": "3.1.0",
  "info": {
    "title": "Inlet Games public catalog",
    "version": "1.0.0",
    "summary": "Read-only catalog of Inlet Games titles, plus the checkout-intent redirect.",
    "description": "Everything here is public and needs no credentials. Games are one-time purchases: no ads, no subscriptions. Buying is completed by a human on Stripe Checkout; no endpoint here charges anyone. Operated by Heron Networks LLC.",
    "contact": {
      "email": "support@inlet.games",
      "url": "https://inlet.games/agents"
    }
  },
  "servers": [
    {
      "url": "https://inlet.games"
    }
  ],
  "paths": {
    "/agent/catalog.json": {
      "get": {
        "operationId": "listGames",
        "summary": "List every storefront game with status, price, links",
        "description": "Static JSON, regenerated from the storefront catalog on each release.",
        "responses": {
          "200": {
            "description": "The catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          }
        }
      }
    },
    "/games/{sku}.json": {
      "get": {
        "operationId": "getGameDetail",
        "summary": "Full storefront record for one game (descriptions, features, requirements)",
        "parameters": [
          {
            "name": "sku",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "sku from listGames, e.g. pencilmark"
          }
        ],
        "responses": {
          "200": {
            "description": "Game record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Unknown sku"
          }
        }
      }
    },
    "/api/checkout": {
      "get": {
        "operationId": "startCheckout",
        "summary": "Checkout intent: redirect to Stripe Checkout for one game",
        "description": "Creates a Stripe Checkout Session for the sku and answers 303 to the hosted Stripe page, where a human pays. Nothing is charged by this call. Only skus with purchasable=true in the catalog; others answer 4xx/5xx.",
        "parameters": [
          {
            "name": "sku",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional Inlet Passport account id to attach the entitlement to."
          }
        ],
        "responses": {
          "303": {
            "description": "Redirect to Stripe Checkout (Location header)"
          },
          "400": {
            "description": "Missing or unknown sku"
          },
          "503": {
            "description": "Checkout not configured for this sku"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "Read-only MCP server (Streamable HTTP, JSON answers)",
        "description": "JSON-RPC 2.0: initialize, tools/list, tools/call. Tools: list_games, get_game.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "const": "2.0"
                  },
                  "id": {
                    "type": [
                      "integer",
                      "string"
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "202": {
            "description": "Notification accepted"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Game": {
        "type": "object",
        "required": [
          "sku",
          "title",
          "status"
        ],
        "properties": {
          "sku": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "tagline": {
            "type": [
              "string",
              "null"
            ]
          },
          "genre": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "in-development",
              "coming-soon",
              "preview"
            ]
          },
          "price_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "One-time price in whole dollars; null until the game is live. 0 = free."
          },
          "free": {
            "type": "boolean"
          },
          "purchasable": {
            "type": "boolean"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "play_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "checkout_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "platforms": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          }
        }
      },
      "Catalog": {
        "type": "object",
        "properties": {
          "publisher": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          },
          "games": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Game"
            }
          }
        }
      }
    }
  }
}
