Skip to content

Added FSharp Templates for MCP#7548

Open
licon4812 wants to merge 7 commits into
dotnet:mainfrom
licon4812:templates/mcp-fsharp
Open

Added FSharp Templates for MCP#7548
licon4812 wants to merge 7 commits into
dotnet:mainfrom
licon4812:templates/mcp-fsharp

Conversation

@licon4812

@licon4812 licon4812 commented Jun 8, 2026

Copy link
Copy Markdown

This pull request adds a new F# project template for creating Model Context Protocol (MCP) servers, alongside enhancements to the packaging and configuration of project templates. The new F# template supports both local (stdio) and remote (HTTP) transports, includes sample code and configuration, and aligns with the existing C# template structure. Additionally, the packaging logic in the main .csproj is updated to handle F# templates and content appropriately.

F# MCP Server Template Addition

  • Introduced a full-featured F# MCP server template, including configuration files (template.json, dotnetcli.host.json, ide.host.json), project files for both local and remote server types, sample tool implementation (RandomNumberTools.fs), a sample program entry point for each transport, and documentation (README.md). The template supports both self-contained and framework-dependent builds, and provides guidance for publishing to NuGet and local development. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Project Template Packaging Improvements

  • Updated the main project template .csproj to include and correctly transform both .csproj-in (C#) and .fsproj-in (F#) template files, ensuring they are packaged and processed as content.

C# Template Metadata Update

  • Added groupIdentity to the C# MCP server template configuration for improved template grouping and discoverability.
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings June 8, 2026 23:31
@licon4812 licon4812 requested a review from a team as a code owner June 8, 2026 23:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an F# MCP server project template with both local (stdio) and remote (HTTP) transport options, and updates packaging to correctly transform F# project files.

Changes:

  • Introduce new F# template content for local and remote MCP servers (README, Program.fs, project files, tooling, config).
  • Add MSBuild packaging support to transform .fsproj-in into .fsproj.
  • Align template grouping behavior by adding groupIdentity to the C# template.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/remote/README.md Adds remote (HTTP) template README with conditional content and IDE connection examples
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/remote/Properties/launchSettings.json Adds HTTP/HTTPS launch profiles for the remote template
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/remote/Program.fs Adds ASP.NET Core host wiring for MCP over HTTP
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/remote/McpServer-FSharp.http Adds an HTTP-file example for calling the MCP tool endpoint
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/remote/McpServer-FSharp.fsproj-in Adds remote F# project template including conditional self-contained settings
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/local/README.md Adds local (stdio) template README including NuGet packaging guidance
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/local/Program.fs Adds console host wiring for MCP over stdio
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/local/McpServer-FSharp.fsproj-in Adds local F# project template configured for packing as an MCP server tool
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/local/.mcp/server.json Adds MCP server manifest for packaged/local consumption
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/common/Tools/RandomNumberTools.fs Adds a sample MCP tool implementation (random number)
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/.template.config/template.json Defines F# template parameters, conditions, and conditional file operations
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/.template.config/ide.host.json Exposes key template parameters in IDE hosts
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-FSharp/.template.config/dotnetcli.host.json Configures CLI parameter names/visibility for the F# template
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/templates/McpServer-CSharp/.template.config/template.json Adds groupIdentity to align grouping with the F# template
src/ProjectTemplates/Microsoft.McpServer.ProjectTemplates/Microsoft.McpServer.ProjectTemplates.csproj Updates packaging to exclude .fsproj-in and transform them into .fsproj

Comment on lines +25 to +26
app.MapMcp() |> ignore
app.UseHttpsRedirection() |> ignore
Comment on lines +8 to +11
"SelfContained": {
"longName": "self-contained",
"shortName": ""
},
Comment on lines +22 to +24
"usageExamples": [
""
]
@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.Diagnostics.Testing Line 99 98.65 🔻
Microsoft.Extensions.Telemetry Line 93 91.95 🔻
Microsoft.Extensions.AI Line 89 88.49 🔻
Microsoft.Extensions.AI Branch 89 88.53 🔻
Microsoft.Extensions.AI.OpenAI Line 75 62.65 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 49.63 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.03 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 94.39 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 69.93 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 42.11 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 42.86 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 67.96 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 71.43 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 70 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 37.39 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 22.73 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Gen.BuildMetadata 97 100
Microsoft.Gen.MetadataExtractor 57 73
Microsoft.Gen.MetricsReports 67 69
Microsoft.Extensions.AI.Abstractions 82 85
Microsoft.Extensions.AI.Evaluation.NLP 0 78
Microsoft.Extensions.Caching.Hybrid 82 84
Microsoft.Extensions.DataIngestion 75 89
Microsoft.Extensions.DataIngestion.Markdig 75 90
Microsoft.Extensions.Http.Resilience 97 100

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1455212&view=codecoverage-tab

@jeffhandley jeffhandley self-assigned this Jun 9, 2026
@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.Diagnostics.Testing Line 99 98.65 🔻
Microsoft.Extensions.Telemetry Line 93 91.95 🔻
Microsoft.Extensions.AI Line 89 88.49 🔻
Microsoft.Extensions.AI Branch 89 88.53 🔻
Microsoft.Extensions.AI.OpenAI Line 75 62.65 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 49.63 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.03 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 94.39 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 68.32 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 42.11 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 42.86 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 68.42 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 71.43 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 70 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 37.39 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 22.73 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Gen.BuildMetadata 97 100
Microsoft.Gen.MetadataExtractor 57 73
Microsoft.Gen.MetricsReports 67 69
Microsoft.Extensions.AI.Abstractions 82 85
Microsoft.Extensions.AI.Evaluation.NLP 0 78
Microsoft.Extensions.Caching.Hybrid 82 84
Microsoft.Extensions.DataIngestion 75 89
Microsoft.Extensions.DataIngestion.Markdig 75 90
Microsoft.Extensions.Http.Resilience 97 100

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1457094&view=codecoverage-tab

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants