Skip to content

Enable stateless mode in remote MCP server template#7441

Merged
stephentoub merged 3 commits intodotnet:mainfrom
jeffhandley:jeffhandley/mcpserver-template-1.2.0
Mar 31, 2026
Merged

Enable stateless mode in remote MCP server template#7441
stephentoub merged 3 commits intodotnet:mainfrom
jeffhandley:jeffhandley/mcpserver-template-1.2.0

Conversation

@jeffhandley
Copy link
Copy Markdown
Member

@jeffhandley jeffhandley commented Mar 31, 2026

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

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]>
@jeffhandley jeffhandley requested a review from a team as a code owner March 31, 2026 04:43
Copilot AI review requested due to automatic review settings March 31, 2026 04:43
@github-actions github-actions Bot added the area-ai-templates Microsoft.Extensions.AI.Templates label Mar 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 set options.Stateless = true and 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.0 to 1.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]>
@jeffhandley jeffhandley requested a review from a team as a code owner March 31, 2026 05:09
@stephentoub stephentoub merged commit e253fc2 into dotnet:main Mar 31, 2026
6 checks passed
@jeffhandley jeffhandley deleted the jeffhandley/mcpserver-template-1.2.0 branch March 31, 2026 15:49
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]>
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]>
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai-templates Microsoft.Extensions.AI.Templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants