github / github/copilot-cli

Google Workspace MCP OAuth fails on accounts.google.com trailing-slash issuer mismatch

Đang mở
#4,606 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

area:authentication area:mcp
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

Describe the bug

Native HTTP MCP authentication fails for Google's official Workspace MCP
endpoints before the browser authorization flow begins.

The protected-resource metadata advertises this authorization server:

https://accounts.google.com/

Google's authorization-server/OpenID metadata advertises this issuer:

https://accounts.google.com

These URLs differ only by the trailing slash on the origin root, but Copilot CLI
compares them literally and rejects the server:

OAuth authentication failed for google-calendar: MCPOAuthError:
Incompatible authorization server: authorization server advertised an issuer
that does not match the URL its metadata was discovered from (RFC 8414 §3.3);
refusing to connect

This affects all seven currently documented Google Workspace MCP endpoints:

  • Calendar: https://calendarmcp.googleapis.com/mcp/v1
  • Gmail: https://gmailmcp.googleapis.com/mcp/v1
  • Drive: https://drivemcp.googleapis.com/mcp/v1
  • People: https://people.googleapis.com/mcp/v1
  • Docs: https://docsmcp.googleapis.com/mcp/v1
  • Slides: https://slidesmcp.googleapis.com/mcp/v1
  • Sheets: https://sheetsmcp.googleapis.com/mcp/v1

Each endpoint's protected-resource metadata currently returns:

{
  "resource": "<the MCP endpoint>",
  "authorization_servers": ["https://accounts.google.com/"]
}

Google's public metadata returns:

GET https://accounts.google.com/.well-known/openid-configuration
{
  "issuer": "https://accounts.google.com"
}
Affected version
GitHub Copilot CLI 1.0.81-10
Steps to reproduce the behavior
  1. Register the localhost OAuth redirect URI required by Google and configure
    Calendar as a native HTTP MCP server (credentials redacted):

    {
      "mcpServers": {
        "google-calendar": {
          "type": "http",
          "url": "https://calendarmcp.googleapis.com/mcp/v1",
          "oauthClientId": "<redacted>",
          "auth": {
            "clientSecret": "<redacted>",
            "redirectPort": 8080
          }
        }
      }
    }
    
  2. Start Copilot CLI.

  3. Run /mcp auth google-calendar.

  4. Authentication fails with the RFC 8414 issuer-mismatch error above. The
    browser consent flow never starts.

The same behavior occurs with the other Google Workspace MCP endpoints.

Expected behavior

Copilot CLI should be able to authenticate with Google's official Workspace MCP
endpoints.

Ideally, the implementation would preserve strict issuer validation while
canonicalizing only semantically equivalent origin-root URLs before selecting
the discovery issuer (or otherwise handling the empty-path/trailing-slash
equivalence safely). If that is not acceptable under the CLI's RFC 8414
validation policy, the error should identify the two compared values and
provide an actionable, narrowly scoped compatibility option.

Additional context
  • OS: macOS 26.6
  • Architecture: Apple Silicon (arm64)
  • Terminal: iTerm2
  • Shell: zsh

A pinned mcp-remote@0.2.4 stdio proxy using the same endpoint, OAuth client,
redirect URI, and Google account completes the OAuth flow successfully and can
call the Google tools. This confirms the client registration, consent, token
exchange, scopes, and MCP endpoints are functional; the failure is specific to
Copilot CLI's native HTTP MCP OAuth discovery/issuer validation.

Related reports:

  • #4480 covers an Atlassian hostname mismatch.
  • #4439 covers malformed GitLab protected-resource metadata and fallback
    discovery.

This Google case is distinct: the protected-resource metadata uses the
RFC 9728 resource string and authorization_servers array correctly, and the
issuer differs only by a trailing slash at the authorization server's root.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện /mcp auth google-calendar với Calendar MCP endpoint đã được ghi chép và kiểm tra đường dẫn discovery và xác thực issuer HTTP MCP OAuth gốc. So sánh URL máy chủ ủy quyền của tài nguyên được bảo vệ với issuer được phát hiện, sau đó xác minh rằng việc xác thực thành công đối với các endpoint của Google mà không làm yếu xác thực issuer nói chung, hoặc mọi lỗi tương thích đều báo cáo rõ ràng cả hai giá trị.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Lĩnh vực
api, authentication, cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.