@@ -102,20 +102,16 @@ def __init__(self, port=3000):
102
102
self .port = port
103
103
self .server = None
104
104
self .thread = None
105
- self .callback_data = {
106
- "authorization_code" : None ,
107
- "state" : None ,
108
- "error" : None
109
- }
105
+ self .callback_data = {"authorization_code" : None , "state" : None , "error" : None }
110
106
111
107
def _create_handler_with_data (self ):
112
108
"""Create a handler class with access to callback data."""
113
109
callback_data = self .callback_data
114
-
110
+
115
111
class DataCallbackHandler (CallbackHandler ):
116
112
def __init__ (self , request , client_address , server ):
117
113
super ().__init__ (request , client_address , server , callback_data )
118
-
114
+
119
115
return DataCallbackHandler
120
116
121
117
def start (self ):
@@ -144,7 +140,7 @@ def wait_for_callback(self, timeout=300):
144
140
raise Exception (f"OAuth error: { self .callback_data ['error' ]} " )
145
141
time .sleep (0.1 )
146
142
raise Exception ("Timeout waiting for OAuth callback" )
147
-
143
+
148
144
def get_state (self ):
149
145
"""Get the received state parameter."""
150
146
return self .callback_data ["state" ]
@@ -155,9 +151,6 @@ class SimpleAuthClient:
155
151
156
152
def __init__ (self , server_url : str ):
157
153
self .server_url = server_url
158
- # Extract base URL for auth server (remove /mcp endpoint for auth endpoints)
159
- # Use default redirect URI - this is where the auth server will redirect
160
- # The user will need to copy the authorization code from this callback URL
161
154
self .session : ClientSession | None = None
162
155
163
156
async def connect (self ):
@@ -202,8 +195,6 @@ async def _default_redirect_handler(authorization_url: str) -> None:
202
195
callback_handler = callback_handler ,
203
196
)
204
197
205
- # Initialize the auth handler and ensure we have tokens
206
-
207
198
# Create streamable HTTP transport with auth handler
208
199
stream_context = streamablehttp_client (
209
200
url = self .server_url ,
0 commit comments