Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Configuration Inheritance: System.ObjectSyntax
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
.ctor Inherited
Inherited from
objectSyntax
Properties
BasePath
Gets or sets the base path for MCP endpoints.Syntax
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Returns
Type:Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration
A new instance with the same settings.
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetBaseUrl
Gets the base URL for the MCP server.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
scheme | string? | 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
Parameters
| Name | Type | Description |
|---|---|---|
endpoint | string | The endpoint path (e.g., “tools”, “metadata”). |
scheme | string? | The URL scheme to use (http or https). |
Returns
Type:string
The complete URL for the endpoint.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
MergeWith
Merges another configuration into this one, with the other configuration taking precedence.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
other | Microsoft.OData.Mcp.Core.Configuration.NetworkConfiguration | The configuration to merge into this one. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when other is null. |
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Validate
Validates the network configuration.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
deploymentMode | Microsoft.OData.Mcp.Core.Configuration.McpDeploymentMode | The 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.