(body: string)
| 130 | * GraphQL `{errors: [...]}` envelope, which a non-MCP OAuth-protected |
| 131 | * GraphQL API would return, is explicitly excluded. */ |
| 132 | const isOAuthErrorBody = (body: string): boolean => { |
| 133 | const obj = asObject(body); |
| 134 | if (!obj) return false; |
| 135 | if (Array.isArray(obj.errors)) return false; |
| 136 | return typeof obj.error === "string"; |
| 137 | }; |
| 138 | |
| 139 | /** RFC 9728 protected-resource-metadata document. We only need the two |
| 140 | * fields that prove the document genuinely describes an OAuth-protected |