Add application_type to the Dynamic Client Registration request (#1613)

This commit is contained in:
Jayaraman Venkatesan 2026-07-22 13:43:36 -04:00 • committed by GitHub
commit 20c464c55b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,6 +110,33 @@ public class AuthTests : OAuthTestBase
await using var client = await McpClient.CreateAsync(
transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken);
Assert.Equal("native", TestOAuthServer.LastApplicationType);
}
[Fact]
public async Task DynamicClientRegistration_UsesExplicitApplicationType()
{
await using var app = await StartMcpServerAsync();
await using var transport = new HttpClientTransport(new()
{
Endpoint = new(McpServerUrl),
OAuth = new ClientOAuthOptions()
{
RedirectUri = new Uri("http://localhost:1179/callback"),
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
DynamicClientRegistration = new()
{
ApplicationType = "web",
},
},
}, HttpClient, LoggerFactory);
await using var client = await McpClient.CreateAsync(
transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken);
Assert.Equal("web", TestOAuthServer.LastApplicationType);
}
[Fact]
@ -124,7 +151,11 @@ public class AuthTests : OAuthTestBase
{
RedirectUri = new Uri("http://localhost:1179/callback"),
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
ClientMetadataDocumentUri = new Uri(ClientMetadataDocumentUrl)
ClientMetadataDocumentUri = new Uri(ClientMetadataDocumentUrl),
DynamicClientRegistration = new()
{
ApplicationType = "web",
},
},
}, HttpClient, LoggerFactory);
@ -258,6 +289,10 @@ public class AuthTests : OAuthTestBase
RedirectUri = new Uri("http://localhost:1179/callback"),
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
ClientMetadataDocumentUri = new Uri("http://invalid-cimd.example.com"),
DynamicClientRegistration = new()
{
ApplicationType = "web",
},
},
}, HttpClient, LoggerFactory);