{
  "openapi": "3.0.0",
  "info": {
    "title": "Demo Store API",
    "description": "A small public demo API (products + orders) for recording MCP-server-creation walkthroughs. No authentication required.",
    "version": "1.0.0"
  },
  "servers": [
    { "url": "https://mcpplatform.dev/demo/store/v1" }
  ],
  "paths": {
    "/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "List all products in the demo store catalog.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Product" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/products/{productId}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get a single product by its id.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The product id, e.g. prod_001."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
          },
          "404": { "description": "Product not found." }
        }
      }
    },
    "/orders": {
      "post": {
        "operationId": "createOrder",
        "summary": "Place an order for a product.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": { "type": "string", "description": "The product id to order, e.g. prod_001." },
                  "quantity": { "type": "integer", "description": "Number of units to order. Defaults to 1.", "minimum": 1 }
                },
                "required": ["productId"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Order created.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } }
          },
          "400": { "description": "Missing productId." },
          "404": { "description": "Product not found." }
        }
      }
    },
    "/orders/{orderId}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get the status of an order by its id.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The order id returned by createOrder."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } }
          },
          "404": { "description": "Order not found." }
        }
      },
      "delete": {
        "operationId": "cancelOrder",
        "summary": "Cancel an existing order.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The order id to cancel."
          }
        ],
        "responses": {
          "200": {
            "description": "Order cancelled.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } }
          },
          "404": { "description": "Order not found." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "price": { "type": "number" },
          "currency": { "type": "string" },
          "stock": { "type": "integer" }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "productId": { "type": "string" },
          "productName": { "type": "string" },
          "quantity": { "type": "integer" },
          "totalPrice": { "type": "number" },
          "currency": { "type": "string" },
          "status": { "type": "string", "enum": ["confirmed", "cancelled"] },
          "createdAt": { "type": "string", "format": "date-time" }
        }
      }
    }
  }
}
