File tree Expand file tree Collapse file tree 5 files changed +20
-5
lines changed
Expand file tree Collapse file tree 5 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 2323)
2424from src .mcp_importer .merge import MergePolicy , merge_servers
2525from src .oauth_manager import get_oauth_manager
26+ from src .oauth_override import OpenEdisonOAuth
2627
2728
2829class CLIENT (str , Enum ):
@@ -211,7 +212,6 @@ async def _authorize_async() -> bool:
211212 try :
212213 # Import lazily to avoid import-time side effects
213214 from fastmcp import Client as FastMCPClient # type: ignore
214- from fastmcp .client .auth import OAuth # type: ignore
215215
216216 # Debug info prior to starting OAuth
217217 print (
@@ -223,7 +223,7 @@ async def _authorize_async() -> bool:
223223 f"client_name={ server .oauth_client_name or 'Open Edison Setup' } " ,
224224 )
225225
226- oauth = OAuth (
226+ oauth = OpenEdisonOAuth (
227227 mcp_url = remote_url ,
228228 scopes = server .oauth_scopes ,
229229 client_name = server .oauth_client_name or "Open Edison Setup" ,
Original file line number Diff line number Diff line change 1919)
2020from loguru import logger as log
2121
22+ from src .oauth_override import OpenEdisonOAuth
23+
2224
2325class OAuthStatus (Enum ):
2426 """OAuth authentication status for MCP servers."""
@@ -209,7 +211,7 @@ def get_oauth_auth(
209211 return None
210212
211213 try :
212- oauth = OAuth (
214+ oauth = OpenEdisonOAuth (
213215 mcp_url = mcp_url ,
214216 scopes = scopes or info .scopes ,
215217 client_name = client_name or info .client_name ,
Original file line number Diff line number Diff line change 1+ import webbrowser
2+
3+ from fastmcp .client .auth .oauth import OAuth as _FastMCPOAuth
4+
5+
6+ class OpenEdisonOAuth (_FastMCPOAuth ):
7+ async def redirect_handler (self , authorization_url : str ) -> None : # noqa: ARG002
8+ # Print a clean, single-line URL and still open the browser.
9+ print (f"OAuth authorization URL: { authorization_url } " , flush = True )
10+ webbrowser .open (authorization_url )
Original file line number Diff line number Diff line change 3636 create_db_session ,
3737)
3838from src .oauth_manager import OAuthStatus , get_oauth_manager
39+ from src .oauth_override import OpenEdisonOAuth
3940from src .single_user_mcp import SingleUserMCP
4041from src .telemetry import initialize_telemetry , set_servers_installed
4142
@@ -954,10 +955,9 @@ async def oauth_test_connection(
954955
955956 # Import FastMCP client for testing
956957 from fastmcp import Client as FastMCPClient
957- from fastmcp .client .auth import OAuth
958958
959959 # Create OAuth auth object
960- oauth = OAuth (
960+ oauth = OpenEdisonOAuth (
961961 mcp_url = remote_url ,
962962 scopes = scopes ,
963963 client_name = client_name or "OpenEdison MCP Gateway" ,
Original file line number Diff line number Diff line change 1+ from src .oauth_override import OpenEdisonOAuth
2+
3+ OpenEdisonOAuth .redirect_handler # noqa: B018 unused method (src/oauth_override.py:7)
You can’t perform that action at this time.
0 commit comments