Skip to content

Commit 8ad9d68

Browse files
committed
Add server implementation with icons and metadata
1 parent 35b2d63 commit 8ad9d68

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

samples/EverythingServer/Program.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,33 @@
2121
ConcurrentDictionary<string, ConcurrentDictionary<string, byte>> subscriptions = new();
2222

2323
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/main/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/main/assets/Gear/3D/gear_3d.png",
45+
MimeType = "image/png",
46+
Sizes = ["256x256"]
47+
}
48+
]
49+
};
50+
})
2551
.WithHttpTransport(options =>
2652
{
2753
// Add a RunSessionHandler to remove all subscriptions for the session when it ends
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.ComponentModel;
2+
3+
namespace EverythingServer.Tools;
4+
5+
public class WeatherTool
6+
{
7+
[Description("Gets the current weather for a location")]
8+
public static string GetWeather(
9+
[Description("The city name")] string city,
10+
[Description("The country code (e.g., US, UK)")] string? country = null)
11+
{
12+
var location = country != null ? $"{city}, {country}" : city;
13+
return $"The weather in {location} is sunny with a temperature of 72°F.";
14+
}
15+
}

0 commit comments

Comments
 (0)