You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp_oauth_server example can not be tested in mcp inspector v0.13 #217
Maybe we should change the header from 2024-11-05 to 2025-03-26? The latest mcp inspector send 2025-03-26 to auth now, oauth examples do not work with it.
I checked the mcp inspector PR #355 and test the single mcp server writen in python sdk #610, it works fine.
I think I found the problem, there is a cors_middleware in python example, looks like:
# Create routes# Allow CORS requests for endpoints meant to be hit by the OAuth client# (with the client secret). This is intended to support things like MCP Inspector,# where the client runs in a web browser.routes= [
Route(
"/.well-known/oauth-authorization-server",
endpoint=cors_middleware(
MetadataHandler(metadata).handle,
["GET", "OPTIONS"],
),
methods=["GET", "OPTIONS"],
),
And there is not a CORS middleware in rust example.
I also check the preflight OPTIONS request in my browser, rust example response do not have Allow-Cross-Control-* headers, but python example does have.
here are respose headers:
Rust example:
HTTP/1.1 200 OK
content-type: application/json
content-length: 277
date: Sun, 25 May 2025 11:42:57 GMT
Activity
[-]Auth Headers is too old?[/-][+]mcp_oauth_server example can not be tested in mcp inspector v0.13[/+]yexuanyang commentedon May 25, 2025
I compare the request headers sent by inspector in python example with rust example, hope these data can help.
Request headers in python example:
Request headers in rust example:
yexuanyang commentedon May 25, 2025
I think I found the problem, there is a cors_middleware in python example, looks like:
source link here: https://github.com/modelcontextprotocol/python-sdk/blob/f2f4dbdcbd30fd00ced777fd1f59d00624362c97/src/mcp/server/auth/routes.py#L88-L99
And there is not a CORS middleware in rust example.
I also check the preflight OPTIONS request in my browser, rust example response do not have
Allow-Cross-Control-*headers, but python example does have.here are respose headers:
Rust example:
Python example:
I think it is the key
yexuanyang commentedon May 25, 2025
I have fixed this problem, I will create a pull request.
jokemanfire commentedon May 26, 2025
I think it has been resolved.