Table of Contents

Class McpServerServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
ModelContextProtocol.dll

Provides extension methods for configuring MCP servers with dependency injection.

public static class McpServerServiceCollectionExtensions
Inheritance
McpServerServiceCollectionExtensions
Inherited Members

Methods

AddMcpServer(IServiceCollection, Action<McpServerOptions>?)

Adds the Model Context Protocol (MCP) server to the service collection with default options.

public static IMcpServerBuilder AddMcpServer(this IServiceCollection services, Action<McpServerOptions>? configureOptions = null)

Parameters

services IServiceCollection

The IServiceCollection to add the server to.

configureOptions Action<McpServerOptions>

Optional callback to configure the McpServerOptions.

Returns

IMcpServerBuilder

An IMcpServerBuilder that can be used to further configure the MCP server.