{
  "openapi": "3.1.0",
  "info": {
    "title": "MyGunImport.com Public API",
    "version": "1.0.0",
    "summary": "Contact intake, health, and MCP Streamable HTTP for MyGunImport.com",
    "description": "Public HTTP endpoints for MyGunImport.com (also MyGunImport / MGI): contact intake, health checks, and Model Context Protocol tools for firearms import logistics and auction calendars.",
    "contact": {
      "name": "MyGunImport.com",
      "email": "info@mygunimport.com",
      "url": "https://mygunimport.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://mygunimport.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://mygunimport.com",
      "description": "This deployment origin"
    },
    {
      "url": "https://mygunimport.com",
      "description": "Canonical production origin"
    }
  ],
  "tags": [
    {
      "name": "Contact",
      "description": "Human handoff and quote intake"
    },
    {
      "name": "Health",
      "description": "Service availability"
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol Streamable HTTP"
    }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "submitContact",
        "tags": [
          "Contact"
        ],
        "summary": "Submit the MyGunImport.com contact form",
        "description": "Accepts a JSON contact message for firearms import quotes and support. Returns structured problem+json errors on validation or delivery failure.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactRequest"
              },
              "examples": {
                "quote": {
                  "summary": "Import quote request",
                  "value": {
                    "name": "Jane Collector",
                    "email": "jane@example.com",
                    "subject": "UK shotgun import quote",
                    "message": "Looking to import a shotgun purchased at a UK auction to my FFL."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted (or honeypot fake success)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSuccess"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or validation failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "502": {
            "description": "Upstream delivery failed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "503": {
            "description": "Contact delivery unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "tags": [
          "Health"
        ],
        "summary": "Service health check",
        "description": "Lightweight liveness probe for MyGunImport.com public API and MCP surfaces.",
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthStatus"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/mcp": {
      "get": {
        "operationId": "getMcpDiscovery",
        "tags": [
          "MCP"
        ],
        "summary": "MCP endpoint discovery document",
        "description": "Returns Streamable HTTP MCP endpoint metadata for MyGunImport.com tools.",
        "responses": {
          "200": {
            "description": "MCP discovery metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpDiscovery"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "postMcpJsonRpc",
        "tags": [
          "MCP"
        ],
        "summary": "MCP Streamable HTTP JSON-RPC",
        "description": "JSON-RPC 2.0 methods: initialize, tools/list, tools/call, ping. Tools: get_company_info, get_upcoming_auctions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC success or error envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          },
          "204": {
            "description": "Notification acknowledged (no body)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiError": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "resolution",
          "error"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "RFC 9457 problem type URI"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code"
          },
          "resolution": {
            "type": "string",
            "description": "How an agent or client should recover"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "resolution"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "resolution": {
                "type": "string"
              }
            }
          }
        }
      },
      "ContactRequest": {
        "type": "object",
        "required": [
          "name",
          "email",
          "subject",
          "message"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Sender full name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320,
            "description": "Reply-to email"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Message subject"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000,
            "description": "Message body"
          },
          "company_website": {
            "type": "string",
            "description": "Honeypot field — leave empty"
          }
        },
        "additionalProperties": false
      },
      "ContactSuccess": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "HealthStatus": {
        "type": "object",
        "required": [
          "status",
          "service",
          "time"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "service": {
            "type": "string",
            "enum": [
              "mygunimport"
            ]
          },
          "time": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "McpDiscovery": {
        "type": "object",
        "required": [
          "name",
          "version",
          "description",
          "endpoint",
          "tools"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "discovery": {
            "type": "string",
            "format": "uri"
          },
          "transport": {
            "type": "string"
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {},
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}