![]() |
VOOZH | about |
dotnet add package nanoFramework.WebServer.FileSystem --version 1.2.147
NuGet\Install-Package nanoFramework.WebServer.FileSystem -Version 1.2.147
<PackageReference Include="nanoFramework.WebServer.FileSystem" Version="1.2.147" />
<PackageVersion Include="nanoFramework.WebServer.FileSystem" Version="1.2.147" />Directory.Packages.props
<PackageReference Include="nanoFramework.WebServer.FileSystem" />Project file
paket add nanoFramework.WebServer.FileSystem --version 1.2.147
#r "nuget: nanoFramework.WebServer.FileSystem, 1.2.147"
#:package nanoFramework.WebServer.FileSystem@1.2.147
#addin nuget:?package=nanoFramework.WebServer.FileSystem&version=1.2.147Install as a Cake Addin
#tool nuget:?package=nanoFramework.WebServer.FileSystem&version=1.2.147Install as a Cake Tool
👁 Quality Gate Status
👁 Reliability Rating
👁 NuGet
👁 #yourfirstpr
👁 Discord
| Component | Build Status | NuGet Package |
|---|---|---|
| nanoFramework.WebServer | 👁 Build Status |
👁 NuGet |
| nanoFramework.WebServer.FileSystem | 👁 Build Status |
👁 NuGet |
| nanoFramework.WebServer.Mcp | 👁 Build Status |
👁 NuGet |
| nanoFramework.WebServer.Skills | 👁 Build Status |
👁 NuGet |
This library provides a lightweight, multi-threaded HTTP/HTTPS WebServer for .NET nanoFramework with comprehensive Model Context Protocol (MCP) support and AI Agent Skills Discovery (A2A-compatible) for AI agent integration.
Using the Web Server is very straight forward and supports event based calls.
// You need to be connected to a Wi-Fi or ethernet connection with a proper IP Address
// Optionally you can pass a parameter with the IP address for the server to bind to
using (WebServer server = new WebServer(80, HttpProtocol.Http))
{
server.CommandReceived += ServerCommandReceived;
server.Start();
Thread.Sleep(Timeout.Infinite);
}
private static void ServerCommandReceived(object source, WebServerEventArgs e)
{
if (e.Context.Request.RawUrl.ToLower() == "/hello")
{
WebServer.OutputAsStream(e.Context.Response, "Hello from nanoFramework!");
}
else
{
WebServer.OutputHttpCode(e.Context.Response, HttpStatusCode.NotFound);
}
}
Controllers are supported including with parametarized routes like 'api/led/{id}/dosomething/{order}'.
using (WebServer server = new WebServer(80, HttpProtocol.Http, new Type[] { typeof(MyController) }))
{
server.Start();
Thread.Sleep(Timeout.Infinite);
}
public class MyController
{
[Route("api/hello")]
[Method("GET")]
public void Hello(WebServerEventArgs e)
{
WebServer.OutputAsStream(e.Context.Response, "Hello from Controller!");
}
[Route("api/led/{id}")]
[Method("GET")]
public void LedState(WebServerEventArgs e)
{
string ledId = e.GetRouteParameter("id");
WebServer.OutputAsStream(e.Context.Response, $"You selected Led {ledId}!");
}
}
Enable AI agents to interact with your embedded devices through standardized tools and JSON-RPC 2.0 protocol.
public class IoTTools
{
[McpServerTool("read_sensor", "Reads temperature from sensor")]
public static string ReadTemperature()
{
// Your sensor reading code
return "23.5°C";
}
[McpServerTool("control_led", "Controls device LED", "Output the status of the LED")]
public static string ControlLed(LedCommand command)
{
// Your LED control code
return $"LED set to {command.State}";
}
}
public class LedCommand
{
public string State
{
[Description("LED state: on, off, or blink")]
get;
set;
}
}
You can define reusable, high-level prompts for AI agents using the McpServerPrompt attribute. Prompts encapsulate multi-step instructions or workflows that can be invoked by agents.
Here's a simple example:
using nanoFramework.WebServer.Mcp;
public class McpPrompts
{
[McpServerPrompt("echo_sanity_check", "Echo test prompt")]
public static PromptMessage[] EchoSanityCheck()
{
return new PromptMessage[]
{
new PromptMessage("Call Echo with the string 'Hello MCP world!' and return the response.")
};
}
}
Prompts can be discovered and invoked by AI agents in the same way as tools. You can also define prompts with parameters using the McpPromptParameter attribute.
public static void Main()
{
// Connect to WiFi first
var connected = WifiNetworkHelper.ConnectDhcp(Ssid, Password, requiresDateTime: true);
// Discover and register MCP tools
McpToolRegistry.DiscoverTools(new Type[] { typeof(IoTTools) });
// Discover and register MCP prompts
McpPromptRegistry.DiscoverPrompts(new Type[] { typeof(McpPrompts) });
// Start WebServer with MCP support
using (var server = new WebServer(80, HttpProtocol.Http, new Type[] { typeof(McpServerController) }))
{
// Optional customization
McpServerController.ServerName = "MyIoTDevice";
McpServerController.Instructions = "IoT device with sensor and LED control capabilities.";
server.Start();
Thread.Sleep(Timeout.Infinite);
}
}
Once running, AI agents can discover and invoke your tools:
// Tool discovery
POST /mcp
{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}
// Tool invocation
POST /mcp
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "control_led",
"arguments": {"State": "on"}
},
"id": 2
}
Expose device capabilities as discoverable skills for AI agents using the A2A (Agent2Agent) protocol conventions.
using nanoFramework.WebServer.Skills;
[Skill("climate", "Climate Control", "HVAC management for building zones")]
[SkillTag("temperature")]
[SkillTag("hvac")]
[SkillExample("What is the current temperature?")]
public class ClimateSkill
{
[SkillAction("GetTemperature", "Reads current room temperature")]
public static double GetTemperature()
{
return 22.5;
}
[SkillAction("SetTarget", "Sets the target temperature")]
public static bool SetTarget(TargetInput input)
{
return true;
}
}
public class TargetInput
{
public double Temperature
{
[Description("Target temperature in Celsius")]
get;
set;
}
}
public static void Main()
{
// Connect to WiFi first
var connected = WifiNetworkHelper.ConnectDhcp(Ssid, Password, requiresDateTime: true);
// Discover and register skills
SkillRegistry.DiscoverSkills(new Type[] { typeof(ClimateSkill) });
// Start WebServer with Skills Discovery support
using (var server = new WebServer(80, HttpProtocol.Http, new Type[] { typeof(SkillDiscoveryController) }))
{
// Optional customization
SkillDiscoveryController.AgentName = "SmartThermostat";
SkillDiscoveryController.AgentDescription = "Embedded HVAC controller with sensor capabilities";
server.Start();
Thread.Sleep(Timeout.Infinite);
}
}
Once running, AI agents can discover and invoke your skills:
GET /.well-known/agent-card.json
{
"name": "SmartThermostat",
"description": "Embedded HVAC controller with sensor capabilities",
"version": "1.0.0",
"skills": [
{
"id": "climate",
"name": "Climate Control",
"tags": ["temperature", "hvac"],
"actions": [
{ "name": "GetTemperature", "description": "Reads current room temperature" },
{ "name": "SetTarget", "description": "Sets the target temperature" }
]
}
]
}
POST /skills/invoke
Content-Type: application/json
{ "skill": "climate", "action": "GetTemperature", "arguments": {} }
| Topic | Description |
|---|---|
| Learn about route attributes, method decorations, and URL parameters | |
| Configure Basic Auth, API Key, and custom authentication | |
| Set up SSL/TLS encryption with certificates | |
| Serve static files from storage devices | |
| Complete MCP guide for AI agent integration | |
| A2A-compatible skills discovery and invocation | |
| Build RESTful APIs with request/response handling | |
| Handle requests through events and status monitoring | |
| Working examples and code samples |
Install 'nanoFramework.WebServer' for the Web Server without File System support. Install 'nanoFramework.WebServer.FileSystem' for file serving, so with devices supporting File System. Install 'nanoFramework.WebServer.Mcp' for MCP support. It does contains the full 'nanoFramework.WebServer' but does not include native file serving. You can add this feature fairly easilly by reusing the code function serving it. Install 'nanoFramework.WebServer.Skills' for A2A-compatible AI Agent Skills Discovery. Like MCP, it includes the core 'nanoFramework.WebServer' and can be used alongside MCP.
For documentation, feedback, issues and contributions, please refer to the Home repo.
Join our Discord community here.
The list of contributors to this project can be found at CONTRIBUTORS.
Licensed under the .
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the .NET Foundation Code of Conduct.
This project is supported by the .NET Foundation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net net is compatible. |
This package is not used by any NuGet packages.
Showing the top 1 popular GitHub repositories that depend on nanoFramework.WebServer.FileSystem:
| Repository | Stars |
|---|---|
|
nanoframework/Samples
🍬 Code samples from the nanoFramework team used in testing, proof of concepts and other explorational endeavours
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.147 | 106 | 5/29/2026 |
| 1.2.145 | 118 | 5/29/2026 |
| 1.2.144 | 115 | 5/18/2026 |
| 1.2.143 | 117 | 5/14/2026 |
| 1.2.141 | 114 | 5/6/2026 |
| 1.2.140 | 146 | 4/24/2026 |
| 1.2.139 | 111 | 4/22/2026 |
| 1.2.138 | 141 | 4/2/2026 |
| 1.2.137 | 128 | 3/29/2026 |
| 1.2.134 | 631 | 11/21/2025 |
| 1.2.133 | 357 | 11/13/2025 |
| 1.2.131 | 250 | 10/17/2025 |
| 1.2.130 | 239 | 10/15/2025 |
| 1.2.126 | 333 | 8/12/2025 |
| 1.2.125 | 288 | 7/7/2025 |
| 1.2.124 | 245 | 7/7/2025 |
| 1.2.123 | 237 | 6/27/2025 |
| 1.2.122 | 307 | 6/2/2025 |
| 1.2.121 | 361 | 4/25/2025 |
| 1.2.118 | 367 | 4/2/2025 |