diff --git a/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts b/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts index 42b72308..d5f01de8 100644 --- a/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts +++ b/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts @@ -196,4 +196,288 @@ describe("oauth authorize routes", () => { expect(text).toBe("Invalid request"); }); }); + + describe("Resource parameter validation (RFC 8707)", () => { + describe("GET /oauth/authorize", () => { + it("should allow request without resource parameter (backward compatibility)", async () => { + mockOAuthProvider.parseAuthRequest.mockResolvedValueOnce({ + clientId: "test-client", + redirectUri: "https://example.com/callback", + scope: ["read"], + }); + mockOAuthProvider.lookupClient.mockResolvedValueOnce({ + clientId: "test-client", + clientName: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + const request = new Request("http://localhost/oauth/authorize", { + method: "GET", + }); + const response = await app.fetch(request, testEnv as Env); + + // Should proceed normally (render approval dialog) + expect(response.status).toBe(200); + const html = await response.text(); + expect(html).toContain("