Skip to content

Commit 4cfc056

Browse files
committed
fix: append /mcp to resource_server_url with trailing slash handling
Append '/mcp' to resource_server_url and handle trailing slashes to ensure proper OAuth Protected Resource Metadata validation. This prevents the error: "Protected Resource Metadata resource does not match MCP server resolved resource" which occurs when the PRM resource URL doesn't exactly match the server URL. Fixes compatibility with VS Code + MCP authentication per RFC 9728. References: microsoft/vscode#255255
1 parent 5780d4d commit 4cfc056

File tree

1 file changed

+1
-1
lines changed
  • examples/servers/simple-auth/mcp_simple_auth

1 file changed

+1
-1
lines changed

examples/servers/simple-auth/mcp_simple_auth/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def create_resource_server(settings: ResourceServerSettings) -> FastMCP:
7979
auth=AuthSettings(
8080
issuer_url=settings.auth_server_url,
8181
required_scopes=[settings.mcp_scope],
82-
resource_server_url=settings.server_url,
82+
resource_server_url=AnyHttpUrl(f"{str(settings.server_url).rstrip('/')}/mcp"),
8383
),
8484
)
8585

0 commit comments

Comments
 (0)