Fix missing PRM endpoint that hinders OAuth functionality#270
Open
Fix missing PRM endpoint that hinders OAuth functionality#270
Conversation
Member
|
@copilot 继续 |
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Contributor
Author
已完成修复(commit 在
返回示例: { "resource": "http://localhost:8024/mcp" } |
Copilot
AI
changed the title
[WIP] Fix missing PRM that hinders OAuth functionality
Fix missing PRM endpoint that hinders OAuth functionality
Feb 25, 2026
Member
|
@clgtm 帮忙看看这个是不是解决了? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #270 +/- ##
==========================================
- Coverage 82.10% 81.70% -0.41%
==========================================
Files 43 43
Lines 2040 2050 +10
Branches 34 34
==========================================
Hits 1675 1675
- Misses 363 373 +10
Partials 2 2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
/.well-known/oauth-protected-resource(Protected Resource Metadata) endpoint to both HTTP-based transports, resolving the PRM discovery failure reported by OAuth compliance tools such as authprobe.Changes Made
src/services/streamable.ts: Added a GET handler at/.well-known/oauth-protected-resource/mcp(path suffix follows RFC 9728) that returns the resource metadata JSON.src/services/sse.ts: Added a GET handler at/.well-known/oauth-protected-resource/ssethat returns the resource metadata JSON.The resource URL is dynamically constructed from the incoming request's
protocolandhostheaders, so it works correctly in any deployment environment without hardcoded values.Example response for a server running at
http://localhost:8024/mcp:{ "resource": "http://localhost:8024/mcp" }Testing
Original prompt
This section details on the original issue you should resolve
<issue_title>missing PRM hinders oauth</issue_title>
<issue_description>```
Command: authprobe scan --llm-max-tokens=1080 --openai-api-key=REDACTED http://localhost:8024/mcp
Scanning: http://localhost:8024/mcp
Scan time: Feb 20, 2026 06:58:55 UTC
Github: https://github.com/authprobe/authprobe
Funnel
[1] MCP probe (401 + WWW-Authenticate) [-] SKIP
probe returned 405; checking PRM for OAuth config
[2] MCP initialize + tools/list [+] PASS
initialize -> 200
notifications/initialized -> 202
tools/list -> 200 (tools: generate_area_chart, generate_bar_chart,
generate_boxplot_chart, generate_column_chart, +23 more)
[3] PRM fetch matrix [X] FAIL
PRM unreachable or unusable; OAuth discovery unavailable
[4] Auth server metadata [-] SKIP
auth not required
[5] Token endpoint readiness (heuristics) [-] SKIP
auth not required
[6] Dynamic client registration (RFC 7591) [-] SKIP
auth not required
┌───────────────────────┤ CALL TRACE ├───────────────────────┐
Call Trace Using: https://github.com/authprobe/authprobe
┌────────────┐ ┌────────────┐
│ authprobe │ │ MCP Server │
└─────┬──────┘ └─────┬──────┘
│ │
│ ╔═══ Step 1: MCP probe ═══════╪═══════════════════╗
│ GET http://localhost:8024/mcp
│ Reason: 401 + WWW-Authenticate discovery
│ Accept: text/event-stream
│ Host: localhost:8024
├─────────────────────────────────────────────────────────────────►│
│ 405 Method Not Allowed
│ Connection: keep-alive
│ Date: Fri, 20 Feb 2026 06:58:51 GMT
│ Keep-Alive: timeout=5
│ X-Powered-By: Express
│◄─────────────────────────────────────────────────────────────────┤
│ │
│ ╔═══ Step 2: MCP initialize ═══════╪═══════════════════╗
│ POST http://localhost:8024/mcp
│ Reason: Step 2: MCP initialize + tools/list (pre-init tools/list)
│ Accept: application/json, text/event-stream
│ Content-Type: application/json
│ Host: localhost:8024
│ Mcp-Protocol-Version: 2025-11-25
├─────────────────────────────────────────────────────────────────►│
│ 200 OK
│ Cache-Control: no-cache
│ Connection: keep-alive
│ Content-Type: text/event-stream
│ Date: Fri, 20 Feb 2026 06:58:51 GMT
│ X-Powered-By: Express
│◄─────────────────────────────────────────────────────────────────┤
│ │
│ POST http://localhost:8024/mcp
│ Reason: Step 2: MCP initialize + tools/list (initialize)
│ Accept: application/json, text/event-stream
│ Content-Type: application/json
│ Host: localhost:8024
│ Mcp-Protocol-Version: 2025-11-25
├─────────────────────────────────────────────────────────────────►│
│ 200 OK
│ Cache-Control: no-cache
│ Connection: keep-alive
│ Content-Type: text/event-stream
│ Date: Fri, 20 Feb 2026 06:58:52 GMT
│ X-Powered-By: Express
│◄─────────────────────────────────────────────────────────────────┤
│ │
│ POST http://localhost:8024/mcp
│ Reason: Step 2: MCP initialize + tools/list (notifications/initialized)
│ Accept: application/json, text/event-stream
│ Content-Type: application/json
│ Host: localhost:8024
│ Mcp-Protocol-Version: 2025-11-25
├─────────────────────────────────────────────────────────────────►│
│ 202 Accepted
│ Connection: keep-alive
│ Content-Type: text/plain; charset=UTF-8
│ Date: Fri, 20 Feb 2026 06:58:52 GMT
│ Keep-Alive: timeout=5
│ X-Pow...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.