{
  "openapi": "3.1.0",
  "info": {
    "title": "Plane Gays API",
    "version": "1.1.0",
    "summary": "The HTTP surface of the Plane Gays MCP server, including its OAuth 2.1 endpoints.",
    "description": "Plane Gays is a group trip planning app for LGBTQ+ friends. Its public API is a remote MCP server (Streamable HTTP transport, JSON-RPC 2.0) at https://mcp.planegays.app/mcp. Every capability is an MCP tool: list them with the tools/list method and call them with tools/call. Clients authenticate with OAuth 2.1 and PKCE, registering themselves with dynamic client registration; there are no API keys. Every error is a JSON body. Versioning: the API is versioned by MCP protocol version. The client and server agree on one in `initialize`, and the client sends it in the `MCP-Protocol-Version` header on every later request; any other version gets a 400. Within a protocol version, tools only change additively: new tools, new optional arguments and new result fields. Deprecation: before a tool is removed or renamed, or an argument or result field is removed or changes meaning, the change is announced on https://planegays.app/developers and in https://planegays.app/llms.txt at least 30 days ahead. Rate limits: every response, except a 403 for a disallowed browser origin, carries the IETF RateLimit header fields, `RateLimit-Policy: \"burst\";q=600;w=60` and `RateLimit: \"burst\";r=<remaining>;t=<seconds to reset>`, for the per-network burst budget. A 429 always carries `Retry-After`. Tool calls are also limited to 120 per user per minute. Full docs: https://planegays.app/developers.",
    "contact": {
      "name": "Plane Gays support",
      "email": "support@planegays.app",
      "url": "https://planegays.app/contact"
    }
  },
  "externalDocs": {
    "description": "Plane Gays API docs",
    "url": "https://planegays.app/developers"
  },
  "servers": [
    {
      "url": "https://mcp.planegays.app",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "MCP",
      "description": "The Model Context Protocol endpoint. Tools act as the signed-in user."
    },
    {
      "name": "OAuth",
      "description": "OAuth 2.1 authorization, dynamic client registration and token management."
    },
    {
      "name": "Discovery",
      "description": "Metadata clients read to find the authorization server and its endpoints."
    }
  ],
  "paths": {
    "/mcp": {
      "post": {
        "operationId": "sendMcpRequest",
        "tags": ["MCP"],
        "summary": "Send an MCP JSON-RPC request",
        "description": "Sends one JSON-RPC 2.0 request to the Plane Gays MCP server: initialize, tools/list, tools/call or ping. The server is stateless and answers with a single JSON response. Tool results that fail return isError: true with a message for the user, rather than a JSON-RPC error. Missing scope returns HTTP 403 with a WWW-Authenticate Bearer insufficient_scope challenge. Each tool needs one scope; calls are limited to 120 per user per minute. Send the `MCP-Protocol-Version` agreed in `initialize` on every later request.",
        "security": [
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "Accept",
            "in": "header",
            "required": true,
            "description": "Must accept both JSON and server-sent events, as the Streamable HTTP transport requires.",
            "schema": {
              "type": "string",
              "const": "application/json, text/event-stream"
            }
          },
          {
            "name": "MCP-Protocol-Version",
            "in": "header",
            "required": false,
            "description": "The MCP protocol version agreed in `initialize`. Send it on every request after `initialize`; this is how the API is versioned. A version the server doesn't support gets a 400.",
            "schema": {
              "type": "string",
              "enum": ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The JSON-RPC response: a result, or a JSON-RPC error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "description": "An unsupported `MCP-Protocol-Version`, or a malformed JSON-RPC request, as a JSON-RPC error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "description": "No access token, or it is invalid, expired or revoked. The WWW-Authenticate header points to the protected resource metadata; run the OAuth flow again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "Bearer challenge with resource_metadata.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "403": {
            "description": "The browser origin is not allowed, or the token lacks the tool’s scope. Insufficient scope returns a WWW-Authenticate Bearer challenge with error=insufficient_scope, the required and existing scopes, and resource_metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            }
          },
          "405": {
            "description": "Only POST is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "500": {
            "description": "Internal server error, as a JSON-RPC error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/mcp": {
      "get": {
        "operationId": "getProtectedResourceMetadata",
        "tags": ["Discovery"],
        "summary": "Get protected resource metadata for /mcp",
        "description": "RFC 9728 metadata for the /mcp resource: its authorization server and supported scopes.",
        "security": [],
        "responses": {
          "200": {
            "description": "Protected resource metadata (RFC 9728).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "getProtectedResourceMetadataAtRoot",
        "tags": ["Discovery"],
        "summary": "Get protected resource metadata (root path)",
        "description": "The same RFC 9728 metadata, at the root well-known path for clients that look there.",
        "security": [],
        "responses": {
          "200": {
            "description": "Protected resource metadata (RFC 9728).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "getAuthorizationServerMetadata",
        "tags": ["Discovery"],
        "summary": "Get authorization server metadata",
        "description": "RFC 8414 metadata listing the authorize, token, register and revoke endpoints, the supported scopes and PKCE methods.",
        "security": [],
        "responses": {
          "200": {
            "description": "Authorization server metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorizationServerMetadata"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/register": {
      "post": {
        "operationId": "registerClient",
        "tags": ["OAuth"],
        "summary": "Register an OAuth client",
        "description": "RFC 7591 dynamic client registration. Registers a public client (no secret) and returns its client_id. Limited to 20 registrations per IP address per hour. A client nobody approves is deleted after 30 days.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClientRegistrationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The registered client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientRegistrationResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "description": "Invalid redirect URIs or client metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "405": {
            "description": "Only POST is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/authorize": {
      "get": {
        "operationId": "authorize",
        "tags": ["OAuth"],
        "summary": "Start an authorization request",
        "description": "Opened in the user's browser. Validates the request and redirects to the Plane Gays consent page, where the user signs in and approves; the user's browser then returns to redirect_uri with a code, state and iss (RFC 9207), or with error=access_denied if the user declines. The user's account needs a confirmed email address. A malformed request is answered with an error page; only a loopback redirect_uri receives it as error and error_description query parameters.",
        "security": [],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "description": "Must be code.",
            "schema": {
              "type": "string",
              "const": "code"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "description": "The client_id from /register.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "description": "One of the client's registered redirect URIs.",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "description": "PKCE code challenge: base64url SHA-256 of the code verifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": true,
            "description": "Must be S256.",
            "schema": {
              "type": "string",
              "const": "S256"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Opaque value returned unchanged on the redirect.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "Space-separated scopes. Omit to request all of them.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "description": "The protected resource, https://mcp.planegays.app/mcp (RFC 8707).",
            "schema": {
              "type": "string",
              "const": "https://mcp.planegays.app/mcp"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the consent page, or back to a loopback redirect_uri with an error.",
            "headers": {
              "Location": {
                "description": "Where the browser goes next.",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "description": "Unknown client_id, an unregistered redirect_uri, or a malformed request from a client whose redirect_uri is not loopback. Answered with an HTML page, never a redirect.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "405": {
            "description": "Only GET is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/token": {
      "post": {
        "operationId": "exchangeToken",
        "tags": ["OAuth"],
        "summary": "Exchange a code or refresh token for tokens",
        "description": "Exchanges an authorization code (with its PKCE verifier) or a refresh token for a new access token and refresh token. Access tokens last one hour. Refresh tokens rotate on every use, and reusing an old one revokes the whole connection. A connection expires after 30 days without use and after 90 days in all.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "description": "Invalid grant, PKCE verifier, redirect URI, resource or grant type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "description": "Unknown or expired client_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "405": {
            "description": "Only POST is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/revoke": {
      "post": {
        "operationId": "revokeToken",
        "tags": ["OAuth"],
        "summary": "Revoke a token",
        "description": "RFC 7009 revocation. Revoking an access or refresh token disconnects the whole connection. Always answers 200, even for an unknown token.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevokeRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked, or nothing to revoke.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "405": {
            "description": "Only POST is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "The request body, URL or Authorization header is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or user. Wait for Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleError"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization code flow with PKCE (S256). Clients are public and register with POST /register.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://mcp.planegays.app/authorize",
            "tokenUrl": "https://mcp.planegays.app/token",
            "refreshUrl": "https://mcp.planegays.app/token",
            "scopes": {
              "profile:read": "See the user's name and username, and their own email address.",
              "trips:read": "See the trips the user is a member of: details, itinerary, actions, notes and members.",
              "trips:write": "Create and edit the user's trips, itineraries, actions, notes and trip members.",
              "packing:read": "See the user's packing lists.",
              "packing:write": "Create and edit the user's packing lists and attach them to trips.",
              "confirmations:read": "See booking details read from confirmations the user forwarded.",
              "social:read": "See trips that people the user follows share, and find people on Plane Gays."
            }
          }
        }
      }
    },
    "schemas": {
      "OAuthError": {
        "type": "object",
        "description": "An OAuth-style error.",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error code, such as invalid_request, invalid_grant, invalid_client, invalid_redirect_uri, invalid_token or too_many_requests.",
            "examples": ["invalid_grant"]
          },
          "error_description": {
            "type": "string",
            "description": "What went wrong and how to fix it."
          }
        }
      },
      "SimpleError": {
        "type": "object",
        "description": "An error with only a code.",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error code: not_found, invalid_origin, request_too_large or too_many_requests.",
            "examples": ["too_many_requests"]
          }
        }
      },
      "ProtectedResourceMetadata": {
        "type": "object",
        "required": ["resource", "authorization_servers"],
        "properties": {
          "resource": {
            "type": "string",
            "format": "uri"
          },
          "authorization_servers": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Scope"
            }
          },
          "bearer_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "resource_name": {
            "type": "string"
          }
        }
      },
      "AuthorizationServerMetadata": {
        "type": "object",
        "required": ["issuer", "authorization_endpoint", "token_endpoint"],
        "properties": {
          "issuer": {
            "type": "string",
            "format": "uri"
          },
          "authorization_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "token_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "registration_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "revocation_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "revocation_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Scope": {
        "type": "string",
        "enum": [
          "profile:read",
          "trips:read",
          "trips:write",
          "packing:read",
          "packing:write",
          "confirmations:read",
          "social:read"
        ],
        "description": "One permission a connected client can hold. Each MCP tool needs exactly one."
      },
      "ClientRegistrationRequest": {
        "type": "object",
        "required": ["redirect_uris"],
        "properties": {
          "redirect_uris": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "https URIs, or http on a loopback address (127.0.0.1, [::1] or localhost)."
          },
          "client_name": {
            "type": "string",
            "maxLength": 100,
            "description": "Shown to the user on the consent page."
          },
          "token_endpoint_auth_method": {
            "type": "string",
            "const": "none",
            "description": "Only public clients are supported."
          }
        }
      },
      "ClientRegistrationResponse": {
        "type": "object",
        "required": ["client_id", "redirect_uris"],
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_id_issued_at": {
            "type": "integer",
            "description": "Unix time in seconds."
          },
          "client_name": {
            "type": "string"
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "grant_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "response_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_method": {
            "type": "string",
            "const": "none"
          }
        }
      },
      "TokenRequest": {
        "type": "object",
        "required": ["grant_type", "client_id"],
        "description": "authorization_code needs code, redirect_uri and code_verifier; refresh_token needs refresh_token.",
        "properties": {
          "grant_type": {
            "type": "string",
            "enum": ["authorization_code", "refresh_token"]
          },
          "client_id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string",
            "format": "uri"
          },
          "code_verifier": {
            "type": "string",
            "minLength": 43,
            "maxLength": 128
          },
          "refresh_token": {
            "type": "string"
          },
          "resource": {
            "type": "string",
            "const": "https://mcp.planegays.app/mcp"
          }
        }
      },
      "TokenResponse": {
        "type": "object",
        "required": ["access_token", "token_type", "expires_in", "refresh_token", "scope"],
        "properties": {
          "access_token": {
            "type": "string",
            "description": "Starts with pgat_."
          },
          "token_type": {
            "type": "string",
            "const": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds until the access token expires."
          },
          "refresh_token": {
            "type": "string",
            "description": "Starts with pgrt_. Use it once."
          },
          "scope": {
            "type": "string",
            "description": "Space-separated scopes granted."
          }
        }
      },
      "RevokeRequest": {
        "type": "object",
        "required": ["token"],
        "properties": {
          "token": {
            "type": "string",
            "description": "An access or refresh token."
          },
          "client_id": {
            "type": "string"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": ["string", "integer"]
          },
          "method": {
            "type": "string",
            "description": "An MCP method, such as initialize, tools/list or tools/call.",
            "examples": ["tools/call"]
          },
          "params": {
            "type": "object",
            "description": "For tools/call: {\"name\": tool name, \"arguments\": tool input}.",
            "additionalProperties": true
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc"],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": ["string", "integer", "null"]
          },
          "result": {
            "type": "object",
            "additionalProperties": true,
            "description": "For tools/call: content, structuredContent, and isError when the tool refused."
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcError"
          }
        }
      },
      "JsonRpcError": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": {
            "type": "integer",
            "examples": [-32603]
          },
          "message": {
            "type": "string"
          },
          "data": {}
        }
      }
    },
    "headers": {
      "RateLimit": {
        "description": "What is left of the per-network burst budget (IETF RateLimit header fields): remaining requests `r` and seconds `t` until the window resets.",
        "schema": {
          "type": "string"
        },
        "example": "\"burst\";r=599;t=60"
      },
      "RateLimitPolicy": {
        "description": "The per-network burst budget (IETF RateLimit header fields): quota `q` requests per window of `w` seconds.",
        "schema": {
          "type": "string"
        },
        "example": "\"burst\";q=600;w=60"
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      }
    }
  }
}
