From 2f4297408567ef0a5978b0407983cd3295952854 Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Sun, 14 Dec 2025 10:25:53 -0600 Subject: [PATCH 1/4] Add examples of icons on tools, resources, and prompts --- samples/EverythingServer/Program.cs | 32 +++++++++++++++++++ .../Prompts/SimplePromptType.cs | 2 +- .../Resources/SimpleResourceType.cs | 2 +- samples/EverythingServer/Tools/AddTool.cs | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/samples/EverythingServer/Program.cs b/samples/EverythingServer/Program.cs index 86e46ec6b..4cea85852 100644 --- a/samples/EverythingServer/Program.cs +++ b/samples/EverythingServer/Program.cs @@ -58,6 +58,38 @@ .WithTools() .WithTools() .WithTools() + .WithTools([ + // A tool with multiple complex icons demonstrating different themes, sizes, and MIME types + McpServerTool.Create( + WeatherTool.GetWeather, + new McpServerToolCreateOptions + { + Name = "get_weather", + Title = "Get Weather Information", + Icons = [ + new Icon + { + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg", + MimeType = "image/svg+xml", + Sizes = ["any"], + Theme = "light" + }, + new Icon + { + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg", + MimeType = "image/svg+xml", + Sizes = ["any"], + Theme = "dark" + }, + new Icon + { + Source = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", + MimeType = "image/png", + Sizes = ["16x16", "32x32"] + } + ] + }) + ]) .WithPrompts() .WithPrompts() .WithResources() diff --git a/samples/EverythingServer/Prompts/SimplePromptType.cs b/samples/EverythingServer/Prompts/SimplePromptType.cs index d6ba51a33..84a4c7bc4 100644 --- a/samples/EverythingServer/Prompts/SimplePromptType.cs +++ b/samples/EverythingServer/Prompts/SimplePromptType.cs @@ -6,6 +6,6 @@ namespace EverythingServer.Prompts; [McpServerPromptType] public class SimplePromptType { - [McpServerPrompt(Name = "simple_prompt"), Description("A prompt without arguments")] + [McpServerPrompt(Name = "simple_prompt", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Light%20bulb/Flat/light_bulb_flat.svg"), Description("A prompt without arguments")] public static string SimplePrompt() => "This is a simple prompt without arguments"; } diff --git a/samples/EverythingServer/Resources/SimpleResourceType.cs b/samples/EverythingServer/Resources/SimpleResourceType.cs index da185425f..7c770de95 100644 --- a/samples/EverythingServer/Resources/SimpleResourceType.cs +++ b/samples/EverythingServer/Resources/SimpleResourceType.cs @@ -7,7 +7,7 @@ namespace EverythingServer.Resources; [McpServerResourceType] public class SimpleResourceType { - [McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain")] + [McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Memo/Flat/memo_flat.svg")] [Description("A direct text resource")] public static string DirectTextResource() => "This is a direct resource"; diff --git a/samples/EverythingServer/Tools/AddTool.cs b/samples/EverythingServer/Tools/AddTool.cs index ccaa306d6..f55303c6a 100644 --- a/samples/EverythingServer/Tools/AddTool.cs +++ b/samples/EverythingServer/Tools/AddTool.cs @@ -6,6 +6,6 @@ namespace EverythingServer.Tools; [McpServerToolType] public class AddTool { - [McpServerTool(Name = "add"), Description("Adds two numbers.")] + [McpServerTool(Name = "add", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Plus/Flat/plus_flat.svg"), Description("Adds two numbers.")] public static string Add(int a, int b) => $"The sum of {a} and {b} is {a + b}"; } From 98aeca2a9a07674666f7d4f62d30ed023c0fe2f8 Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Sun, 14 Dec 2025 10:33:40 -0600 Subject: [PATCH 2/4] Add server implementation with icons and metadata --- samples/EverythingServer/Program.cs | 28 ++++++++++++++++++- samples/EverythingServer/Tools/WeatherTool.cs | 15 ++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 samples/EverythingServer/Tools/WeatherTool.cs diff --git a/samples/EverythingServer/Program.cs b/samples/EverythingServer/Program.cs index 4cea85852..d4b474093 100644 --- a/samples/EverythingServer/Program.cs +++ b/samples/EverythingServer/Program.cs @@ -21,7 +21,33 @@ ConcurrentDictionary> subscriptions = new(); builder.Services - .AddMcpServer() + .AddMcpServer(options => + { + // Configure server implementation details with icons and website + options.ServerInfo = new Implementation + { + Name = "Everything Server", + Version = "1.0.0", + Title = "MCP Everything Server", + Description = "A comprehensive MCP server demonstrating tools, prompts, resources, sampling, and all MCP features", + WebsiteUrl = "https://github.com/modelcontextprotocol/csharp-sdk", + Icons = [ + new Icon + { + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Gear/Flat/gear_flat.svg", + MimeType = "image/svg+xml", + Sizes = ["any"], + Theme = "light" + }, + new Icon + { + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Gear/3D/gear_3d.png", + MimeType = "image/png", + Sizes = ["256x256"] + } + ] + }; + }) .WithHttpTransport(options => { // Add a RunSessionHandler to remove all subscriptions for the session when it ends diff --git a/samples/EverythingServer/Tools/WeatherTool.cs b/samples/EverythingServer/Tools/WeatherTool.cs new file mode 100644 index 000000000..fa685b652 --- /dev/null +++ b/samples/EverythingServer/Tools/WeatherTool.cs @@ -0,0 +1,15 @@ +using System.ComponentModel; + +namespace EverythingServer.Tools; + +public class WeatherTool +{ + [Description("Gets the current weather for a location")] + public static string GetWeather( + [Description("The city name")] string city, + [Description("The country code (e.g., US, UK)")] string? country = null) + { + var location = country != null ? $"{city}, {country}" : city; + return $"The weather in {location} is sunny with a temperature of 72°F."; + } +} From 7da8238bc1c0f3ae0141535b3b7b9234afada19b Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Mon, 29 Dec 2025 10:16:55 -0600 Subject: [PATCH 3/4] Add complex icon configuration for Echo tool --- samples/EverythingServer/Program.cs | 37 ++++++++++--------- samples/EverythingServer/Tools/WeatherTool.cs | 15 -------- 2 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 samples/EverythingServer/Tools/WeatherTool.cs diff --git a/samples/EverythingServer/Program.cs b/samples/EverythingServer/Program.cs index d4b474093..67c9fde8a 100644 --- a/samples/EverythingServer/Program.cs +++ b/samples/EverythingServer/Program.cs @@ -79,43 +79,46 @@ }) .WithTools() .WithTools() - .WithTools() - .WithTools() - .WithTools() - .WithTools() - .WithTools() .WithTools([ - // A tool with multiple complex icons demonstrating different themes, sizes, and MIME types + // EchoTool with complex icon configuration demonstrating multiple icons, + // MIME types, size specifications, and theme preferences McpServerTool.Create( - WeatherTool.GetWeather, - new McpServerToolCreateOptions + typeof(EchoTool).GetMethod(nameof(EchoTool.Echo))!, + options: new McpServerToolCreateOptions { - Name = "get_weather", - Title = "Get Weather Information", Icons = [ + // High-resolution PNG icon for light theme new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg", + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Loudspeaker/Flat/loudspeaker_flat.svg", MimeType = "image/svg+xml", Sizes = ["any"], Theme = "light" }, + // 3D icon for dark theme new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg", - MimeType = "image/svg+xml", - Sizes = ["any"], + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Loudspeaker/3D/loudspeaker_3d.png", + MimeType = "image/png", + Sizes = ["256x256"], Theme = "dark" }, + // WebP format for modern browsers + // Demonstrates Data URI representation with the smallest possible valid WebP image (1x1 pixel). + // This will appear as a white box when rendered by a browser at 32x32 new Icon { - Source = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", - MimeType = "image/png", - Sizes = ["16x16", "32x32"] + Source = "data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=", + MimeType = "image/webp", + Sizes = ["32x32"] } ] }) ]) + .WithTools() + .WithTools() + .WithTools() + .WithTools() .WithPrompts() .WithPrompts() .WithResources() diff --git a/samples/EverythingServer/Tools/WeatherTool.cs b/samples/EverythingServer/Tools/WeatherTool.cs deleted file mode 100644 index fa685b652..000000000 --- a/samples/EverythingServer/Tools/WeatherTool.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel; - -namespace EverythingServer.Tools; - -public class WeatherTool -{ - [Description("Gets the current weather for a location")] - public static string GetWeather( - [Description("The city name")] string city, - [Description("The country code (e.g., US, UK)")] string? country = null) - { - var location = country != null ? $"{city}, {country}" : city; - return $"The weather in {location} is sunny with a temperature of 72°F."; - } -} From 7084478248ee1dc22ea2c733ad4dff4a509f63bb Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Wed, 7 Jan 2026 20:02:38 -0600 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Stephen Halter --- samples/EverythingServer/Program.cs | 8 ++++---- samples/EverythingServer/Prompts/SimplePromptType.cs | 2 +- samples/EverythingServer/Resources/SimpleResourceType.cs | 2 +- samples/EverythingServer/Tools/AddTool.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/EverythingServer/Program.cs b/samples/EverythingServer/Program.cs index 67c9fde8a..c508db99f 100644 --- a/samples/EverythingServer/Program.cs +++ b/samples/EverythingServer/Program.cs @@ -34,14 +34,14 @@ Icons = [ new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Gear/Flat/gear_flat.svg", + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Gear/Flat/gear_flat.svg", MimeType = "image/svg+xml", Sizes = ["any"], Theme = "light" }, new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Gear/3D/gear_3d.png", + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Gear/3D/gear_3d.png", MimeType = "image/png", Sizes = ["256x256"] } @@ -90,7 +90,7 @@ // High-resolution PNG icon for light theme new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Loudspeaker/Flat/loudspeaker_flat.svg", + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Loudspeaker/Flat/loudspeaker_flat.svg", MimeType = "image/svg+xml", Sizes = ["any"], Theme = "light" @@ -98,7 +98,7 @@ // 3D icon for dark theme new Icon { - Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Loudspeaker/3D/loudspeaker_3d.png", + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Loudspeaker/3D/loudspeaker_3d.png", MimeType = "image/png", Sizes = ["256x256"], Theme = "dark" diff --git a/samples/EverythingServer/Prompts/SimplePromptType.cs b/samples/EverythingServer/Prompts/SimplePromptType.cs index 84a4c7bc4..42b3fa3b5 100644 --- a/samples/EverythingServer/Prompts/SimplePromptType.cs +++ b/samples/EverythingServer/Prompts/SimplePromptType.cs @@ -6,6 +6,6 @@ namespace EverythingServer.Prompts; [McpServerPromptType] public class SimplePromptType { - [McpServerPrompt(Name = "simple_prompt", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Light%20bulb/Flat/light_bulb_flat.svg"), Description("A prompt without arguments")] + [McpServerPrompt(Name = "simple_prompt", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Light%20bulb/Flat/light_bulb_flat.svg"), Description("A prompt without arguments")] public static string SimplePrompt() => "This is a simple prompt without arguments"; } diff --git a/samples/EverythingServer/Resources/SimpleResourceType.cs b/samples/EverythingServer/Resources/SimpleResourceType.cs index 7c770de95..15d055d04 100644 --- a/samples/EverythingServer/Resources/SimpleResourceType.cs +++ b/samples/EverythingServer/Resources/SimpleResourceType.cs @@ -7,7 +7,7 @@ namespace EverythingServer.Resources; [McpServerResourceType] public class SimpleResourceType { - [McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Memo/Flat/memo_flat.svg")] + [McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Memo/Flat/memo_flat.svg")] [Description("A direct text resource")] public static string DirectTextResource() => "This is a direct resource"; diff --git a/samples/EverythingServer/Tools/AddTool.cs b/samples/EverythingServer/Tools/AddTool.cs index f55303c6a..097848773 100644 --- a/samples/EverythingServer/Tools/AddTool.cs +++ b/samples/EverythingServer/Tools/AddTool.cs @@ -6,6 +6,6 @@ namespace EverythingServer.Tools; [McpServerToolType] public class AddTool { - [McpServerTool(Name = "add", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Plus/Flat/plus_flat.svg"), Description("Adds two numbers.")] + [McpServerTool(Name = "add", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Plus/Flat/plus_flat.svg"), Description("Adds two numbers.")] public static string Add(int a, int b) => $"The sum of {a} and {b} is {a + b}"; }