@@ -13,22 +13,6 @@ public static async Task<IServiceCollection> AddMCPService(this IServiceCollecti
1313 var openApiPath = Path . Combine ( AppContext . BaseDirectory , $ "openapi_{ apiVersion } .json") ;
1414 var tenantId = "b81eb003-1c5c-45fd-848f-90d9d3f8d016" ;
1515
16- services . AddScoped ( sp =>
17- {
18- // This shouldn't be needed, since proper MCP clients handle this via the "/.well-known/oauth-protected-resource" endpoint
19- // Keep this in until following issue is solved: https://github.com/abdebek/MCPify/issues/20
20- return new OAuthAuthorizationCodeAuthentication (
21- clientId : "b6997777-3799-4c55-b78a-4ce96e3d959c" ,
22- authorizationEndpoint : $ "https://login.microsoftonline.com/{ tenantId } /oauth2/v2.0/authorize",
23- tokenEndpoint : $ "https://login.microsoftonline.com/{ tenantId } /oauth2/v2.0/token",
24- scope : "b6997777-3799-4c55-b78a-4ce96e3d959c/.default" ,
25- secureTokenStore : sp . GetRequiredService < ISecureTokenStore > ( ) ,
26- mcpContextAccessor : sp . GetRequiredService < IMcpContextAccessor > ( ) ,
27- redirectUri : $ "{ mcpServerBaseUrl } /auth/callback",
28- usePkce : true
29- ) ;
30- } ) ;
31-
3216 services . AddScoped ( sp =>
3317 {
3418 return new ApiKeyAuthentication (
@@ -55,8 +39,8 @@ public static async Task<IServiceCollection> AddMCPService(this IServiceCollecti
5539 OpenApiFilePath = openApiPath ,
5640 ApiBaseUrl = $ "{ apiBaseUrl } /{ apiVersion } ",
5741 Filter = op => op . Route . StartsWith ( "/teller" ) ,
58- ToolPrefix = "bankApiViaOAuth" ,
59- AuthenticationFactory = sp => sp . GetRequiredService < OAuthAuthorizationCodeAuthentication > ( )
42+ TokenSource = TokenSource . Client ,
43+ ToolPrefix = "bankApiViaOAuth"
6044 } ) ;
6145 options . ExternalApis . Add ( new ( )
6246 {
0 commit comments