-
Notifications
You must be signed in to change notification settings - Fork 849
Introduce local vs. remote mcpserver template option #7168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce local vs. remote mcpserver template option #7168
Conversation
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
There was a problem hiding this 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
--transportparameter with choices of "local" (default) or "remote" to select the transport type - Creation of separate template source directories (
local/andremote/) 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 |
...ctTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-CSharp/remote/README.md
Outdated
Show resolved
Hide resolved
MackinnonBuck
left a comment
There was a problem hiding this 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!
* 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
* 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
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