diff --git a/README.md b/README.md index 42c0391c1..7aaad1782 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# RSCG - 242 Examples of Roslyn Source Code Generators / 16 created by Microsoft / +# RSCG - 243 Examples of Roslyn Source Code Generators / 16 created by Microsoft / -The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 242 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. +The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 243 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem -## Latest Update : 2025-11-11 => 11 November 2025 +## Latest Update : 2025-11-15 => 15 November 2025 If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)*** @@ -24,11 +24,11 @@ If you want to be notified each time I add a new RSCG example , please click htt ## Content -Those are the 242 Roslyn Source Code Generators that I have tested you can see and download source code example. +Those are the 243 Roslyn Source Code Generators that I have tested you can see and download source code example. ( including 16 from Microsoft ) -### 242. [RSCG_MCP2File](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2File) , in the [MCP](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) category +### 243. [RSCG_MCP2File](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2File) , in the [MCP](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) category -Generated on : 2025-11-11 => 11 November 2025 +Generated on : 2025-11-15 => 15 November 2025
Expand @@ -48,9 +48,9 @@ Source: [https://github.com/ignatandrei/RSCG_OpenApi2MCP](https://github.com/ign
-### 241. [DecoratorGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator) , in the [Decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) category +### 242. [DecoratorGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator) , in the [Decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) category -Generated on : 2025-11-10 => 10 November 2025 +Generated on : 2025-11-13 => 13 November 2025
Expand @@ -72,6 +72,28 @@ Source: [https://github.com/CodingFlow/decorator-generator](https://github.com/C
+### 241. [RSCG_MCP2OpenAPI](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI) , in the [MCP](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) category + +Generated on : 2025-11-11 => 11 November 2025 + +
+ Expand + + + +Author: Ignat Andrei + +Generating Swagger/OpenAPI function from MCP tool. + +Nuget: [https://www.nuget.org/packages/RSCG_MCP2OpenAPI/](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) + + +Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI) + +Source: [https://github.com/ignatandrei/RSCG_OpenApi2MCP](https://github.com/ignatandrei/RSCG_OpenApi2MCP) + +
+ ### 240. [XmlCommentGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/XmlCommentGenerator) , in the [API](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) category Generated on : 2025-11-09 => 09 November 2025 diff --git a/later.md b/later.md index 3961d45dd..ff94976d0 100644 --- a/later.md +++ b/later.md @@ -1,6 +1,6 @@ # Just later -## Latest Update : 2025-11-11 => 11 November 2025 +## Latest Update : 2025-11-15 => 15 November 2025 diff --git a/v2/.tours/RSCG_MCP2OpenAPI.tour b/v2/.tours/RSCG_MCP2OpenAPI.tour new file mode 100644 index 000000000..f624389a8 --- /dev/null +++ b/v2/.tours/RSCG_MCP2OpenAPI.tour @@ -0,0 +1,48 @@ + +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "RSCG_MCP2OpenAPI", + "steps": + [ + { + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MCPDemo.csproj", + "description": "First, we add Nuget [RSCG_MCP2OpenAPI](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) in csproj ", + "pattern": "RSCG_MCP2OpenAPI" + } + + ,{ + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MyTools.cs", + "description": "File MyTools.cs ", + "pattern": "this is the code" + } + + ,{ + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/Program.cs", + "description": "File Program.cs \r\n>> dotnet run --project rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MCPDemo.csproj ", + "pattern": "this is the code" + } + + + ,{ + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/obj/GX/RSCG_MCP2OpenAPI/RSCG_MCP2OpenAPI.MCP2OpenAPI/MyTools_ExportToFile.g.cs", + "description": "Generated File 3 from 3 : MyTools_ExportToFile.g.cs ", + "line": 1 + } + + ,{ + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/obj/GX/RSCG_MCP2OpenAPI/RSCG_MCP2OpenAPI.MCP2OpenAPI/Microsoft.CodeAnalysis.EmbeddedAttribute.cs", + "description": "Generated File 2 from 3 : Microsoft.CodeAnalysis.EmbeddedAttribute.cs ", + "line": 1 + } + + ,{ + "file": "rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/obj/GX/RSCG_MCP2OpenAPI/RSCG_MCP2OpenAPI.MCP2OpenAPI/MCP2OpenAPI.g.cs", + "description": "Generated File 1 from 3 : MCP2OpenAPI.g.cs ", + "line": 1 + } + + ], + + "ref": "main" + +} \ No newline at end of file diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv index dad70405a..29af49084 100644 --- a/v2/Generator/all.csv +++ b/v2/Generator/all.csv @@ -239,5 +239,6 @@ Nr,Key,Source,Category 238,TeCLI, https://github.com/tyevco/TeCLI,CommandLine 239,TUnit, https://github.com/thomhurst/TUnit,Tests 240,XmlCommentGenerator, https://github.com/dotnet/dotnet/,API -241,DecoratorGenerator, https://github.com/CodingFlow/decorator-generator,Decorator -242,RSCG_MCP2File, https://github.com/ignatandrei/RSCG_OpenApi2MCP,MCP +241,RSCG_MCP2OpenAPI, https://github.com/ignatandrei/RSCG_OpenApi2MCP,MCP +242,DecoratorGenerator, https://github.com/CodingFlow/decorator-generator,Decorator +243,RSCG_MCP2File, https://github.com/ignatandrei/RSCG_OpenApi2MCP,MCP diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json index 4adac0a6e..af9e8da14 100644 --- a/v2/RSCGExamplesData/GeneratorDataRec.json +++ b/v2/RSCGExamplesData/GeneratorDataRec.json @@ -1454,16 +1454,23 @@ "dtStart": "2025-11-09T00:00:00", "show": true }, +{ + "ID":"RSCG_MCP2OpenAPI", + "Category": 42, + "dtStart": "2025-11-11T00:00:00", + "show": true +}, + { "ID":"DecoratorGenerator", "Category":41, - "dtStart": "2025-11-10T00:00:00", + "dtStart": "2025-11-13T00:00:00", "show": true }, { "ID":"RSCG_MCP2File", "Category": 42, - "dtStart": "2025-11-11T00:00:00", + "dtStart": "2025-11-15T00:00:00", "show": true } ] \ No newline at end of file diff --git a/v2/book/examples/DecoratorGenerator.html b/v2/book/examples/DecoratorGenerator.html index 5d791d843..082612f5d 100644 --- a/v2/book/examples/DecoratorGenerator.html +++ b/v2/book/examples/DecoratorGenerator.html @@ -1,5 +1,5 @@ -

RSCG nr 241 : DecoratorGenerator

+

RSCG nr 242 : DecoratorGenerator

Info

Nuget : https://www.nuget.org/packages/DecoratorGenerator/ diff --git a/v2/book/examples/RSCG_MCP2File.html b/v2/book/examples/RSCG_MCP2File.html index 04ee610e3..7086ed3c7 100644 --- a/v2/book/examples/RSCG_MCP2File.html +++ b/v2/book/examples/RSCG_MCP2File.html @@ -1,5 +1,5 @@ -

RSCG nr 242 : RSCG_MCP2File

+

RSCG nr 243 : RSCG_MCP2File

Info

Nuget : https://www.nuget.org/packages/RSCG_MCP2File/ diff --git a/v2/book/examples/RSCG_MCP2OpenAPI.html b/v2/book/examples/RSCG_MCP2OpenAPI.html new file mode 100644 index 000000000..43157ea28 --- /dev/null +++ b/v2/book/examples/RSCG_MCP2OpenAPI.html @@ -0,0 +1,69 @@ + +

RSCG nr 241 : RSCG_MCP2OpenAPI

+ +

Info

+Nuget : https://www.nuget.org/packages/RSCG_MCP2OpenAPI/ + +

You can find more details at : https://github.com/ignatandrei/RSCG_OpenApi2MCP

+ +

Author :Ignat Andrei

+ +

Source: https://github.com/ignatandrei/RSCG_OpenApi2MCP

+ +

About

+ +Generating OpenAPI based on MCP source code. + +

+ How to use +

+

+ Add reference to the RSCG_MCP2OpenAPI in the csproj +

+ + +

This was for me the starting code

+ +
+ I have coded the file Program.cs +
+ +
+ +
+ I have coded the file MyTools.cs +
+ +
+

And here are the generated files

+ +
+ The file generated is MCP2OpenAPI.g.cs +
+ + +
+ The file generated is Microsoft.CodeAnalysis.EmbeddedAttribute.cs +
+ + +
+ The file generated is MyTools_ExportToFile.g.cs +
+ + +

+ You can download the code and this page as pdf from + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI + +

+ + +

+ You can see the whole list at + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG + +

+ diff --git a/v2/book/list.html b/v2/book/list.html index 7fa1bc641..1b0c4ac07 100644 --- a/v2/book/list.html +++ b/v2/book/list.html @@ -17,7 +17,7 @@

-This is the list of 242 RSCG with examples => +This is the list of 243 RSCG with examples =>

@@ -988,10 +988,14 @@

- + + + + +
241DecoratorGeneratorRSCG_MCP2OpenAPI
242DecoratorGenerator
243 RSCG_MCP2File
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml index 380c53c87..0b512639c 100644 --- a/v2/book/pandocHTML.yaml +++ b/v2/book/pandocHTML.yaml @@ -254,6 +254,7 @@ input-files: - examples/TeCLI.html - examples/TUnit.html - examples/XmlCommentGenerator.html +- examples/RSCG_MCP2OpenAPI.html - examples/DecoratorGenerator.html - examples/RSCG_MCP2File.html diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/description.json b/v2/rscg_examples/RSCG_MCP2OpenAPI/description.json new file mode 100644 index 000000000..86dc75ebd --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/description.json @@ -0,0 +1,24 @@ +{ + "generator":{ + "name":"RSCG_MCP2OpenAPI", + "nuget":[ + "https://www.nuget.org/packages/RSCG_MCP2OpenAPI/" + ], + "link":"https://github.com/ignatandrei/RSCG_OpenApi2MCP", + "author":"Ignat Andrei", + "source":"https://github.com/ignatandrei/RSCG_OpenApi2MCP" + }, + "data":{ + "goodFor":["Generating OpenAPI based on MCP source code."], + "csprojDemo":"MCPDemo.csproj", + "csFiles":["Program.cs","MyTools.cs"], + "excludeDirectoryGenerated":[ + "Microsoft.AspNetCore.OpenApi.SourceGenerators", + "Microsoft.AspNetCore.App.SourceGenerators"], + "includeAdditionalFiles":[""] + }, + "links":{ + "blog":"", + "video":"" + } +} \ No newline at end of file diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/nuget.txt b/v2/rscg_examples/RSCG_MCP2OpenAPI/nuget.txt new file mode 100644 index 000000000..7e8c58d0c --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/nuget.txt @@ -0,0 +1 @@ +Generating Swagger/OpenAPI function from MCP tool. \ No newline at end of file diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/readme.txt b/v2/rscg_examples/RSCG_MCP2OpenAPI/readme.txt new file mode 100644 index 000000000..4dc852ea8 --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/readme.txt @@ -0,0 +1 @@ +This is a place holder diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo.slnx b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo.slnx new file mode 100644 index 000000000..2b096d4a6 --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo.slnx @@ -0,0 +1,3 @@ + + + diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MCPDemo.csproj b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MCPDemo.csproj new file mode 100644 index 000000000..6b41d87e5 --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MCPDemo.csproj @@ -0,0 +1,24 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + + + + + + true + $(BaseIntermediateOutputPath)\GX + + diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MyTools.cs b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MyTools.cs new file mode 100644 index 000000000..520cef281 --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/MyTools.cs @@ -0,0 +1,19 @@ +using ModelContextProtocol.Server; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace MCPDemo; +[MCP2OpenAPI.AddMCP2OpenApi()] +partial class MyTools +{ + [McpServerTool] + [Description("Echo demo")] + public async Task SendEcho([Description("echo")] string echoData) + { + await Task.Delay(10); + return echoData; + } + +} diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/Program.cs b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/Program.cs new file mode 100644 index 000000000..e49b3d0ca --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/src/MCPDemo/Program.cs @@ -0,0 +1,42 @@ +// See https://aka.ms/new-console-template for more information +global using Microsoft.AspNetCore.Builder; +using MCPDemo; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using OpenAPISwaggerUI; + + +Console.WriteLine("Hello, World!"); +var builderApp = Host.CreateApplicationBuilder(args); + +var builderWeb = WebApplication.CreateBuilder(); + +// Configure all logs to go to stderr (stdout is used for the MCP protocol messages). +//builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace); + +var serverApp = builderApp.Services + .AddMcpServer(); +serverApp = serverApp.WithStdioServerTransport(); +serverApp.WithTools(); + + +var serverWeb = builderWeb.Services.AddMcpServer(); +serverWeb = serverWeb.WithHttpTransport(); +serverWeb.WithTools(); + + +builderWeb.Services.AddOpenApi(); +builderWeb.Services.AddTransient(); + +var app = builderApp.Build(); +var web = builderWeb.Build(); + web.MapOpenApi(); + web.MapOpenApi("/openapi/{documentName}.yaml"); + web.MapMcp(); + web.UseOpenAPISwaggerUI(); +web.AddAll_MyTools(); + +var t1 = web.RunAsync(); +var t2 = app.RunAsync(); + +await Task.WhenAll(t1, t2); diff --git a/v2/rscg_examples/RSCG_MCP2OpenAPI/video.json b/v2/rscg_examples/RSCG_MCP2OpenAPI/video.json new file mode 100644 index 000000000..f01bd6470 --- /dev/null +++ b/v2/rscg_examples/RSCG_MCP2OpenAPI/video.json @@ -0,0 +1,39 @@ +{ + "scriptName": "RSCG_MCP2OpenAPI", + "steps": +[ + {"typeStep":"exec","arg":"clipchamp.exe launch"}, + {"typeStep":"text","arg": "Welcome to Roslyn Examples"}, + {"typeStep":"text","arg":"If you want to see more examples , see List Of RSCG"}, + {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG"}, + {"typeStep":"text","arg": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. "}, + +{"typeStep":"text","arg": "Today I will present RSCG_MCP2OpenAPI . Generating OpenAPI based on MCP source code. ."}, +{"typeStep":"browser","arg":"https://www.nuget.org/packages/RSCG_MCP2OpenAPI/"}, +{"typeStep":"text","arg": "The whole example is here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI"}, +{"typeStep":"text","arg": "You can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI#download-example-net--c-"}, +{"typeStep":"text","arg":"Here is the code downloaded "}, +{"typeStep":"exec","arg":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\Generator.sln"}, +{"typeStep":"text","arg": "So , let's start the project with Visual Studio Code "}, +{"typeStep":"stepvscode","arg": "-n D:\\gth\\RSCG_Examples\\v2"}, + +{"typeStep":"text","arg": "To use it ,you will put the Nuget RSCG_MCP2OpenAPI into the csproj "}, + +{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\RSCG_MCP2OpenAPI\\src\\MCPDemo\\MCPDemo.csproj"}, + +{"typeStep":"text","arg": "And now I will show you an example of using RSCG_MCP2OpenAPI"}, + +{"typeStep":"hide","arg": "now execute the tour in VSCode"}, +{"typeStep":"tour", "arg": "src/.tours/"}, +{"typeStep":"text","arg":" And I will execute the project"}, +{"typeStep":"showproj", "arg":"MCPDemo.csproj"}, +{"typeStep":"text","arg":" This concludes the project"}, +{"typeStep":"waitseconds","arg":"30"}, +{"typeStep":"text","arg": "Remember, you can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI#download-example-net--c-", +SpeakTest=" "}, +{"typeStep":"waitseconds","arg":"30"}, +] +} diff --git a/v2/rscg_examples_site/docs/Authors/Ignat_Andrei.md b/v2/rscg_examples_site/docs/Authors/Ignat_Andrei.md index f85bb141f..ee2ac21c9 100644 --- a/v2/rscg_examples_site/docs/Authors/Ignat_Andrei.md +++ b/v2/rscg_examples_site/docs/Authors/Ignat_Andrei.md @@ -1,6 +1,6 @@ # Author : Ignat Andrei -Number RSCG: 22 +Number RSCG: 23 1 [RSCG_TimeBombComment](/docs/RSCG_TimeBombComment) [![Nuget](https://img.shields.io/nuget/dt/RSCG_TimeBombComment?label=RSCG_TimeBombComment)](https://www.nuget.org/packages/RSCG_TimeBombComment/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_TimeBombComment?style=social) 2023-04-16 @@ -45,5 +45,7 @@ Number RSCG: 22 21 [rscg_demeter](/docs/rscg_demeter) [![Nuget](https://img.shields.io/nuget/dt/rscg_demeter?label=rscg_demeter)](https://www.nuget.org/packages/rscg_demeter/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/rscg_demeter?style=social) 2025-03-26 - 22 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 + 22 [RSCG_MCP2OpenAPI](/docs/RSCG_MCP2OpenAPI) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2OpenAPI?label=RSCG_MCP2OpenAPI)](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 + + 23 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-15 diff --git a/v2/rscg_examples_site/docs/Authors/Leopoldo_Fu.md b/v2/rscg_examples_site/docs/Authors/Leopoldo_Fu.md index 66259c48a..3231e90f2 100644 --- a/v2/rscg_examples_site/docs/Authors/Leopoldo_Fu.md +++ b/v2/rscg_examples_site/docs/Authors/Leopoldo_Fu.md @@ -3,5 +3,5 @@ Number RSCG: 1 - 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-10 + 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-13 diff --git a/v2/rscg_examples_site/docs/Categories/Decorator.md b/v2/rscg_examples_site/docs/Categories/Decorator.md index b4c652c2d..afb78a81d 100644 --- a/v2/rscg_examples_site/docs/Categories/Decorator.md +++ b/v2/rscg_examples_site/docs/Categories/Decorator.md @@ -2,5 +2,5 @@ Number RSCG: 1 - 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-10 + 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-13 \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/MCP.md b/v2/rscg_examples_site/docs/Categories/MCP.md index a06007b74..00cc577f6 100644 --- a/v2/rscg_examples_site/docs/Categories/MCP.md +++ b/v2/rscg_examples_site/docs/Categories/MCP.md @@ -1,6 +1,8 @@

MCP

-Number RSCG: 1 +Number RSCG: 2 - 1 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 + 1 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-15 + + 2 [RSCG_MCP2OpenAPI](/docs/RSCG_MCP2OpenAPI) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2OpenAPI?label=RSCG_MCP2OpenAPI)](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx index 3f0ae5f26..725e671a9 100644 --- a/v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx @@ -1,6 +1,6 @@ ### Category "Decorator" has the following generators: - 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-10 + 1 [DecoratorGenerator](/docs/DecoratorGenerator) [![Nuget](https://img.shields.io/nuget/dt/DecoratorGenerator?label=DecoratorGenerator)](https://www.nuget.org/packages/DecoratorGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/CodingFlow/decorator-generator?style=social) 2025-11-13 ### See category diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveMCP.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveMCP.mdx index fd6293cc8..f90fb5938 100644 --- a/v2/rscg_examples_site/docs/Categories/_PrimitiveMCP.mdx +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveMCP.mdx @@ -1,6 +1,8 @@ ### Category "MCP" has the following generators: - 1 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 + 1 [RSCG_MCP2File](/docs/RSCG_MCP2File) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2File?label=RSCG_MCP2File)](https://www.nuget.org/packages/RSCG_MCP2File/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-15 + + 2 [RSCG_MCP2OpenAPI](/docs/RSCG_MCP2OpenAPI) [![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2OpenAPI?label=RSCG_MCP2OpenAPI)](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) ![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) 2025-11-11 ### See category diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md b/v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md index 52452104e..27b3431f2 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md @@ -1,6 +1,6 @@ --- -sidebar_position: 2410 -title: 241 - DecoratorGenerator +sidebar_position: 2420 +title: 242 - DecoratorGenerator description: adding decorator for classes/ interfaces slug: /DecoratorGenerator --- diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2File.md b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2File.md index f2b47bdba..a67f4ecff 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2File.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2File.md @@ -1,6 +1,6 @@ --- -sidebar_position: 2420 -title: 242 - RSCG_MCP2File +sidebar_position: 2430 +title: 243 - RSCG_MCP2File description: Generating code for saving MCP result to file. slug: /RSCG_MCP2File --- diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2OpenAPI.md b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2OpenAPI.md new file mode 100644 index 000000000..1735b64df --- /dev/null +++ b/v2/rscg_examples_site/docs/RSCG-Examples/RSCG_MCP2OpenAPI.md @@ -0,0 +1,275 @@ +--- +sidebar_position: 2410 +title: 241 - RSCG_MCP2OpenAPI +description: Generating OpenAPI based on MCP source code. +slug: /RSCG_MCP2OpenAPI +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; +import SameCategory from '../Categories/_PrimitiveMCP.mdx'; + +# RSCG_MCP2OpenAPI by Ignat Andrei + + + + +## NuGet / site data +[![Nuget](https://img.shields.io/nuget/dt/RSCG_MCP2OpenAPI?label=RSCG_MCP2OpenAPI)](https://www.nuget.org/packages/RSCG_MCP2OpenAPI/) +[![GitHub last commit](https://img.shields.io/github/last-commit/ignatandrei/RSCG_OpenApi2MCP?label=updated)](https://github.com/ignatandrei/RSCG_OpenApi2MCP) +![GitHub Repo stars](https://img.shields.io/github/stars/ignatandrei/RSCG_OpenApi2MCP?style=social) + +## Details + +### Info +:::info + +Name: **RSCG_MCP2OpenAPI** + +Generating Swagger/OpenAPI function from MCP tool. + +Author: Ignat Andrei + +NuGet: +*https://www.nuget.org/packages/RSCG_MCP2OpenAPI/* + + +You can find more details at https://github.com/ignatandrei/RSCG_OpenApi2MCP + +Source: https://github.com/ignatandrei/RSCG_OpenApi2MCP + +::: + +### Author +:::note +Ignat Andrei +![Alt text](https://github.com/ignatandrei.png) +::: + +### Original Readme +:::note + +This is a place holder + + +::: + +### About +:::note + +Generating OpenAPI based on MCP source code. + + +::: + +## How to use + +### Example (source csproj, source files) + + + + + +This is the CSharp Project that references **RSCG_MCP2OpenAPI** +```xml showLineNumbers {15} + + + + Exe + net10.0 + enable + enable + + + + + + + + + + + + + + true + $(BaseIntermediateOutputPath)\GX + + + +``` + + + + + + This is the use of **RSCG_MCP2OpenAPI** in *Program.cs* + +```csharp showLineNumbers +// See https://aka.ms/new-console-template for more information +global using Microsoft.AspNetCore.Builder; +using MCPDemo; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using OpenAPISwaggerUI; + + +Console.WriteLine("Hello, World!"); +var builderApp = Host.CreateApplicationBuilder(args); + +var builderWeb = WebApplication.CreateBuilder(); + +// Configure all logs to go to stderr (stdout is used for the MCP protocol messages). +//builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace); + +var serverApp = builderApp.Services + .AddMcpServer(); +serverApp = serverApp.WithStdioServerTransport(); +serverApp.WithTools(); + + +var serverWeb = builderWeb.Services.AddMcpServer(); +serverWeb = serverWeb.WithHttpTransport(); +serverWeb.WithTools(); + + +builderWeb.Services.AddOpenApi(); +builderWeb.Services.AddTransient(); + +var app = builderApp.Build(); +var web = builderWeb.Build(); + web.MapOpenApi(); + web.MapOpenApi("/openapi/{documentName}.yaml"); + web.MapMcp(); + web.UseOpenAPISwaggerUI(); +web.AddAll_MyTools(); + +var t1 = web.RunAsync(); +var t2 = app.RunAsync(); + +await Task.WhenAll(t1, t2); + +``` + + + + + This is the use of **RSCG_MCP2OpenAPI** in *MyTools.cs* + +```csharp showLineNumbers +using ModelContextProtocol.Server; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace MCPDemo; +[MCP2OpenAPI.AddMCP2OpenApi()] +partial class MyTools +{ + [McpServerTool] + [Description("Echo demo")] + public async Task SendEcho([Description("echo")] string echoData) + { + await Task.Delay(10); + return echoData; + } + +} + +``` + + + + +### Generated Files + +Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers + + namespace MCP2OpenAPI + { + [global::Microsoft.CodeAnalysis.EmbeddedAttribute] + [global::System.AttributeUsage(global::System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + internal class AddMCP2OpenApi: global::System.Attribute {} + } +``` + + + + +```csharp showLineNumbers +// +namespace Microsoft.CodeAnalysis +{ + internal sealed partial class EmbeddedAttribute : global::System.Attribute + { + } +} +``` + + + + +```csharp showLineNumbers + +namespace MCPDemo; + + +///Number methods : 1 +internal static partial class MyTools_OpenAPI +{ + public static void AddAll_MyTools(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder){ +Add_SendEcho(builder); + } + + + + public record rec_SendEcho ( string? echoData ); + +public static void Add_SendEcho (Microsoft.AspNetCore.Routing.IEndpointRouteBuilder builder){ + + builder.MapPost("/api/mcp/MyTools/SendEcho",([Microsoft.AspNetCore.Mvc.FromServices]MCPDemo.MyTools toolClass,[Microsoft.AspNetCore.Mvc.FromBody]rec_SendEcho value)=> + toolClass.SendEcho(value.echoData) + ); + +} + + + +} + + +``` + + + + +## Useful + +### Download Example (.NET C#) + +:::tip + +[Download Example project RSCG_MCP2OpenAPI ](/sources/RSCG_MCP2OpenAPI.zip) + +::: + + +### Share RSCG_MCP2OpenAPI + + + +https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI + + + diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md index 308ed8444..5f156c418 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/index.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/index.md @@ -1,7 +1,7 @@ --- sidebar_position: 30 -title: 242 RSCG list by category -description: 242 RSCG list by category +title: 243 RSCG list by category +description: 243 RSCG list by category slug: /rscg-examples --- @@ -1152,7 +1152,12 @@ import DocCardList from '@theme/DocCardList'; ## MCP
- Expand MCP =>examples:1 + Expand MCP =>examples:2 + + + +[RSCG_MCP2OpenAPI](/docs/RSCG_MCP2OpenAPI) + @@ -1899,6 +1904,8 @@ flowchart LR; Mapper--> Facet((Facet)) + MCP--> RSCG_MCP2OpenAPI((RSCG_MCP2OpenAPI)) + MCP--> RSCG_MCP2File((RSCG_MCP2File)) Mediator--> Mediator((Mediator)) diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md index 44a353fc3..4fb4d3c8f 100644 --- a/v2/rscg_examples_site/docs/about.md +++ b/v2/rscg_examples_site/docs/about.md @@ -6,7 +6,7 @@ title: About ## Content You will find here code examples -of 242 Roslyn Source Code Generator (RSCG) +of 243 Roslyn Source Code Generator (RSCG) that can be useful for you. That means, you will write more elegant and concise code - even if the generators code is not always nice to look. ## Are those examples ready for production? diff --git a/v2/rscg_examples_site/docs/indexRSCG.md b/v2/rscg_examples_site/docs/indexRSCG.md index 4ff2ce14b..2ed4dbf19 100644 --- a/v2/rscg_examples_site/docs/indexRSCG.md +++ b/v2/rscg_examples_site/docs/indexRSCG.md @@ -7,9 +7,9 @@ slug: /List-of-RSCG import useBaseUrl from '@docusaurus/useBaseUrl'; -## 242 RSCG with examples in descending chronological order +## 243 RSCG with examples in descending chronological order -This is the list of 242 ( 16 from Microsoft) RSCG with examples +This is the list of 243 ( 16 from Microsoft) RSCG with examples [See by category](/docs/rscg-examples) [See as json](/exports/RSCG.json) [See as Excel](/exports/RSCG.xlsx) @@ -20,8 +20,9 @@ This is the list of 242 ( 16 from Microsoft) RSCG with examples | No | Name | Date | Category | | --------- | ----- | ---- | -------- | -|242| [RSCG_MCP2File by Ignat Andrei ](/docs/RSCG_MCP2File)|2025-11-11 => 11 November 2025 | [MCP](/docs/Categories/MCP) | -|241| [DecoratorGenerator by Leopoldo Fu ](/docs/DecoratorGenerator)|2025-11-10 => 10 November 2025 | [Decorator](/docs/Categories/Decorator) | +|243| [RSCG_MCP2File by Ignat Andrei ](/docs/RSCG_MCP2File)|2025-11-15 => 15 November 2025 | [MCP](/docs/Categories/MCP) | +|242| [DecoratorGenerator by Leopoldo Fu ](/docs/DecoratorGenerator)|2025-11-13 => 13 November 2025 | [Decorator](/docs/Categories/Decorator) | +|241| [RSCG_MCP2OpenAPI by Ignat Andrei ](/docs/RSCG_MCP2OpenAPI)|2025-11-11 => 11 November 2025 | [MCP](/docs/Categories/MCP) | |240| [XmlCommentGenerator by Microsoft ](/docs/XmlCommentGenerator)|2025-11-09 => 09 November 2025 | [API](/docs/Categories/API) | |239| [TUnit by Tom Longhurst ](/docs/TUnit)|2025-11-08 => 08 November 2025 | [Tests](/docs/Categories/Tests) | |238| [TeCLI by Tyler Coles ](/docs/TeCLI)|2025-11-07 => 07 November 2025 | [CommandLine](/docs/Categories/CommandLine) | diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js index f68f12c8f..3f8111cf3 100644 --- a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js +++ b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js @@ -4,7 +4,7 @@ import styles from './styles.module.css'; const FeatureList = [ { -title: '242 Examples (16 from MSFT)', +title: '243 Examples (16 from MSFT)', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> diff --git a/v2/rscg_examples_site/static/exports/RSCG.json b/v2/rscg_examples_site/static/exports/RSCG.json index b1771bd6d..9618ddef6 100644 --- a/v2/rscg_examples_site/static/exports/RSCG.json +++ b/v2/rscg_examples_site/static/exports/RSCG.json @@ -1922,13 +1922,21 @@ "Category": "API", "AddedOn": "2025-11-09T00:00:00" }, + { + "Name": "RSCG_MCP2OpenAPI", + "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2OpenAPI", + "NuGet": "https://www.nuget.org/packages/RSCG_MCP2OpenAPI/", + "Source": "https://github.com/ignatandrei/RSCG_OpenApi2MCP", + "Category": "MCP", + "AddedOn": "2025-11-11T00:00:00" + }, { "Name": "DecoratorGenerator", "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator", "NuGet": "https://www.nuget.org/packages/DecoratorGenerator/", "Source": "https://github.com/CodingFlow/decorator-generator", "Category": "Decorator", - "AddedOn": "2025-11-10T00:00:00" + "AddedOn": "2025-11-13T00:00:00" }, { "Name": "RSCG_MCP2File", @@ -1936,7 +1944,7 @@ "NuGet": "https://www.nuget.org/packages/RSCG_MCP2File/", "Source": "https://github.com/ignatandrei/RSCG_OpenApi2MCP", "Category": "MCP", - "AddedOn": "2025-11-11T00:00:00" + "AddedOn": "2025-11-15T00:00:00" } ] } \ No newline at end of file diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx index 107bdc030..860db58dd 100644 Binary files a/v2/rscg_examples_site/static/exports/RSCG.xlsx and b/v2/rscg_examples_site/static/exports/RSCG.xlsx differ diff --git a/v2/rscg_examples_site/static/sources/RSCG_MCP2OpenAPI.zip b/v2/rscg_examples_site/static/sources/RSCG_MCP2OpenAPI.zip new file mode 100644 index 000000000..91a8cdfcd Binary files /dev/null and b/v2/rscg_examples_site/static/sources/RSCG_MCP2OpenAPI.zip differ