Commit 6493559
fix: include transport path in protected resource metadata URL (RFC 9728)
Per RFC 9728 §3, the `resource` field in `/.well-known/oauth-protected-resource`
must identify the actual protected endpoint URL — e.g. `http://localhost:8000/mcp`,
not the bare server base `http://localhost:8000/`. Without the path, VS Code Copilot
and other spec-compliant clients reject the server with:
Protected Resource Metadata resource "http://localhost:8000/" does not match
MCP server resolved resource "http://localhost:8000/mcp"
Fix: append `streamable_http_path` / `sse_path` to `resource_server_url` before
passing it to `create_protected_resource_routes` and `build_resource_metadata_url`
in both the lowlevel and mcpserver transports.
Fixes #1264
Signed-off-by: Alex Fisch <afischh@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent e8e6484 commit 6493559
3 files changed
Lines changed: 79 additions & 4 deletions
File tree
- src/mcp/server
- lowlevel
- mcpserver
- tests/server/auth
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
633 | 634 | | |
634 | 635 | | |
635 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
636 | 640 | | |
637 | | - | |
| 641 | + | |
638 | 642 | | |
639 | 643 | | |
640 | 644 | | |
| |||
653 | 657 | | |
654 | 658 | | |
655 | 659 | | |
| 660 | + | |
656 | 661 | | |
657 | 662 | | |
658 | | - | |
| 663 | + | |
659 | 664 | | |
660 | 665 | | |
661 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
987 | 988 | | |
988 | 989 | | |
989 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
990 | 994 | | |
991 | | - | |
| 995 | + | |
992 | 996 | | |
993 | 997 | | |
994 | 998 | | |
| |||
1028 | 1032 | | |
1029 | 1033 | | |
1030 | 1034 | | |
| 1035 | + | |
1031 | 1036 | | |
1032 | 1037 | | |
1033 | | - | |
| 1038 | + | |
1034 | 1039 | | |
1035 | 1040 | | |
1036 | 1041 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
0 commit comments