Add examples of icons on tools, resources, prompts, and server implementation to EverythingServer (#1096)

Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Mike Kistler 2026-01-09 08:49:37 -06:00 • committed by GitHub
commit 50e29c572d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,33 @@ var builder = WebApplication.CreateBuilder(args);
ConcurrentDictionary<string, ConcurrentDictionary<string, byte>> 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/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/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/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
@ -53,7 +79,42 @@ builder.Services
})
.WithTools<AddTool>()
.WithTools<AnnotatedMessageTool>()
.WithTools<EchoTool>()
.WithTools([
// EchoTool with complex icon configuration demonstrating multiple icons,
// MIME types, size specifications, and theme preferences
McpServerTool.Create(
typeof(EchoTool).GetMethod(nameof(EchoTool.Echo))!,
options: new McpServerToolCreateOptions
{
Icons = [
// High-resolution PNG icon for light theme
new Icon
{
Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/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/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/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/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=",
MimeType = "image/webp",
Sizes = ["32x32"]
}
]
})
])
.WithTools<LongRunningTool>()
.WithTools<PrintEnvTool>()
.WithTools<SampleLlmTool>()