{
  "openapi": "3.1.0",
  "info": {
    "title": "THORChain Website Discovery",
    "summary": "Machine-readable discovery entry points for THORChain public resources.",
    "description": "This OpenAPI file describes stable discovery resources hosted on thorchain.org and points agents to the official THORChain developer API documentation. Protocol API behavior is documented in the linked Midgard and THORNode Swagger references. Website discovery descriptions follow Semantic Versioning. MCP wire compatibility is negotiated with MCP-Protocol-Version, not info.version. Supported transport versions and the website-only deprecation policy (at least 90 days notice, Deprecation and Sunset headers when a removal is scheduled) are published at https://thorchain.org/api-policy.md. THORNode, Midgard, and third-party gateways have independent policies.",
    "version": "1.1.1",
    "license": {
      "name": "Public documentation"
    }
  },
  "servers": [
    {
      "url": "https://thorchain.org",
      "description": "THORChain public website"
    }
  ],
  "externalDocs": {
    "description": "THORChain developer API documentation",
    "url": "https://dev.thorchain.org/concepts/connecting-to-thorchain.html"
  },
  "paths": {
    "/pricing": {
      "get": {
        "operationId": "getPricingAndFees",
        "summary": "Understand public access costs and variable transaction fees",
        "responses": {
          "200": {
            "description": "HTML pricing and fees guide",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/pricing.md": {
      "get": {
        "operationId": "getPricingAndFeesMarkdown",
        "summary": "Read public access costs and variable fees as Markdown",
        "responses": {
          "200": {
            "description": "The same pricing and fees guide in Markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/ai-catalog.json": {
      "get": {
        "operationId": "getAiCapabilityCatalog",
        "summary": "Discover the public MCP, website OpenAPI description, and agent skill",
        "responses": {
          "200": {
            "description": "AI Catalog 1.0 of verified public discovery resources",
            "content": {
              "application/ai-catalog+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "specVersion",
                    "entries"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "operationId": "getHomepage",
        "summary": "Get the THORChain homepage",
        "responses": {
          "200": {
            "description": "HTML homepage or markdown homepage when requested with Accept: text/markdown",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/AGENTS.md": {
      "get": {
        "operationId": "getAgentsMd",
        "summary": "Get public agent rules",
        "responses": {
          "200": {
            "description": "Markdown agent rules",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/agent-rules": {
      "get": {
        "operationId": "getAgentRules",
        "summary": "Get well-known public agent rules",
        "responses": {
          "200": {
            "description": "Markdown agent rules",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/mcp/server-card.json": {
      "get": {
        "operationId": "getMcpServerCard",
        "summary": "Get the MCP server card",
        "responses": {
          "200": {
            "description": "JSON MCP server card",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "serverUrl",
                    "transport"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/ai-plugin.json": {
      "get": {
        "operationId": "getAiPluginManifest",
        "summary": "Get the AI plugin manifest",
        "responses": {
          "200": {
            "description": "JSON AI plugin manifest",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schema_version",
                    "name_for_model",
                    "api",
                    "auth"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "get": {
        "operationId": "getMcpCard",
        "summary": "MCP does not provide a standalone SSE stream; use the well-known server card for metadata",
        "responses": {
          "405": {
            "description": "No standalone SSE stream. POST JSON-RPC messages to this endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32600,
                    "message": "Method not allowed; use POST"
                  }
                }
              }
            },
            "headers": {
              "Allow": {
                "description": "Allowed HTTP method.",
                "schema": {
                  "type": "string",
                  "const": "POST"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "postMcpJsonRpc",
        "summary": "Call the read-only MCP JSON-RPC endpoint",
        "responses": {
          "200": {
            "description": "JSON-RPC result or typed application error. Legacy batches return an array.",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/JsonRpcResponse"
                    },
                    {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "$ref": "#/components/schemas/JsonRpcResponse"
                      }
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Notification accepted without a response body.",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "description": "Malformed JSON, invalid request/batch, or unsupported/mismatched protocol headers. Legacy batches can include successful and failed envelopes.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "$ref": "#/components/schemas/JsonRpcResponse"
                      }
                    }
                  ]
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32700,
                    "message": "Invalid JSON"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Origin header does not match the request origin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32020,
                    "message": "Forbidden Origin header"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unsupported method in modern stateless transport. Classic JSON-RPC method errors use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32601,
                    "message": "Unsupported read-only MCP method"
                  }
                }
              }
            }
          },
          "413": {
            "description": "MCP request body exceeds 32,768 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32600,
                    "message": "MCP request body is too large"
                  }
                }
              }
            }
          },
          "415": {
            "description": "Content-Type must be application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32600,
                    "message": "Content-Type must be application/json"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server failure; safe to retry a read-only request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": null,
                  "error": {
                    "code": -32603,
                    "message": "Internal server error"
                  }
                }
              }
            }
          }
        },
        "description": "Read-only public MCP endpoint. No API key or OAuth required. Clients must inspect JSON-RPC error even on HTTP 200. Legacy batches are accepted with no transport header or version 2025-06-18; use individual requests for newer transports. Notifications return HTTP 202 without a body. The selected MCP-Protocol-Version controls the wire contract; see /api-policy.md.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/McpProtocolVersion"
          },
          {
            "$ref": "#/components/parameters/McpMethod"
          },
          {
            "$ref": "#/components/parameters/McpName"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JsonRpcRequest"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/components/schemas/JsonRpcRequest"
                    }
                  }
                ]
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "initialize",
                "params": {
                  "protocolVersion": "2025-11-25",
                  "capabilities": {},
                  "clientInfo": {
                    "name": "example-agent",
                    "version": "1.0.0"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "operationId": "getRobotsTxt",
        "summary": "Get crawler and content-signal policy",
        "responses": {
          "200": {
            "description": "Plain-text robots policy",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "summary": "Get the short AI-agent resource summary",
        "responses": {
          "200": {
            "description": "Plain-text LLM resource summary",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullTxt",
        "summary": "Get the expanded AI-agent resource map",
        "responses": {
          "200": {
            "description": "Plain-text LLM resource map",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "getSitemap",
        "summary": "Get the XML sitemap",
        "responses": {
          "200": {
            "description": "XML sitemap",
            "content": {
              "text/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api-policy.md": {
      "get": {
        "operationId": "getWebsiteApiPolicy",
        "summary": "Read website discovery version negotiation and deprecation policy",
        "responses": {
          "200": {
            "description": "Read website discovery version negotiation and deprecation policy",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/cli.md": {
      "get": {
        "operationId": "getOfficialCliGuide",
        "summary": "Find the official THORNode CLI and read-only command examples",
        "responses": {
          "200": {
            "description": "Find the official THORNode CLI and read-only command examples",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "McpProtocolVersion": {
        "name": "MCP-Protocol-Version",
        "in": "header",
        "required": false,
        "description": "MCP transport version. Classic clients may omit it during initialize and negotiate through params.protocolVersion. Modern stateless requests must use 2026-07-28 and include matching io.modelcontextprotocol/protocolVersion metadata plus Mcp-Method (and Mcp-Name for named operations). Unsupported operational header versions are rejected with a typed 400 error. See /api-policy.md.",
        "schema": {
          "type": "string",
          "enum": [
            "2025-06-18",
            "2025-11-25",
            "2026-07-28"
          ]
        },
        "example": "2025-11-25"
      },
      "McpMethod": {
        "name": "Mcp-Method",
        "in": "header",
        "required": false,
        "description": "Required for modern stateless transport; must equal the JSON-RPC method.",
        "schema": {
          "type": "string"
        }
      },
      "McpName": {
        "name": "Mcp-Name",
        "in": "header",
        "required": false,
        "description": "Required for modern tools/call and resources/read; must match params.name or params.uri. Non-ASCII values may use the MCP base64 header encoding.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "Deprecation": {
        "description": "Only sent when this website schedules deprecation of the selected discovery transport version. RFC 9745 structured date (@ followed by Unix seconds). See /api-policy.md. No deprecation is currently scheduled.",
        "schema": {
          "type": "string",
          "pattern": "^@[0-9]+$"
        }
      },
      "Sunset": {
        "description": "Only sent after a removal date is scheduled, at least 90 days after notice. RFC 8594 HTTP-date in GMT; see /api-policy.md.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "JsonRpcError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "description": "Machine-readable JSON-RPC error code. -32700: parse error; -32600: invalid request; -32601: unsupported method; -32602: invalid parameters; -32603: internal error; -32020: transport/header error; -32022: unsupported version."
          },
          "message": {
            "type": "string",
            "description": "Human-readable error explanation."
          },
          "data": {
            "description": "Optional context, for example supported and requested protocol versions."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id",
          "error"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcError"
          }
        },
        "description": "JSON-RPC error envelope used by the public MCP endpoint, including HTTP failures. Parsed requests retain their id when available; transport/parse failures use null. JSON-RPC application errors can also arrive with HTTP 200."
      },
      "JsonRpcResult": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id",
          "result"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "result": {
            "description": "MCP method-specific result."
          }
        }
      },
      "JsonRpcResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/JsonRpcResult"
          },
          {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        ]
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "Omit for notifications, which return HTTP 202 with no body."
          },
          "method": {
            "type": "string",
            "minLength": 1
          },
          "params": {
            "type": "object",
            "description": "Method-specific arguments. Modern transport also requires protocol version metadata in _meta."
          }
        }
      }
    }
  }
}
