Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Configuration Inheritance: System.Object

Syntax

Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration

Summary

Configuration for network endpoints, ports, and transport protocols.

Remarks

Network configuration specifies how the MCP server exposes its endpoints and communicates with clients. The configuration varies based on deployment mode.

Constructors

.ctor

Initializes a new instance of the NetworkConfiguration class.

Syntax

public NetworkConfiguration()

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

BasePath

Gets or sets the base path for MCP endpoints.

Syntax

public string BasePath { get; set; }

Property Value

Type: string The base path prefix for all MCP endpoints (e.g., “/mcp”, “/api/mcp”).

Remarks

All MCP endpoints will be prefixed with this path. This allows hosting MCP endpoints alongside other application endpoints.

Compression

Gets or sets the compression configuration.

Syntax

public Microsoft.OData.Mcp.Core.Configuration.CompressionConfiguration Compression { get; set; }

Property Value

Type: Microsoft.OData.Mcp.Core.Configuration.CompressionConfiguration Configuration for HTTP response compression.

Remarks

Compression can reduce bandwidth usage for large responses.

ConnectionTimeout

Gets or sets the connection timeout.

Syntax

public System.TimeSpan ConnectionTimeout { get; set; }

Property Value

Type: System.TimeSpan The maximum time to wait for new connections to be established.

Remarks

Connections that take longer than this timeout will be rejected.

Cors

Gets or sets the CORS configuration.

Syntax

public Microsoft.OData.Mcp.Core.Configuration.CorsConfiguration Cors { get; set; }

Property Value

Type: Microsoft.OData.Mcp.Core.Configuration.CorsConfiguration Configuration for Cross-Origin Resource Sharing.

Remarks

CORS configuration allows web applications from different domains to access the MCP server endpoints.

CustomProperties

Gets or sets custom network properties.

Syntax

public System.Collections.Generic.Dictionary<string, object> CustomProperties { get; set; }

Property Value

Type: System.Collections.Generic.Dictionary<string, object> A dictionary of custom network configuration values.

Remarks

Custom properties allow extending the configuration with deployment-specific network settings.

EnableHttps

Gets or sets a value indicating whether to enable HTTPS.

Syntax

public bool EnableHttps { get; set; }

Property Value

Type: bool true to enable HTTPS; otherwise, false.

Remarks

For production deployments, HTTPS should be enabled for security. Development environments may disable HTTPS for simplicity.

Host

Gets or sets the host address to bind to.

Syntax

public string Host { get; set; }

Property Value

Type: string The host address or hostname (e.g., “localhost”, “0.0.0.0”, “example.com”).

Remarks

For sidecar deployments, this determines the network interface to bind to. For middleware deployments, this is typically inherited from the host application.

HttpsPort

Gets or sets the HTTPS port when HTTPS is enabled.

Syntax

public System.Nullable<int> HttpsPort { get; set; }

Property Value

Type: System.Nullable<int> The HTTPS port number, or null to use default (443).

Remarks

This is only used when EnableHttps is true and in sidecar deployment mode.

KeepAliveTimeout

Gets or sets the keep-alive timeout.

Syntax

public System.TimeSpan KeepAliveTimeout { get; set; }

Property Value

Type: System.TimeSpan The maximum time to keep idle connections alive.

Remarks

Idle connections will be closed after this timeout to free resources.

MaxConcurrentConnections

Gets or sets the maximum number of concurrent connections.

Syntax

public int MaxConcurrentConnections { get; set; }

Property Value

Type: int The maximum number of concurrent client connections.

Remarks

This helps prevent resource exhaustion from too many simultaneous connections.

MaxRequestBodySize

Gets or sets the maximum request body size.

Syntax

public long MaxRequestBodySize { get; set; }

Property Value

Type: long The maximum size in bytes for HTTP request bodies.

Remarks

Requests larger than this size will be rejected to prevent memory exhaustion.

Port

Gets or sets the port number to listen on.

Syntax

public System.Nullable<int> Port { get; set; }

Property Value

Type: System.Nullable<int> The TCP port number, or null to use the host application’s port.

Remarks

For sidecar deployments, this is the port the MCP server will listen on. For middleware deployments, this should typically be null to inherit from the host.

RequestTimeout

Gets or sets the request timeout.

Syntax

public System.TimeSpan RequestTimeout { get; set; }

Property Value

Type: System.TimeSpan The maximum time to wait for request processing.

Remarks

Requests that take longer than this timeout will be cancelled.

Ssl

Gets or sets the SSL certificate configuration.

Syntax

public Microsoft.OData.Mcp.Core.Configuration.SslConfiguration Ssl { get; set; }

Property Value

Type: Microsoft.OData.Mcp.Core.Configuration.SslConfiguration Configuration for SSL/TLS certificates.

Remarks

This configuration is used when HTTPS is enabled in sidecar deployment mode.

UseHostConfiguration

Gets or sets a value indicating whether to use the host application’s network configuration.

Syntax

public bool UseHostConfiguration { get; set; }

Property Value

Type: bool true to inherit host configuration; otherwise, false.

Remarks

For middleware deployments, this should typically be true to inherit the host application’s network settings.

Methods

Clone

Creates a copy of this configuration.

Syntax

public Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration Clone()

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration A new instance with the same settings.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetBaseUrl

Gets the base URL for the MCP server.

Syntax

public string GetBaseUrl(string scheme = null)

Parameters

NameTypeDescription
schemestring?The URL scheme to use (http or https).

Returns

Type: string The base URL for the MCP server.

GetEndpointUrl

Gets the full URL for an MCP endpoint.

Syntax

public string GetEndpointUrl(string endpoint, string scheme = null)

Parameters

NameTypeDescription
endpointstringThe endpoint path (e.g., “tools”, “metadata”).
schemestring?The URL scheme to use (http or https).

Returns

Type: string The complete URL for the endpoint.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

MergeWith

Merges another configuration into this one, with the other configuration taking precedence.

Syntax

public void MergeWith(Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration other)

Parameters

NameTypeDescription
otherMicrosoft.OData.Mcp.Core.Configuration.NetworkConfigurationThe configuration to merge into this one.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when other is null.

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?

Validate

Validates the network configuration.

Syntax

public System.Collections.Generic.IEnumerable<string> Validate(Microsoft.OData.Mcp.Core.Configuration.McpDeploymentMode deploymentMode)

Parameters

NameTypeDescription
deploymentModeMicrosoft.OData.Mcp.Core.Configuration.McpDeploymentModeThe deployment mode for context-specific validation.

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of validation errors, or empty if the configuration is valid.