MCAF: ML/AI Delivery
Apply MCAF ML/AI delivery guidance for data exploration, feasibility, experimentation, testing, responsible AI, and operating ML systems.
dotnet skills install mcaf-ml-ai-delivery
Build or consume Model Context Protocol (MCP) servers and clients in .NET using the official MCP C# SDK, including stdio, Streamable HTTP, tools, prompts, resources, and capability negotiation.
IChatClient.NET AI quickstarts or publishing a server to the MCP Registry- Local child-process server: ModelContextProtocol + WithStdioServerTransport(). - Remote server: ModelContextProtocol.AspNetCore + WithHttpTransport() + MapMcp(). - Client-only app: start with ModelContextProtocol or ModelContextProtocol.Core. - Registry distribution: pair a minimal server with the MCP Registry publishing flow only after the server contract is stable.
- Tools: [McpServerToolType] + [McpServerTool] - Resources: [McpServerResourceType] + [McpServerResource] - Prompts: [McpServerPromptType] + [McpServerPrompt] - Use custom handlers or filters only for cross-cutting behavior, protocol extensions, or advanced routing.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddConsole(options =>
{
options.LogToStandardErrorThreshold = LogLevel.Trace;
});
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly();
await builder.Build().RunAsync();
[McpServerToolType]
public static class EchoTool
{
[McpServerTool, Description("Echoes the message back to the client.")]
public static string Echo(string message) => $"hello {message}";
}
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddMcpServer()
.WithHttpTransport()
.WithToolsFromAssembly();
var app = builder.Build();
app.MapMcp("/mcp");
app.Run();
[McpServerToolType]
public static class EchoTool
{
[McpServerTool, Description("Echoes the message back to the client.")]
public static string Echo(string message) => $"hello {message}";
}
McpClient.CreateAsync(...) and stay capability-aware.using ModelContextProtocol.Client;
using ModelContextProtocol.Protocol;
var transport = new StdioClientTransport(new StdioClientTransportOptions
{
Name = "Everything",
Command = "npx",
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
});
await using var client = await McpClient.CreateAsync(transport);
IList<McpClientTool> tools = await client.ListToolsAsync();
if (client.ServerCapabilities.Prompts is not null)
{
var prompts = await client.ListPromptsAsync();
}
- Client capabilities: configure McpClientOptions.Capabilities for roots, sampling, and elicitation. - Server capabilities are inferred from registered features. - Check client.ServerCapabilities before using completions, logging, prompt list-change notifications, or resource subscriptions. - Use client.NegotiatedProtocolVersion or server.NegotiatedProtocolVersion only when version-specific behavior matters.
- Streamable HTTP is the recommended transport for remote servers. - MapMcp() also serves SSE compatibility endpoints for older clients. - HTTP clients can use AutoDetect by default, or force StreamableHttp / Sse. - Session resumption is available for Streamable HTTP through McpClient.ResumeSessionAsync(...).
.NET AI MCP quickstarts as bootstrap examples.- build-mcp-client and build-mcp-server are good starting points when the surrounding app is still MEAI-centric. - publish-mcp-registry is the distribution step, not the design step. Stabilize the protocol surface before publishing.
- Tool exceptions normally come back as CallToolResult.IsError == true. - Throw McpProtocolException only for protocol-level JSON-RPC failures. - McpClientTool inherits from AIFunction, so discovered tools can be passed directly into IChatClient. - Experimental APIs use MCPEXP... diagnostics; suppress them intentionally, not globally by accident. - If you use a custom JsonSerializerContext, prepend McpJsonUtilities.DefaultOptions.TypeInfoResolver so MCP protocol types keep the SDK's contract.
Core, ModelContextProtocol, or AspNetCoreMapMcp() and are tested at the final route, for example /mcp[McpServer*] attributes or documented handler/filter alternativesServerCapabilities before using subscriptions, completions, logging, or prompt/resource list-change flowsApply MCAF ML/AI delivery guidance for data exploration, feasibility, experimentation, testing, responsible AI, and operating ML systems.
dotnet skills install mcaf-ml-ai-delivery
Build .NET AI agents and multi-agent workflows with Microsoft Agent Framework using the right agent type, threads, tools, workflows, hosting protocols, and enterprise guardrails.
dotnet skills install microsoft-agent-framework
Build provider-agnostic .NET AI integrations with `Microsoft.Extensions.AI`, `IChatClient`, embeddings, middleware, structured output, vector search, and evaluation.
dotnet skills install microsoft-extensions-ai
AI-focused orchestration agent for Microsoft Agent Framework, Microsoft.Extensions.AI, Semantic Kernel, MCP, and ML.NET.
Also works: dotnet agents install ai