Skip to content

fix: authorization resource for EXTERNAL_OAUTH21_PROVIDER=true - #405

Merged
taylorwilsdon merged 8 commits into
mainfrom
external_oauth-fix
Jan 29, 2026
Merged

fix: authorization resource for EXTERNAL_OAUTH21_PROVIDER=true#405
taylorwilsdon merged 8 commits into
mainfrom
external_oauth-fix

Conversation

@taylorwilsdon

Copy link
Copy Markdown
Owner

302 from #401 (no edit rights)
Thanks @ryohang

Fixes the authorization resource metadata for EXTERNAL_OAUTH21_PROVIDER=true mode to properly act as a Resource Server that points to Google's Authorization Server.

Problem
When using external OAuth mode (where access tokens are issued by external systems), the MCP server was not properly advertising its role as a Resource Server or pointing to the correct Authorization Server.

Changes
Enhanced ExternalOAuthProvider to implement proper Resource Server behavior:

Added get_routes() method to create protected resource metadata endpoints
Metadata now correctly points to Google's Authorization Server (https://accounts.google.com/)
Added resource_server_url parameter for proper endpoint configuration
Improved documentation explaining Resource Server vs Authorization Server roles
Updated server configuration to properly enable protocol-level auth:
Changed from server.auth = None to server.auth = provider to enable OAuth validation
Added clearer logging to indicate protected resource metadata setup

ryo and others added 8 commits January 28, 2026 16:23
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add batch_update_form MCP tool that exposes the Google Forms
batchUpdate API endpoint. Supports createItem, updateItem,
deleteItem, moveItem, updateFormInfo, and updateSettings operations.

Includes _batch_update_form_impl internal function for testability
and 6 unit tests covering multiple requests, single request, empty
replies, missing replies key, URL generation, and mixed reply types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add batch_update_form to the Complete tier in tool_tiers.yaml and
document it in both README files as requested in PR review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@taylorwilsdon
taylorwilsdon requested a review from Copilot January 29, 2026 16:03
@taylorwilsdon taylorwilsdon self-assigned this Jan 29, 2026
@taylorwilsdon taylorwilsdon added the bug Something isn't working label Jan 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the OAuth authorization resource metadata for external OAuth mode (EXTERNAL_OAUTH21_PROVIDER=true) by properly implementing Resource Server behavior that points to Google's Authorization Server instead of attempting to act as an Authorization Server itself.

Changes:

  • Enhanced ExternalOAuthProvider to implement get_routes() that creates protected resource metadata endpoints pointing to Google's Authorization Server
  • Updated server configuration to enable protocol-level auth validation by setting server.auth = provider instead of None
  • Improved logging to clarify the Resource Server role and expected token flow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/server.py Updated external OAuth configuration to enable auth provider and improved logging messages
auth/external_oauth_provider.py Added get_routes() method, resource_server_url parameter, and enhanced documentation about Resource Server role

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Store credentials as they're not exposed by parent class
self._client_id = client_id
self._client_secret = client_secret
# Store as string - Pydantic validates it when passed to models

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions Pydantic validation but the assignment is a simple string copy without any validation happening at this point. Consider removing the misleading comment or adding actual validation if needed.

Suggested change
# Store as string - Pydantic validates it when passed to models
# Store as string for compatibility with any Pydantic models that may consume it

Copilot uses AI. Check for mistakes.
Returns:
List of routes - only protected resource metadata
"""
from mcp.server.auth.routes import create_protected_resource_routes

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import statements should be at the module level rather than inside a method. Move this import to the top of the file with other imports for better code organization and to avoid repeated import overhead on each method call.

Copilot uses AI. Check for mistakes.
@taylorwilsdon
taylorwilsdon merged commit ae2d75a into main Jan 29, 2026
5 checks passed
@ryohang

ryohang commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

@taylorwilsdon thank you so much for the help. I am so sorry, I was not too familiar with the process. I will do better job next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants