Skip to content

Commit 96acbc1

Browse files
committed
fix AS example and add readme
1 parent e59fbdf commit 96acbc1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,20 @@ async def introspect_handler(request: Request) -> Response:
113113
return JSONResponse({"active": False})
114114

115115
# Return token info for Resource Server
116-
return JSONResponse(
117-
{
118-
"active": True,
119-
"client_id": access_token.client_id,
120-
"scope": " ".join(access_token.scopes),
121-
"exp": access_token.expires_at,
122-
"iat": int(time.time()),
123-
"token_type": "Bearer",
124-
}
125-
)
116+
response_data = {
117+
"active": True,
118+
"client_id": access_token.client_id,
119+
"scope": " ".join(access_token.scopes),
120+
"exp": access_token.expires_at,
121+
"iat": int(time.time()),
122+
"token_type": "Bearer",
123+
}
124+
125+
# Include audience claim for RFC 8707 resource validation
126+
if access_token.resource:
127+
response_data["aud"] = access_token.resource
128+
129+
return JSONResponse(response_data)
126130

127131
routes.append(
128132
Route(

0 commit comments

Comments
 (0)