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.IpRestrictionConfiguration

Summary

Configuration for IP address restrictions and access control.

Remarks

IP restriction configuration allows controlling access to the MCP server based on client IP addresses. This provides an additional security layer by allowing or blocking requests from specific IP ranges.

Constructors

.ctor

Syntax

public IpRestrictionConfiguration()

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

AllowedIpRanges

Gets or sets the list of allowed IP address ranges.

Syntax

public System.Collections.Generic.List<string> AllowedIpRanges { get; set; }

Property Value

Type: System.Collections.Generic.List<string> A collection of IP ranges in CIDR notation that are allowed access.

Remarks

IP ranges should be specified in CIDR notation (e.g., “192.168.1.0/24”). Individual IP addresses can be specified with /32 suffix (e.g., “192.168.1.100/32”).

BlockedIpRanges

Gets or sets the list of blocked IP address ranges.

Syntax

public System.Collections.Generic.List<string> BlockedIpRanges { get; set; }

Property Value

Type: System.Collections.Generic.List<string> A collection of IP ranges in CIDR notation that are blocked from access.

Remarks

Blocked IP ranges take precedence over allowed ranges. If an IP address matches both an allowed and blocked range, access will be denied.

Enabled

Gets or sets a value indicating whether IP restrictions are enabled.

Syntax

public bool Enabled { get; set; }

Property Value

Type: bool true to enable IP restrictions; otherwise, false.

Remarks

When enabled, only requests from allowed IP ranges will be accepted, and requests from blocked IP ranges will be rejected.

Methods

Clone

Creates a copy of this IP restriction configuration.

Syntax

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

Returns

Type: Microsoft.OData.Mcp.Core.Configuration.IpRestrictionConfiguration 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

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 IP restriction configuration into this one.

Syntax

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

Parameters

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

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 IP restriction configuration.

Syntax

public System.Collections.Generic.IEnumerable<string> Validate()

Returns

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