Add EverythingServer sample (#151)

This commit is contained in:
Aaron Powell 2025-04-05 05:48:53 +11:00 • committed by GitHub
commit 01410df5ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,18 @@
using ModelContextProtocol.Server;
using System.ComponentModel;
using System.Text.Json;
namespace EverythingServer.Tools;
[McpServerToolType]
public class PrintEnvTool
{
private static readonly JsonSerializerOptions options = new()
{
WriteIndented = true
};
[McpServerTool(Name = "printEnv"), Description("Prints all environment variables, helpful for debugging MCP server configuration")]
public static string PrintEnv() =>
JsonSerializer.Serialize(Environment.GetEnvironmentVariables(), options);
}