RSCG_MCP2OpenAPI 9.2025.1208.1952

dotnet add package RSCG_MCP2OpenAPI --version 9.2025.1208.1952
                    
NuGet\Install-Package RSCG_MCP2OpenAPI -Version 9.2025.1208.1952
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RSCG_MCP2OpenAPI" Version="9.2025.1208.1952" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RSCG_MCP2OpenAPI" Version="9.2025.1208.1952" />
                    
Directory.Packages.props
<PackageReference Include="RSCG_MCP2OpenAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RSCG_MCP2OpenAPI --version 9.2025.1208.1952
                    
#r "nuget: RSCG_MCP2OpenAPI, 9.2025.1208.1952"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RSCG_MCP2OpenAPI@9.2025.1208.1952
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RSCG_MCP2OpenAPI&version=9.2025.1208.1952
                    
Install as a Cake Addin
#tool nuget:?package=RSCG_MCP2OpenAPI&version=9.2025.1208.1952
                    
Install as a Cake Tool

RSCG_MCP2OpenAPI

NuGet

RSCG_MCP2OpenAPI is a .NET Standard 2.0 source generator that , from MCP tools , generates SWAGGER / OPEN API

Features

  • Generates /api/mcp/{className}/{funcName} endpoint for any MCP tools

What it generates

For example, given the following MCP tool definition:

[McpServerToolType]
[MCP2OpenAPI.AddMCP2OpenApi]
public partial class WeatherTool
{
    [McpServerTool, Description("echoes the UTC date time in sortable format")]
    public string CurrentISODateTime()
    {
        return DateTime.UtcNow.ToString("s");
    }
    [McpServerTool, Description("echoes the string")]
    public string EchoBack(string theString)
    {
        return theString;
    }

The generator will produce the following endpoints:

internal static partial class WeatherTool_OpenAPI
{
    public static void AddAll_WeatherTool(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder){
Add_CurrentISODateTime(builder);
Add_EchoBack(builder);
Add_Add2Numbers(builder);
Add_MyGetWeatherForCity(builder);
    }



public static void Add_CurrentISODateTime (Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder){
    
        builder.MapPost("/api/mcp/WeatherTool/CurrentISODateTime",([Microsoft.AspNetCore.Mvc.FromServices]OA2MCP_TestMe.WeatherTool toolClass)=>
        toolClass.CurrentISODateTime()
        );

}




    public record rec_EchoBack ( string? theString );
    
public static void Add_EchoBack (Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder){
    
        builder.MapPost("/api/mcp/WeatherTool/EchoBack",([Microsoft.AspNetCore.Mvc.FromServices]OA2MCP_TestMe.WeatherTool toolClass,[Microsoft.AspNetCore.Mvc.FromBody]rec_EchoBack  value)=>
        toolClass.EchoBack(value.theString)
        );

}

How to use

Add RSCG_MCP2OpenAPI as a NuGet package to your project. The generator will automatically run at build time and generate the necessary swagger code from tool definition.

Add to your Program.cs or Startup.cs the following line to register the generated endpoints:

/// Add MCP Server tool as service
builder.Services.AddTransient<WeatherTool>();
//code
//app.MapGet("/", () => "todo");
//assuming your MCP tool class is named WeatherTool
app.AddAll_WeatherTool();

License

This project is licensed under the MIT License.

Repository

For more information, visit the GitHub repository.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.2025.1208.1952 420 12/8/2025
9.2025.1202.1952 139 12/6/2025