Class McpServerOptions | MCP C# SDK

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.Core.dll

Provides configuration options for the MCP server.

public sealed class McpServerOptions
Inheritance

McpServerOptions

Inherited Members

Properties

Capabilities

Gets or sets server capabilities to advertise to the client.

public ServerCapabilities? Capabilities { get; set; }

Property Value

ServerCapabilities

Filters

Gets or sets the filter collections for MCP server handlers.

public McpServerFilters Filters { get; set; }

Property Value

McpServerFilters

Handlers

Gets or sets the container of handlers used by the server for processing protocol messages.

public McpServerHandlers Handlers { get; set; }

Property Value

McpServerHandlers

InitializationTimeout

Gets or sets a timeout used for the client-server initialization handshake sequence.

public TimeSpan InitializationTimeout { get; set; }

Property Value

TimeSpan

KnownClientCapabilities

Gets or sets preexisting knowledge about the client's capabilities to support session migration scenarios where the client will not re-send the initialize request.

public ClientCapabilities? KnownClientCapabilities { get; set; }

Property Value

ClientCapabilities

KnownClientInfo

Gets or sets preexisting knowledge about the client including its name and version to help support stateless Streamable HTTP servers that encode this knowledge in the mcp-session-id header.

public Implementation? KnownClientInfo { get; set; }

Property Value

Implementation

MaxSamplingOutputTokens

Gets or sets the default maximum number of tokens to use for sampling requests when not explicitly specified.

public int MaxSamplingOutputTokens { get; set; }

Property Value

int

The default maximum number of tokens to use for sampling requests. The default value is 1000 tokens.

PromptCollection

Gets or sets a collection of prompts that will be served by the server.

public McpServerPrimitiveCollection<McpServerPrompt>? PromptCollection { get; set; }

Property Value

McpServerPrimitiveCollection<McpServerPrompt>

ProtocolVersion

Gets or sets the protocol version supported by this server, using a date-based versioning scheme.

public string? ProtocolVersion { get; set; }

Property Value

string

ResourceCollection

Gets or sets a collection of resources served by the server.

public McpServerResourceCollection? ResourceCollection { get; set; }

Property Value

McpServerResourceCollection

ScopeRequests

Gets or sets a value that indicates whether to create a new service provider scope for each handled request.

public bool ScopeRequests { get; set; }

Property Value

bool

true if each invocation of a request handler is invoked within a new service scope. The default is true.

SendTaskStatusNotifications

Gets or sets whether to send task status notifications to clients.

[Experimental("MCPEXP001", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001")]
public bool SendTaskStatusNotifications { get; set; }

Property Value

bool

true to send optional notifications/tasks/status notifications when task status changes; false to not send notifications. The default is false.

ServerInfo

Gets or sets information about this server implementation, including its name and version.

public Implementation? ServerInfo { get; set; }

Property Value

Implementation

ServerInstructions

Gets or sets optional server instructions to send to clients.

public string? ServerInstructions { get; set; }

Property Value

string

TaskStore

Gets or sets the task store for managing asynchronous task execution.

[Experimental("MCPEXP001", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001")]
public IMcpTaskStore? TaskStore { get; set; }

Property Value

IMcpTaskStore

ToolCollection

Gets or sets a collection of tools served by the server.

public McpServerPrimitiveCollection<McpServerTool>? ToolCollection { get; set; }

Property Value

McpServerPrimitiveCollection<McpServerTool>