192c4bf009
The test_mcp_oauth_server_connection test was failing because OAuth tokens had the wrong audience claim. The MCP server's progressive_token_verifier expects tokens with audience matching its OAuth client ID, but tokens were being issued with Nextcloud's default resource server audience. Changes: 1. Test fixtures (tests/conftest.py): - Add get_mcp_server_resource_metadata() helper to fetch PRM metadata - Update playwright_oauth_token to include resource parameter in auth requests - Update _get_oauth_token_with_scopes to support optional resource parameter - Automatically fetch resource ID from MCP server's PRM endpoint 2. MCP Server (nextcloud_mcp_server/app.py): - Fix Protected Resource Metadata endpoint to return OAuth client ID - Change "resource" field from URL to client ID for proper audience validation - Ensures tokens obtained with resource parameter have correct audience claim How it works: 1. Test fetches /.well-known/oauth-protected-resource from MCP server 2. Extracts resource field (MCP server's client ID) 3. Includes &resource=<client-id> in OAuth authorization request (RFC 8707) 4. Nextcloud OIDC issues tokens with aud: [<client-id>] 5. MCP server's progressive_token_verifier accepts tokens (audience matches) Fixes OAuth test failures: - test_mcp_oauth_server_connection - test_mcp_oauth_tool_execution - test_mcp_oauth_client_with_playwright 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>