Benevia.Core.MCP.Generator
0.9.16
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
<PackageReference Include="Benevia.Core.MCP.Generator" Version="0.9.16" />
<PackageVersion Include="Benevia.Core.MCP.Generator" Version="0.9.16" />
<PackageReference Include="Benevia.Core.MCP.Generator" />
paket add Benevia.Core.MCP.Generator --version 0.9.16
#r "nuget: Benevia.Core.MCP.Generator, 0.9.16"
#:package Benevia.Core.MCP.Generator@0.9.16
#addin nuget:?package=Benevia.Core.MCP.Generator&version=0.9.16
#tool nuget:?package=Benevia.Core.MCP.Generator&version=0.9.16
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
- Benevia.Core.MCP — runtime library and usage guide
- Entity model documentation — how to define entities
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Benevia.Core.Generator (>= 0.9.16)
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 |