Skip to content

Commit 48eb13d

Browse files
committed
more cleanup
1 parent 9439a4c commit 48eb13d

File tree

1 file changed

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

1 file changed

+1
-14
lines changed

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

+1-14
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from starlette.exceptions import HTTPException
1212
from starlette.requests import Request
1313
from starlette.responses import JSONResponse, RedirectResponse, Response, HTMLResponse
14-
from dataclasses import dataclass
15-
1614

1715
from mcp.server.auth.middleware.auth_context import get_access_token
1816
from 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

278266
class 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

Comments
 (0)