Add application_type to Dynamic Client Registration per MCP spec SEP-837#1475
Open
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>
Copilot
AI
changed the title
[WIP] Update C# SDK to comply with SEP-837
Add Mar 29, 2026
application_type to Dynamic Client Registration per MCP spec SEP-837
stephentoub
reviewed
Mar 29, 2026
src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs
Show resolved
Hide resolved
…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>
stephentoub
reviewed
Mar 31, 2026
| /// Web applications (remote browser-based) should use "web". | ||
| /// </remarks> | ||
| [JsonPropertyName("application_type")] | ||
| public string? ApplicationType { get; init; } |
Contributor
There was a problem hiding this comment.
@copilot this should also be annotated as experimental
Contributor
Author
There was a problem hiding this comment.
Done in bff2ac4. DynamicClientRegistrationRequest.ApplicationType is now marked [Experimental(Experimentals.DcrApplicationType_DiagnosticId, UrlFormat = Experimentals.DcrApplicationType_Url)], with a corresponding #pragma warning disable MCPEXP001 suppression at the call site in ClientOAuthProvider.cs.
stephentoub
approved these changes
Mar 31, 2026
…l] per SEP-837 Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/24355334-5ee3-4678-8a15-864de25fda7c Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.