GenHTTP.Modules.Mcp 11.2.0

dotnet add package GenHTTP.Modules.Mcp --version 11.2.0
                    
NuGet\Install-Package GenHTTP.Modules.Mcp -Version 11.2.0
                    
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="GenHTTP.Modules.Mcp" Version="11.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GenHTTP.Modules.Mcp" Version="11.2.0" />
                    
Directory.Packages.props
<PackageReference Include="GenHTTP.Modules.Mcp" />
                    
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 GenHTTP.Modules.Mcp --version 11.2.0
                    
#r "nuget: GenHTTP.Modules.Mcp, 11.2.0"
                    
#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 GenHTTP.Modules.Mcp@11.2.0
                    
#: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=GenHTTP.Modules.Mcp&version=11.2.0
                    
Install as a Cake Addin
#tool nuget:?package=GenHTTP.Modules.Mcp&version=11.2.0
                    
Install as a Cake Tool

GenHTTP.Modules.Mcp

This framework allows to provide tools to AI agents such as Claude via the Model Context Protocol (MCP), in the same way webservices are provided with the webservice or controller frameworks.

var mcp = Tools.Create()
               .Server("library", "1.0.0")
               .Instructions("Search for books before lending them.")
               .Add<LibraryTools>()
               .Add("add", "Adds two numbers", [Tool(ReadOnly = true)] (int a, int b) => a + b);

await Host.Create()
          .Handler(Layout.Create().Add("mcp", mcp))
          .RunAsync();

public sealed class LibraryTools
{

    [Tool(ReadOnly = true)]
    [Summary("Searches the library for books")]
    public List<Book> FindBooks([Summary("Part of the title")] string query, [Range(1, 50)] int limit = 10) => ...;

    [Tool(Destructive = true)]
    [Summary("Removes all books from the library")]
    [RequireRole("admin")]
    public void Purge(IUser user) => ...;

}

The parameters of a tool become its arguments, except for values injected by the framework (such as the request or the authenticated user). Validation attributes such as [Range] are advertised in the schema and checked before the tool is invoked. Interceptors such as role checks run before the tool is invoked, and their documentation is added to the description of the tool.

With GenHTTP.Modules.DependencyInjection, tool classes are created per call with their dependencies resolved, and services can be injected into tool parameters:

var mcp = DependentTools.Create()
                        .Add<LibraryTools>();

The endpoint can then be added to Claude Code:

claude mcp add --transport http library http://localhost:8080/mcp

The endpoint implements the Streamable HTTP transport for both the stateless revision 2026-07-28 and the earlier revisions 2025-03-26 to 2025-11-25.

For details and examples, please refer to the documentation.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on GenHTTP.Modules.Mcp:

Package Downloads
GenHTTP.Modules.DependencyInjection

Enables dependency injection for all framework services.

GenHTTP.Full.Ioxide

Contains all modules of the GenHTTP framework suite, including the Ioxide server engine

GenHTTP.Full

Contains all modules of the GenHTTP framework suite, including the internal server engine

GenHTTP.Full.Kestrel

Contains all modules of the GenHTTP framework suite, including the Kestrel server engine

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.2.0 0 11/2/2026