Enable stateless mode in remote MCP server template#7441
Merged
stephentoub merged 3 commits intodotnet:mainfrom Mar 31, 2026
Merged
Enable stateless mode in remote MCP server template#7441stephentoub merged 3 commits intodotnet:mainfrom
stephentoub merged 3 commits intodotnet:mainfrom
Conversation
The MCP C# SDK v1.2.0 recommends explicitly setting stateless or stateful mode for HTTP-based servers. Since the template server only exposes tools and does not need server-to-client requests (sampling, elicitation), set Stateless = true per the SDK getting-started guidance. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MCP remote server project template to explicitly configure HTTP transport as stateless, aligning the template with newer MCP C# SDK guidance for servers that only expose tools.
Changes:
- Configure
.WithHttpTransport(...)in the remote template to setoptions.Stateless = trueand add explanatory comments/link. - Update the verified snapshot output for the remote template to match the new Program.cs content.
- Bump the template package minor version from
1.1.0to1.2.0.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/ProjectTemplates/Microsoft.McpServer.ProjectTemplates.IntegrationTests/Snapshots/mcpserver/mcpserver.remote.verified/mcpserver/Program.cs | Updates expected generated remote Program.cs snapshot to include stateless HTTP transport configuration. |
| src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-CSharp/remote/Program.cs | Sets HTTP transport to stateless mode in the remote template and documents the rationale. |
| src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/Microsoft.McpServer.ProjectTemplates.csproj | Bumps template package version minor to 1.2.0. |
Update ModelContextProtocol.Core, ModelContextProtocol, and ModelContextProtocol.AspNetCore package versions from 1.1.0 to 1.2.0 to match the SDK release that introduces stateless mode defaults. Co-authored-by: Copilot <[email protected]>
stephentoub
approved these changes
Mar 31, 2026
jeffhandley
added a commit
to jeffhandley/extensions
that referenced
this pull request
Mar 31, 2026
* Enable stateless mode in remote MCP server template The MCP C# SDK v1.2.0 recommends explicitly setting stateless or stateful mode for HTTP-based servers. Since the template server only exposes tools and does not need server-to-client requests (sampling, elicitation), set Stateless = true per the SDK getting-started guidance. Co-authored-by: Copilot <[email protected]> * Bump ModelContextProtocol packages to 1.2.0 Update ModelContextProtocol.Core, ModelContextProtocol, and ModelContextProtocol.AspNetCore package versions from 1.1.0 to 1.2.0 to match the SDK release that introduces stateless mode defaults. Co-authored-by: Copilot <[email protected]> * Bump to 10.0.5 packages (align with the MCP transitive dependencies) --------- Co-authored-by: Copilot <[email protected]>
jeffhandley
added a commit
that referenced
this pull request
Apr 1, 2026
jozkee
pushed a commit
to jozkee/extensions
that referenced
this pull request
Apr 3, 2026
* Enable stateless mode in remote MCP server template The MCP C# SDK v1.2.0 recommends explicitly setting stateless or stateful mode for HTTP-based servers. Since the template server only exposes tools and does not need server-to-client requests (sampling, elicitation), set Stateless = true per the SDK getting-started guidance. Co-authored-by: Copilot <[email protected]> * Bump ModelContextProtocol packages to 1.2.0 Update ModelContextProtocol.Core, ModelContextProtocol, and ModelContextProtocol.AspNetCore package versions from 1.1.0 to 1.2.0 to match the SDK release that introduces stateless mode defaults. Co-authored-by: Copilot <[email protected]> * Bump to 10.0.5 packages (align with the MCP transitive dependencies) --------- Co-authored-by: Copilot <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The MCP C# SDK v1.2.0 recommends explicitly setting stateless or stateful mode for HTTP-based servers. Since the template server only exposes tools and does not need server-to-client requests (sampling, elicitation), set Stateless = true per the SDK getting-started guidance.
Microsoft Reviewers: Open in CodeFlow