McpEndpointsTools 1.0.12-alpha

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

Static Badge Static Badge

MCP Endpoints Tools

Library for ASP.NET Core Web API, which automatically turns each controller method into a tool for the MCP server.

Under the hood, MCP Endpoints Tools uses the Model Context Protocol C# SDK for working with tools.

This project is in alpha version! Various errors are possible. Please write to the issue for errors and suggestions on library expansion.

Description

MCP Endpoints Tools scans the application build, finds all controllers and their public methods marked with HTTP attributes, and registers them as Model Context Protocol (MCP) tools. In this case, XML comments from the assembly are used to fill in the description (summary) of the tools.

Features

  • Automatic registration of all controller methods as MCP tools and resources
  • Support for method exclusion via the [McpIgnore] attribute
  • Automatic addition of the tool description from the XML comments of the assembly via the 'XmlCommentsProvider`
  • Flexible configuration via ServerOptions (path, name, description, version, XML path)
  • Easy integration into 'IServiceCollectionandIEndpointRouteBuilder' via extensions ServiceCollectionExtensions and EndpointRouteBuilderExtensions

Installation

  1. Add the McpEndpointsTools project to your solution or connect via NuGet (if there is a package):

    dotnet add package McpEndpointsTools --version 1.0.12-alpha
    
  2. In the file Program.cs (or Startup.cs), register the services and mapping:

      using McpEndpointsServer.Extensions;
    
      var builder = WebApplication.CreateBuilder(args);
    
      // MCP Server registration and controller scanning
      builder.Services.AddMcpEndpointsServer(opts =>
      {
             opts.PipelineEndpoint = "/mcp"; // path for the HTTP pipeline
             opts.ServerName = "My MCP Server"; // server name
             opts.ServerDescription = "API for MCP"; // description
             opts.ServerVersion = "1.2.3"; // version
             opts.XmlCommentsPath = "MyApp.xml "; // path to the XML documentation file
             opts.HostUrl = "https://api.mysite "; // base URL
      });
    
  3. Enable XML documentation generation in your .csproj project file:

    <PropertyGroup>
      <GenerateDocumentationFile>true</GenerateDocumentationFile>
      <NoWarn>$(NoWarn);1591</NoWarn>
    </PropertyGroup>
    
  4. Set up routing in the same or another location:

    var app = builder.Build();
    
    app.MapControllers(); // regular controllers
    app.MapMcpEndpointsServer(); // MCP endpoints (HTTP stream & SSE)
    
    app.Run();
    

    Follow the registration procedure

Attributes

  • McpIgnoreAttribute It is placed above the controller method to exclude it from the list of generated MCP tools.
  • Authorize Methods and controllers marked with the Authorize attribute will not be added to the tools. In future versions, support for authentication authorization may be added.

Here is an example of an attribute over a controller method

    /// <summary>
    /// Provides clothing advice based on the current temperature in Celsius.
    /// </summary>
    /// <param name="tempC">The temperature in Celsius for which clothing advice is needed.</param>
    /// <returns>
    /// A string containing clothing advice suitable for the specified temperature.
    /// </returns>
    [HttpGet("GetClothingAdvice")]
    [McpIgnore]
    public IActionResult GetClothingAdvice([FromQuery] double tempC)
    {
        if (tempC >= 25) return Ok("Put on a T-shirt and shorts.");
        if (tempC >= 15) return Ok("A light jacket will do.");
        if (tempC >= 5) return Ok("I need a coat.");
        return Ok("It's very cold — keep warm!");
    }

If you mark the entire controller with this attribute, all controller methods will be ignored by the MCP server.

Example app

See the sample application on ASP .NET Core is available via the link

Example config for IDEs

VS Code global
{
    "workbench.startupEditor": "none",
    "explorer.confirmDelete": false,
    "mcp": {
        "servers": {
            "test-mcp": {
                "url": "http://localhost:5220/mcp"
            },
            "API-helper": {
                "url": "https://api.il2-expert.ru/mcp"
            }
        }
    },
    "explorer.confirmDragAndDrop": false,
    "chat.editing.confirmEditRequestRetry": false
}
Cursor global
{
    "mcpServers": {
        "my-mcp-server": {
            "url": "http://localhost:5258/mcp",
            "type": "http"
        }
    }
}
Live demo

License

MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in 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
1.0.12-alpha 114 5/18/2025
1.0.10-alpha 79 5/17/2025
1.0.8-alpha 78 5/17/2025
1.0.6-alpha 94 5/17/2025
1.0.4-alpha 190 5/15/2025
1.0.0-alpha 191 5/13/2025

Add core structure and functionalities for MCP Endpoints Tools
Introduced the initial implementation of the MCP Endpoints Tools project, including foundational classes for server options, XML documentation handling, operation registration, and hosting setup. Added support for extension methods, dependency injection, and endpoint routing to facilitate server configuration and behavior. Included project structure, solution setup, and necessary `.gitignore` entries.