Skip to content

Conversation

@jeffhandley
Copy link
Member

@jeffhandley jeffhandley commented Dec 19, 2025

This also moves the mcpserver project template to its own (new) package: Microsoft.McpServer.ProjectTemplates. Bump ModelContextProtocol to 0.5.0-preview.1 for the template (both local and remote).

Note there is a known issue for using http mcp servers in VS Code when using the dev-cert. To work around that, we only use HTTPS for the template when the host is Visual Studio; using VS Code or the CLI results in using HTTP. The README contains a Known Issues section to call this out.

Microsoft Reviewers: Open in CodeFlow
Usage:
  dotnet new mcpserver [options] [template options]

Options:
  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False]
  --force                 Forces content to be generated even if it would change existing files. [default: False]
  --no-update-check       Disables checking for the template package updates when instantiating a template. [default: False]
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.

Template options:
  -t, --transport <local|remote>           Whether to create a 'local' (stdio transport) or 'remote' (http transport) MCP server
                                           Type: choice
                                             local   A console application will be created to use the stdio transport as a local MCP server
                                             remote  An ASP.NET Core web application will be created to use the http transport as a remote MCP server
                                           Default: local
  --aot                                    Whether to enable the MCP server for publishing as a native AOT application.
                                           Type: bool
                                           Default: false
  --self-contained                         Whether to enable the MCP server for publishing as a self-contained application.
                                           Type: bool
                                           Default: true
  -f, --framework <net10.0|net8.0|net9.0>  The target framework for the project.
                                           Type: choice
                                             net10.0  .NET 10
                                             net9.0   .NET 9
                                             net8.0   .NET 8
                                           Default: net10.0

1. Move the VS/VS Code local config documentation blurb up in the README
2. Add a Known Issues section to the README
3. When using VS (not CLI or VS Code), use HTTPS instead of HTTP
@jeffhandley jeffhandley self-assigned this Dec 19, 2025
@jeffhandley jeffhandley added the area-ai-templates Microsoft.Extensions.AI.Templates label Dec 19, 2025
@jeffhandley jeffhandley requested a review from a team as a code owner December 19, 2025 23:40
Copilot AI review requested due to automatic review settings December 19, 2025 23:40
@jeffhandley jeffhandley requested a review from a team as a code owner December 19, 2025 23:40
Copy link
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

This PR introduces a local vs. remote transport option for the MCP server project template and moves it to a new dedicated package. The changes enable developers to choose between creating a local MCP server using stdio transport (as a console app) or a remote MCP server using HTTP transport (as an ASP.NET Core web application).

Key changes include:

  • Addition of a --transport parameter with choices of "local" (default) or "remote" to select the transport type
  • Creation of separate template source directories (local/ and remote/) for each transport mode
  • Conditional HTTPS redirection based on the host identifier (Visual Studio vs. VS Code/CLI) to work around known certificate issues
  • Update to ModelContextProtocol packages from version 0.4.0-preview.3 to 0.5.0-preview.1

Reviewed changes

Copilot reviewed 32 out of 52 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/** New package containing the mcpserver template with local/remote transport options
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/** Removed mcpserver template files, updated AIChatWeb template identity
test/ProjectTemplates/Microsoft.McpServer.ProjectTemplates.IntegrationTests/** Added snapshot and execution tests for the new mcpserver template package
test/ProjectTemplates/Infrastructure/** Enhanced test utilities to support the new transport parameter and .http file scrubbing
eng/packages/ProjectTemplates.props Updated ModelContextProtocol package versions and added AspNetCore variant

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@jeffhandley jeffhandley merged commit b60d3bb into dotnet:main Dec 20, 2025
2 of 5 checks passed
@jeffhandley jeffhandley deleted the jeffhandley/mcpserver-remote-template branch December 20, 2025 00:24
jeffhandley added a commit to jeffhandley/extensions that referenced this pull request Dec 20, 2025
* Move the mcpserver template into a new Microsoft.McpServer.ProjectTemplates package

* Add local/remote option to McpServer template. Bump to MCP 0.5.0-preview.1.

* Address feedback on the mcpserver remote template

1. Move the VS/VS Code local config documentation blurb up in the README
2. Add a Known Issues section to the README
3. When using VS (not CLI or VS Code), use HTTPS instead of HTTP

* Fix typo in README
jeffhandley added a commit that referenced this pull request Dec 20, 2025
* Move the mcpserver template into a new Microsoft.McpServer.ProjectTemplates package

* Add local/remote option to McpServer template. Bump to MCP 0.5.0-preview.1.

* Address feedback on the mcpserver remote template

1. Move the VS/VS Code local config documentation blurb up in the README
2. Add a Known Issues section to the README
3. When using VS (not CLI or VS Code), use HTTPS instead of HTTP

* Fix typo in README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants