nanoFramework.Iot.Device.CoreDiscoveryEngine 1.0.1

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

Core Discovery Engine for MCP using System.Device.Model

CoreDiscoveryEngine inspects public methods and property accessors decorated with System.Device.Model attributes and produces a protocol-neutral description of the device interface. Readable telemetry and properties are MCP resource candidates; commands and writable properties are MCP tool candidates.

The implementation is designed for .NET nanoFramework constraints: it uses ArrayList and arrays, performs no asynchronous work, and does not depend on PropertyInfo. Property metadata can be applied to the generated get_ or set_ accessor for individual selection or on the main property name:

[Property]
public int SamplingRate
{    
    get
    {
        return _samplingRate;
    }

    set
    {
        _samplingRate = value;
    }
}
DeviceInterface discovered = CapabilityDiscovery.Discover(device);

foreach (Capability capability in discovered.Capabilities)
{
    Debug.WriteLine($"{capability.Path}: resource={capability.IsMcpResource}, tool={capability.IsMcpTool}");
}

McpDeviceRegistry turns that description into live MCP resources and tools:

McpDeviceRegistry registry = new McpDeviceRegistry();
registry.Register(discovered, device, "sensor-a");

McpServerController.ResourceProvider = registry;
McpServerController.ToolProvider = registry;

string resources = registry.GetResourceMetadataJson();
string tools = registry.GetToolMetadataJson();

The registry also provides ReadResource and InvokeTool, including positional arg0, arg1, and subsequent arguments for multi-parameter commands. An MCP controller can delegate its resources/list, resources/read, tools/list, and tools/call handlers directly to these four methods. Resource reads accept both full mcp://sensor-a/Reading URIs and values without the mcp:// scheme.

This binding is intended to expose existing sensor bindings to MCP from their System.Device.Model metadata. It does not require MCP-specific attributes, wrapper methods, or additional registration code in the sensor binding.

Dynamic server integration requires IMcpResourceProvider, IMcpToolProvider, McpServerController.ResourceProvider, and McpServerController.ToolProvider from nanoFramework.WebServer.Mcp. These extension points allow the controller to delegate discovery and invocation to McpDeviceRegistry without adding MCP attributes to the device implementation. Dynamic providers require nanoFramework.WebServer.Mcp 1.2.162 or later.

ESP32 sample

The sample connects an ESP32 to Wi-Fi and starts the MCP server supplied by the nanoFramework.WebServer.Mcp package. It registers an Acme device and a synthetic thermostat in the same registry. The thermostat exposes target and current temperatures, heating state, and tools to start or stop heating. McpServerController provides the MCP endpoint and delegates resources and tools to the dynamically populated McpDeviceRegistry.

  1. Set WifiSsid and WifiPassword in samples/Program.cs.
  2. Select an ESP32 nanoFramework device and deploy the sample project.
  3. Read the Debug output for the assigned address and MCP endpoint, for example http://192.168.1.42/mcp.

The ESP32 and MCP client must be reachable on the same network. The sample uses plain, unauthenticated HTTP and is intended for development networks.

Command argument names

nanoFramework reflection exposes command parameter types but not their source names. Command arguments are therefore published as arg0, arg1, and so on, in declaration order.

Applications that need richer MCP metadata can use the MCP package directly. Its McpServerTool, McpServerResource, and Description attributes support explicit names, descriptions, and modeled input details. That approach requires MCP-specific annotations or input models; CoreDiscoveryEngine favors automatic exposure without changes to existing sensor code.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
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.1 77 10/1/2026