Skip to content

Commit d0da16f

Browse files
committed
mcpify 0.0.13 updates
1 parent b96d38c commit d0da16f

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

BankApi.Mcp/BankApi.Mcp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="MCPify" Version="0.0.12" />
10+
<PackageReference Include="MCPify" Version="0.0.13-preview" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

BankApi.Mcp/Builder.MCP.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{

BankApi.Mcp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
var app = builder.Build();
88

9-
app.UseMcpifyContext(); // Enable MCPify's context accessor middleware
10-
app.UseMcpifyOAuth(); // Enable MCPify's OAuth middleware
9+
app.UseAuthentication();
10+
app.UseAuthorization();
1111

1212
app.MapMcpifyEndpoint(); // Map the MCP Endpoint (for HTTP transport) and OAuth metadata endpoint
1313
app.MapAuthCallback("/auth/callback"); // only required when not using the official MCP server authorization flow

0 commit comments

Comments
 (0)