Table of Contents

Class McpServerController

Namespace
nanoFramework.WebServer.Mcp
Assembly
nanoFramework.WebServer.Mcp.dll

McpServerController class provides endpoints for handling requests related to MCP (Model Context Protocol) tools.

public class McpServerController
Inheritance
McpServerController
Derived
Inherited Members
Extension Methods

Constructors

McpServerController()

public McpServerController()

Fields

SupportedVersion

The supported version of the MCP protocol.

public const string SupportedVersion = "2025-11-25"

Field Value

string

Properties

Instructions

Gets or sets the instructions for using the MCP server.

public static string Instructions { get; set; }

Property Value

string

MaximumRequestBodySize

Gets or sets the maximum request body size in bytes. Any negative value disables the check.

public static long MaximumRequestBodySize { get; set; }

Property Value

long

OldSupportedVersions

Gets a collection of old supported versions of the MCP protocol.

public static IEnumerable OldSupportedVersions { get; }

Property Value

IEnumerable

ResourceProvider

Gets or sets the dynamic resource provider combined with the attribute registry.

public static IMcpResourceProvider ResourceProvider { get; set; }

Property Value

IMcpResourceProvider

ServerName

Gets or sets the server name.

public static string ServerName { get; set; }

Property Value

string

ServerVersion

Gets or sets the server version.

public static string ServerVersion { get; set; }

Property Value

string

ToolProvider

Gets or sets the dynamic tool provider combined with the attribute registry.

public static IMcpToolProvider ToolProvider { get; set; }

Property Value

IMcpToolProvider

Methods

HandleMcpRequest(WebServerEventArgs)

Handles POST requests to the "mcp" route. Processes the incoming request, invokes the specified tool with provided parameters, and writes the result to the response stream in JSON format.

[Route("mcp")]
[Method("POST")]
public void HandleMcpRequest(WebServerEventArgs e)

Parameters

e WebServerEventArgs

The web server event arguments containing the HTTP context and request/response information.