|
21 | 21 | ConcurrentDictionary<string, ConcurrentDictionary<string, byte>> subscriptions = new(); |
22 | 22 |
|
23 | 23 | builder.Services |
24 | | - .AddMcpServer() |
| 24 | + .AddMcpServer(options => |
| 25 | + { |
| 26 | + // Configure server implementation details with icons and website |
| 27 | + options.ServerInfo = new Implementation |
| 28 | + { |
| 29 | + Name = "Everything Server", |
| 30 | + Version = "1.0.0", |
| 31 | + Title = "MCP Everything Server", |
| 32 | + Description = "A comprehensive MCP server demonstrating tools, prompts, resources, sampling, and all MCP features", |
| 33 | + WebsiteUrl = "https://github.com/modelcontextprotocol/csharp-sdk", |
| 34 | + Icons = [ |
| 35 | + new Icon |
| 36 | + { |
| 37 | + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Gear/Flat/gear_flat.svg", |
| 38 | + MimeType = "image/svg+xml", |
| 39 | + Sizes = ["any"], |
| 40 | + Theme = "light" |
| 41 | + }, |
| 42 | + new Icon |
| 43 | + { |
| 44 | + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Gear/3D/gear_3d.png", |
| 45 | + MimeType = "image/png", |
| 46 | + Sizes = ["256x256"] |
| 47 | + } |
| 48 | + ] |
| 49 | + }; |
| 50 | + }) |
25 | 51 | .WithHttpTransport(options => |
26 | 52 | { |
27 | 53 | // Add a RunSessionHandler to remove all subscriptions for the session when it ends |
|
53 | 79 | }) |
54 | 80 | .WithTools<AddTool>() |
55 | 81 | .WithTools<AnnotatedMessageTool>() |
56 | | - .WithTools<EchoTool>() |
| 82 | + .WithTools([ |
| 83 | + // EchoTool with complex icon configuration demonstrating multiple icons, |
| 84 | + // MIME types, size specifications, and theme preferences |
| 85 | + McpServerTool.Create( |
| 86 | + typeof(EchoTool).GetMethod(nameof(EchoTool.Echo))!, |
| 87 | + options: new McpServerToolCreateOptions |
| 88 | + { |
| 89 | + Icons = [ |
| 90 | + // High-resolution PNG icon for light theme |
| 91 | + new Icon |
| 92 | + { |
| 93 | + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Loudspeaker/Flat/loudspeaker_flat.svg", |
| 94 | + MimeType = "image/svg+xml", |
| 95 | + Sizes = ["any"], |
| 96 | + Theme = "light" |
| 97 | + }, |
| 98 | + // 3D icon for dark theme |
| 99 | + new Icon |
| 100 | + { |
| 101 | + Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/62ecdc0d7ca5c6df32148c169556bc8d3782fca4/assets/Loudspeaker/3D/loudspeaker_3d.png", |
| 102 | + MimeType = "image/png", |
| 103 | + Sizes = ["256x256"], |
| 104 | + Theme = "dark" |
| 105 | + }, |
| 106 | + // WebP format for modern browsers |
| 107 | + // Demonstrates Data URI representation with the smallest possible valid WebP image (1x1 pixel). |
| 108 | + // This will appear as a white box when rendered by a browser at 32x32 |
| 109 | + new Icon |
| 110 | + { |
| 111 | + Source = "data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=", |
| 112 | + MimeType = "image/webp", |
| 113 | + Sizes = ["32x32"] |
| 114 | + } |
| 115 | + ] |
| 116 | + }) |
| 117 | + ]) |
57 | 118 | .WithTools<LongRunningTool>() |
58 | 119 | .WithTools<PrintEnvTool>() |
59 | 120 | .WithTools<SampleLlmTool>() |
|
0 commit comments