{
  "openapi": "3.1.0",
  "info": {
    "title": "A.I.P.M. Public Agent Resources API",
    "version": "1.0.0",
    "description": "Public, read-only Model Context Protocol discovery for the Accademia Italiana per la Promozione della Matematica. The endpoint uses JSON-RPC over MCP Streamable HTTP."
  },
  "servers": [
    {
      "url": "https://site.accademiamatematica.it",
      "description": "Production"
    }
  ],
  "paths": {
    "/.well-known/mcp": {
      "get": {
        "operationId": "getMcpManifest",
        "summary": "Get the public MCP server manifest",
        "responses": {
          "200": {
            "description": "MCP endpoint metadata and tool summary",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpManifest" }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "sendMcpMessage",
        "summary": "Send a JSON-RPC message using MCP Streamable HTTP",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JsonRpcRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result or error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonRpcResponse" }
              }
            }
          },
          "202": { "description": "Notification accepted" },
          "400": { "description": "Invalid JSON-RPC or MCP protocol headers" },
          "403": { "description": "Rejected cross-origin browser request" },
          "406": { "description": "Requested response type is not supported" },
          "415": { "description": "Request must use application/json" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": { "const": "2.0" },
          "id": { "type": ["string", "number", "null"] },
          "method": {
            "type": "string",
            "examples": ["server/discover", "initialize", "tools/list", "tools/call"]
          },
          "params": { "type": "object", "additionalProperties": true }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc", "id"],
        "properties": {
          "jsonrpc": { "const": "2.0" },
          "id": { "type": ["string", "number", "null"] },
          "result": { "type": "object", "additionalProperties": true },
          "error": { "type": "object", "additionalProperties": true }
        }
      },
      "McpManifest": {
        "type": "object",
        "required": ["name", "endpoint", "transport", "protocolVersions", "tools"],
        "properties": {
          "name": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "endpoint": { "type": "string", "format": "uri" },
          "transport": { "const": "streamable-http" },
          "protocolVersions": { "type": "array", "items": { "type": "string" } },
          "documentation": { "type": "string", "format": "uri" },
          "tools": { "type": "array", "items": { "type": "object" } }
        }
      }
    }
  }
}
