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
<PackageReference Include="GenHTTP.Modules.Mcp" Version="11.2.0" />
<PackageVersion Include="GenHTTP.Modules.Mcp" Version="11.2.0" />
<PackageReference Include="GenHTTP.Modules.Mcp" />
paket add GenHTTP.Modules.Mcp --version 11.2.0
#r "nuget: GenHTTP.Modules.Mcp, 11.2.0"
#:package GenHTTP.Modules.Mcp@11.2.0
#addin nuget:?package=GenHTTP.Modules.Mcp&version=11.2.0
#tool nuget:?package=GenHTTP.Modules.Mcp&version=11.2.0
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 | Versions 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. |
-
net10.0
- GenHTTP.Api (>= 11.2.0)
- GenHTTP.Modules.Reflection (>= 11.2.0)
-
net11.0
- GenHTTP.Api (>= 11.2.0)
- GenHTTP.Modules.Reflection (>= 11.2.0)
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 |