Benevia.Core.MCP.Generator 0.9.16

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Benevia.Core.MCP.Generator --version 0.9.16
                    
NuGet\Install-Package Benevia.Core.MCP.Generator -Version 0.9.16
                    
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="Benevia.Core.MCP.Generator" Version="0.9.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Benevia.Core.MCP.Generator" Version="0.9.16" />
                    
Directory.Packages.props
<PackageReference Include="Benevia.Core.MCP.Generator" />
                    
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 Benevia.Core.MCP.Generator --version 0.9.16
                    
#r "nuget: Benevia.Core.MCP.Generator, 0.9.16"
                    
#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 Benevia.Core.MCP.Generator@0.9.16
                    
#: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=Benevia.Core.MCP.Generator&version=0.9.16
                    
Install as a Cake Addin
#tool nuget:?package=Benevia.Core.MCP.Generator&version=0.9.16
                    
Install as a Cake Tool

Benevia.Core.MCP.Generator

Introduction

Benevia.Core.MCP.Generator is a Roslyn source generator that produces MCP (Model Context Protocol) tools at compile time from entities marked with [McpEntity]. It works alongside Benevia.Core.MCP to provide the generated tool classes that the runtime library registers and serves.

This generator follows the same pattern as Benevia.Core.API.Generator and Benevia.Core.Events.Generator — it reads entity model attributes and produces source files during compilation.

What Gets Generated

For each [McpEntity] entity, the generator produces:

Output File Purpose
Tool class [Entity]Tools.g.cs Get, List, Create, Update, Delete methods
DTO class [Entity]Dto.g.cs Nullable property class for Create/Update (only if Create or Update is enabled)
Feature registration McpFeatureRegistration.g.cs Tool metadata for the registry
Feature enum Feature.g.cs Enum of feature groups
Entity type enum EntityType.g.cs Enum of exposed entities
Entity schemas EntitySchemas.g.cs JSON schemas for all entities
Meta-tools MetaTools.g.cs Dynamic toolset filtering
Schema resources SchemaResources.g.cs MCP resource endpoints

Feature Derivation

Features are derived from entity namespaces. The segment immediately after .Model. becomes the feature name:

Namespace Feature
MyApp.Model.Products Products
MyApp.Model.Products.Catalog Products
MyApp.Model.Sales Sales
MyApp.Model.Hatchery Hatchery

Setup

Add as an analyzer reference in your model project:

<PackageReference Include="Benevia.Core.MCP.Generator"
                  Version="$(BeneviaCoreMcpGeneratorVersion)"
                  OutputItemType="Analyzer"
                  ReferenceOutputAssembly="false" />

To inspect generated files, enable EmitCompilerGeneratedFiles in your model project:

<PropertyGroup>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

Generated files appear under obj/Generated/Benevia.Core.MCP.Generator/.

Dependencies

  • Benevia.Core.Generator — shared generator infrastructure (EntityResult, PropertyResult, attribute analysis)
  • Microsoft.CodeAnalysis.CSharp — Roslyn APIs for source generation

More Info

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
0.9.17-ci.140 0 5/14/2026
0.9.17-ci.139 0 5/14/2026
0.9.17-ci.138 0 5/14/2026
0.9.17-ci.137 25 5/14/2026
0.9.17-ci.136 30 5/13/2026
0.9.17-ci.135 35 5/13/2026
0.9.17-ci.134 33 5/12/2026
0.9.17-ci.133 46 5/11/2026
0.9.17-ci.132 41 5/11/2026
0.9.17-ci.131 42 5/11/2026
0.9.17-ci.130 48 5/11/2026
0.9.17-ci.129 43 5/10/2026
0.9.17-ci.128 50 5/9/2026
0.9.17-ci.127 43 5/9/2026
0.9.17-ci.126 48 5/8/2026
0.9.17-ci.125 47 5/7/2026
0.9.17-ci.124 45 5/7/2026
0.9.17-ci.123 44 5/6/2026
0.9.17-ci.122 42 5/6/2026
0.9.16 98 4/28/2026
Loading failed