Add application_type to Dynamic Client Registration per MCP spec SEP-837#1475
Add application_type to Dynamic Client Registration per MCP spec SEP-837#1475
application_type to Dynamic Client Registration per MCP spec SEP-837#1475Conversation
…pec SEP-837 Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/8a200407-8cc6-4c69-97e0-c9a6ad509b93 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
…licly Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/8a200407-8cc6-4c69-97e0-c9a6ad509b93 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/8a200407-8cc6-4c69-97e0-c9a6ad509b93 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
application_type to Dynamic Client Registration per MCP spec SEP-837
| /// should use "native", and web applications (remote browser-based) should use "web". | ||
| /// </para> | ||
| /// </remarks> | ||
| public string? ApplicationType { get; set; } |
There was a problem hiding this comment.
@copilot as this is part of a not-yet-published version of the spec, it should be [Experimental]. Same for any other public surface area added in the PR.
There was a problem hiding this comment.
Done in fcf950e. DynamicClientRegistrationOptions.ApplicationType is now marked [Experimental(Experimentals.DcrApplicationType_DiagnosticId, UrlFormat = Experimentals.DcrApplicationType_Url)] (using MCPEXP001 since it's a spec feature). Added the corresponding constants to Experimentals.cs, updated docs/list-of-diagnostics.md, and added #pragma warning disable MCPEXP001 suppressions in ClientOAuthProvider.cs and the test that sets the property.
DynamicClientRegistrationRequest.ApplicationType is internal so it doesn't need the attribute.
…l] per SEP-837 Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/ef973045-314b-4c42-821b-c467c7a0e8e6 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
SEP-837 (merged 2026-03-28) adds "Application Type and Redirect URI Constraints" to the MCP auth spec, requiring clients to include
application_typein DCR requests. Omitting it defaults to"web"under OIDC, which breaks native-style localhost redirect URIs.Changes
DynamicClientRegistrationRequest— adds[JsonPropertyName("application_type")] string? ApplicationTypeDynamicClientRegistrationOptions— addsApplicationType(marked[Experimental(MCPEXP001)]) for explicit override; if unset, auto-detected from redirect URIClientOAuthProvider— populatesapplication_typein every DCR request:"native"when redirect URI resolves to a loopback address (localhost,127.0.0.1,::1, etc.) viaIPAddress.IsLoopback"web"for all other redirect URIsDynamicClientRegistrationOptions.ApplicationTypetakes precedence over auto-detectionExperimentals.cs— addsDcrApplicationType_DiagnosticId/Message/Urlconstants (sharingMCPEXP001as a spec-level experimental feature)docs/list-of-diagnostics.md— updatesMCPEXP001entry to mention SEP-837 and theapplication_typeDCR parameterClientRegistrationRequestgainsApplicationType;ProgramexposesLastRegistrationApplicationTypefor test assertions"native", remote URI auto-detect →"web", and explicit overrideOriginal prompt
Background
The MCP authorization spec was updated via SEP-837 (merged 2026-03-28) to add a new section "Application Type and Redirect URI Constraints" under Dynamic Client Registration. The C# SDK needs to be updated to comply with these new requirements.
Spec Requirements (from SEP-837)
The new spec text (lines 334-361 of
docs/specification/draft/basic/authorization.mdx) states:Changes Needed in the C# SDK
1. Add
application_typetoDynamicClientRegistrationRequestIn
src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationRequest.cs, add a new property:2. Add
ApplicationTypeoption toDynamicClientRegistrationOptionsIn
src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs, add a property so users can explicitly override the application type:3. Update
ClientOAuthProvider.PerformDynamicClientRegistrationAsync()In
src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs, update the method that builds theDynamicClientRegistrationRequestto includeapplication_type. The logic should be:DynamicClientRegistrationOptions.ApplicationTypeis explicitly set, use that value."native"if the redirect URI host islocalhostor127.0.0.1(or[::1]), and"web"otherwise.The registration request construction (currently around line 648-656) should include:
Add a helper method:
Store the configured application type from options in the constructor:
4. Update the test OAuth server's
ClientRegistrationRequestIn
tests/ModelContextProtocol.TestOAuthServer/ClientRegistrationRequest.cs, add:5. Add tests
Add tests to verify:
application_typeis include...This pull request was created from Copilot chat.
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.