{
  "openapi": "3.1.0",
  "info": {
    "title": "supastack public API",
    "version": "1.0.0",
    "summary": "Health, repository stats, and anonymous MCP servers for supastack.",
    "description": "Public, documented HTTP surface of supastack.dev. Buyer accounts, admin tooling, and checkout remain browser flows and are not part of this API.",
    "contact": {
      "name": "supastack support",
      "url": "https://supastack.dev/contact",
      "email": "noah@supastack.dev"
    },
    "license": {
      "name": "Commercial",
      "url": "https://supastack.dev/legal/license"
    }
  },
  "servers": [
    {
      "url": "https://supastack.dev",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "operations",
      "description": "Availability and display counters."
    },
    {
      "name": "mcp",
      "description": "Model Context Protocol servers (anonymous, read-only)."
    }
  ],
  "externalDocs": {
    "url": "https://supastack.dev/llms.txt",
    "description": "Agent-facing documentation index"
  },
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "tags": [
          "operations"
        ],
        "summary": "Dependency health probe",
        "responses": {
          "200": {
            "description": "All configured dependencies responded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthSnapshot"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "One or more dependencies failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthSnapshot"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/repo-stats": {
      "get": {
        "operationId": "getRepoStats",
        "tags": [
          "operations"
        ],
        "summary": "Landing-page repository counters (floor-rounded display values)",
        "responses": {
          "200": {
            "description": "Display counters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepoStats"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcpJsonRpc",
        "tags": [
          "mcp"
        ],
        "summary": "MCP Streamable HTTP endpoint (JSON-RPC 2.0)",
        "description": "Anonymous, read-only Model Context Protocol server. Supports initialize, ping, tools/list, and tools/call. Server card: /.well-known/mcp.json",
        "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"
                }
              }
            }
          },
          "202": {
            "description": "Notification accepted (no body)"
          },
          "400": {
            "description": "Malformed JSON-RPC payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/mcp/storefront": {
      "post": {
        "operationId": "mcpStorefrontJsonRpc",
        "tags": [
          "mcp"
        ],
        "summary": "MCP Streamable HTTP endpoint (JSON-RPC 2.0)",
        "description": "Anonymous, read-only plan/pricing MCP server. Server card: /.well-known/mcp/storefront.json",
        "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"
                }
              }
            }
          },
          "202": {
            "description": "Notification accepted (no body)"
          },
          "400": {
            "description": "Malformed JSON-RPC payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token",
        "description": "Browser session cookie for buyer and admin areas. Not issued to agents and not required by any endpoint in this document."
      },
      "webhookSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Stripe-Signature",
        "description": "Provider webhook signature; only billing webhooks accept it."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "examples": [
                  "not_found"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "RepoStats": {
        "type": "object",
        "required": [
          "lines",
          "commits",
          "tests"
        ],
        "additionalProperties": false,
        "properties": {
          "lines": {
            "type": "integer",
            "minimum": 0
          },
          "commits": {
            "type": "integer",
            "minimum": 0
          },
          "tests": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "HealthSnapshot": {
        "type": "object",
        "required": [
          "status",
          "checks",
          "databaseProvider",
          "providers",
          "timestamp",
          "version"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "degraded"
            ]
          },
          "checks": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "databaseProvider": {
            "type": "string"
          },
          "providers": {
            "type": "object",
            "required": [
              "auth",
              "billing",
              "email"
            ],
            "properties": {
              "auth": {
                "type": "string"
              },
              "billing": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "string"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "type": "string",
            "examples": [
              "tools/list"
            ]
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "x-agent-resources": {
    "llmsTxt": "https://supastack.dev/llms.txt",
    "llmsFullTxt": "https://supastack.dev/llms-full.txt",
    "skill": "https://supastack.dev/skill.md",
    "auth": "https://supastack.dev/auth.md",
    "pricing": "https://supastack.dev/pricing.md",
    "ard": "https://supastack.dev/.well-known/ard.json"
  }
}