Create a project template for an MCP server#6547
Conversation
Test commands: BUILD + INSTALL .\build.cmd -pack -projects .\src\ProjectTemplates\Microsoft.Extensions.AI.Templates\Microsoft.Extensions.AI.Templates.csproj; dotnet new uninstall Microsoft.Extensions.AI.Templates; dotnet new install Microsoft.Extensions.AI.Templates::9.7.0-dev --add-source Q:\src\dotnet-extensions\artifacts\packages\Debug\Shipping IN A NEW DIR + TEST TEMPLATE: gci Q:\trash\2025-06-25\template-try-2\* -Recurse | Remove-Item -Force -Recurse -Confirm:$false; dotnet new mcpserver; dotnet build; dotnet pack
…Server/McpServer-CSharp/Program.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
…Server/McpServer-CSharp/Program.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
…Server/McpServer-CSharp/Program.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
…Server/McpServer-CSharp/Program.cs
…Server/McpServer-CSharp/Program.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
…Server/McpServer-CSharp/McpServer-CSharp.csproj.in Co-authored-by: Stephen Toub <stoub@microsoft.com>
…Server/McpServer-CSharp/Program.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
|
I had created my own as I've been iterating on a few things https://github.com/timheuer/dotnet-mcp-server -- I think we should organize like the samples (Tools, etc.) rather than everything in Program.cs. Mine has some options to use http transport as well, arguable if that's needed in a v1, but easy to do. |
I like the Is there prior art for a "minimal" vs. "organized" template variants? Maybe we can call this one I am trying to see if there's a lean thing we can release soon, and then layer improvements on after that. Preview 6 has everything we need for E2E (with What do you think? |
…Server/McpServer-CSharp/McpServer-CSharp.csproj.in
No, see my previous comment about templates -- we really should have one MCP template...if it doesn't match our samples, we should question which one is better and why. Templates should be our best practices as we codify them. |
|
@timheuer, @MackinnonBuck, @jeffhandley, @stephentoub - I believe this is ready for review! |
timheuer
left a comment
There was a problem hiding this comment.
made one suggestion to Joel in chat else looks good to me.
The conventions we're pushing for on NuGet are: 1. `PackAsTool` 2. `McpServer` package type (in addition to the default `DotnetTool`) 3. Embed server.json This provides an `mcpserver` template as part of `Microsoft.Extensions.AI.Templates`. This currently only covers a local MCP server, with stdio transport.
This addresses #6518.
The conventions we're pushing for on NuGet are:
PackAsToolMcpServerpackage type (in addition to the defaultDotnetTool)Commands I use to test locally
TODO (for me, before merge):
TODO (for me, after merge):
Open question (for repo owners/reviewers):
Screenshots:
VS IDE - light mode:

VS IDE - dark mode:

Microsoft Reviewers: Open in CodeFlow