fix(mcp): RFC 8707 resource indicator derived from gateway URL breaks upstream OAuth
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- authentication, backend-api-design
Hướng nghiên cứu
Start with packages/core/src/mcp/oauth.ts, especially configuredDiscovery(), and trace how auth_server_metadata_url affects the RFC 8707 resource sent in authorize requests. Check the OAuth configuration schema for where an override or disable option belongs. Done means the configured behavior reaches the authorize request, with coverage for a gateway URL and a remote authorization server.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When mcp.servers.<name>.url points at a reverse-proxy gateway while oauth.auth_server_metadata_url points at the real provider's authorization-server metadata, OpenCode derives an RFC 8707 resource indicator from the gateway URL and attaches it to every authorize request (packages/core/src/mcp/oauth.ts, configuredDiscovery()).
Authorization servers that strictly validate the resource indicator reject this before showing any consent screen:
- Miro: callback lands on
error=server_error, browser shows "invalid_target" - Notion: HTTP 400
The same authorize URL minus the fabricated resource= parameter renders each provider's normal consent screen (verified with curl against both).
There is no declarative workaround today: the config schema exposes only optional fields (client_id, client secret, scope, callback port, redirect URI, authorization-server metadata URL) and has nothing that overrides or drops the derived indicator; dropping that last field just falls back to standard RFC 9728 discovery against the configured URL, which requires the gateway itself to publish protected-resource metadata.
Expected: when discovery is delegated via auth_server_metadata_url, let me configure which RFC 8707 resource is sent to the remote AS (e.g. oauth.resourceOverride) or disable the auto-derived one - tokens should bind to the provider's MCP resource, not to a loopback gateway URL it has never heard of.
Plugins
none relevant
OpenCode version
v2.2.5 (verified code path unchanged on v2.2.6 / current dev)
Operating System
Linux
Steps to reproduce
- Configure a remote MCP server whose
urlpoints at a local gateway endpoint such ashttp://127.0.0.1:4000/miro/mcpand set"oauth": { "auth_server_metadata_url": "https://mcp.miro.com/.well-known/oauth-authorization-server" } - Run
opencode mcp auth miro - Browser lands on Miro's invalid_target error page instead of the consent screen
Notion variant: authorize WITH resource=http://127.0.0.1:4000/notion/mcp returns HTTP 400; without that parameter Notion proceeds to its normal OAuth flow.
- Ngôn ngữ chính
- TypeScript
- Star
- 225k
- Fork
- 30.4k
- Merge trung bình
- 4 giờ 16 phút
- Pull request đã merge (30 ngày)
- 528
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
anomalyco/opencode#62873 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#62822 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/opencode#62601 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#62516 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
anomalyco/opencode#62374 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
code-quality good-first-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OpenRailAssociation/netzgrafik-editor-frontend#1481 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🙌 icon request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
lucide-icons/lucide#5183 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Unhandled rejection when a call fails before delivery and an argument is an imported promiseĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
cloudflare/capnweb#293 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug implicit-state
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
area:models enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày