experimental-ext-interceptors/csharp/sdk/samples/InterceptorServiceSample/Program.cs
Peder Holdgaard Pedersen 45f9e0ef27
C# Implementation (#2)
C# implementation of SEP-1763

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 23:53:44 +00:00

21 lines
744 B
C#

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Interceptors;
// This sample demonstrates how to create an MCP server that exposes validation interceptors.
// Interceptors can be deployed as separate services (sidecars, gateways) to validate,
// mutate, or observe MCP messages without modifying the original server or client.
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddMcpServer()
.WithStdioServerTransport()
.WithInterceptors<ParameterValidator>();
builder.Logging.AddConsole(options =>
{
options.LogToStandardErrorThreshold = LogLevel.Trace;
});
await builder.Build().RunAsync();