1212from starlette .exceptions import HTTPException
1313from starlette .requests import Request
1414from starlette .responses import JSONResponse , RedirectResponse , Response , HTMLResponse
15- from dataclasses import dataclass
16-
1715
1816from mcp .server .auth .middleware .auth_context import get_access_token
1917from mcp .server .auth .provider import (
@@ -76,8 +74,6 @@ def __init__(self, settings: ServerSettings):
7674 # Store GitHub tokens with MCP tokens using the format:
7775 # {"mcp_token": "github_token"}
7876 self .token_mapping : dict [str , str ] = {}
79- # Track which clients have been granted consent
80- self .client_consent : dict [str , bool ] = {}
8177
8278 async def get_client (self , client_id : str ) -> OAuthClientInformationFull | None :
8379 """Get OAuth client information."""
@@ -87,14 +83,6 @@ async def register_client(self, client_info: OAuthClientInformationFull):
8783 """Register a new OAuth client."""
8884 self .clients [client_info .client_id ] = client_info
8985
90- async def has_client_consent (self , client : OAuthClientInformationFull ) -> bool :
91- """Check if a client has already provided consent."""
92- return self .client_consent .get (client .client_id , False )
93-
94- async def grant_client_consent (self , client : OAuthClientInformationFull ) -> None :
95- """Grant consent for a client."""
96- self .client_consent [client .client_id ] = True
97-
9886 async def authorize (
9987 self , client : OAuthClientInformationFull , params : AuthorizationParams
10088 ) -> str :
@@ -277,8 +265,6 @@ async def revoke_token(
277265
278266class ConsentHandler :
279267
280-
281-
282268 def __init__ (self , provider : SimpleGitHubOAuthProvider , settings : ServerSettings , path : str ):
283269 self .provider : SimpleGitHubOAuthProvider = provider
284270 self .settings : ServerSettings = settings
@@ -299,6 +285,7 @@ async def handle(self, request: Request) -> Response:
299285 async def _show_consent_form (self , request : Request ) -> HTMLResponse :
300286 client_id = request .query_params .get ("client_id" , "" )
301287 redirect_uri = request .query_params .get ("redirect_uri" , "" )
288+ # TODO: address csrf
302289 state = request .query_params .get ("state" , "" )
303290 scopes = request .query_params .get ("scopes" , "" )
304291 code_challenge = request .query_params .get ("code_challenge" , "" )
0 commit comments