RSCG_MCP2File 9.2025.1208.1952
See the version list below for details.
dotnet add package RSCG_MCP2File --version 9.2025.1208.1952
NuGet\Install-Package RSCG_MCP2File -Version 9.2025.1208.1952
<PackageReference Include="RSCG_MCP2File" Version="9.2025.1208.1952" />
<PackageVersion Include="RSCG_MCP2File" Version="9.2025.1208.1952" />
<PackageReference Include="RSCG_MCP2File" />
paket add RSCG_MCP2File --version 9.2025.1208.1952
#r "nuget: RSCG_MCP2File, 9.2025.1208.1952"
#:package RSCG_MCP2File@9.2025.1208.1952
#addin nuget:?package=RSCG_MCP2File&version=9.2025.1208.1952
#tool nuget:?package=RSCG_MCP2File&version=9.2025.1208.1952
RSCG_MCP2File
RSCG_MCP2File is a .NET Standard 2.0 source generator that generates MCP (Microsoft Code Platform) tools that generates exports to file from each MCP function defined
Features
- Generates tool from another
Usage
Add RSCG_MCP2File as a NuGet package to your project.
Add the following attribute to your MCP function to generate a file export tool:
[MCP2File.AddMCPExportToFile]
[McpServerToolType]
public partial class WeatherTool
{
In the program.cs file, register the generated tool:
builder.Services.AddMcpServer()
.WithToolsFromAssembly()
How it works
For each function that returns a value, a corresponding tool will be generated that exports the result to a file. It assumes that the result is either a byte array, a string, or an object that can be converted to a string.
For example
[McpServerToolType]
[MCP2File.AddMCPExportToFile]
public partial class WeatherTool
{
[McpServerTool, Description("Returns the current weather for a specific city")]
public string MyGetWeatherForCity(string cityName)
{
it generates
[global::ModelContextProtocol.Server.McpServerTool]
[global::System.ComponentModel.Description("calls the MyGetWeatherForCity and saves the result to a file ")]
public async Task MyGetWeatherForCityExportToFile(string cityName, string exportToFile)
{
dynamic result = MyGetWeatherForCity(cityName);
if (result is byte[] bytes)
{
await File.WriteAllBytesAsync(exportToFile, bytes);
}
else if (result is string str)
{
await File.WriteAllTextAsync(exportToFile, str);
}
else
{
await File.WriteAllTextAsync(exportToFile, result?.ToString() ?? string.Empty);
}
}
License
This project is licensed under the MIT License.
Repository
For more information, visit the GitHub repository.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 5.0.0)
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 |
|---|---|---|
| 10.2025.1212.1953 | 268 | 12/12/2025 |
| 9.2025.1208.1952 | 476 | 12/8/2025 |
| 9.2025.1202.1952 | 744 | 12/2/2025 |
| 9.2025.1202.817 | 728 | 12/2/2025 |
| 9.2025.1202.800 | 1,085 | 12/2/2025 |
| 9.2025.1201.1800 | 643 | 12/1/2025 |
| 9.2025.1201.1726 | 636 | 12/1/2025 |