Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Configuration Inheritance: System.ObjectSyntax
Summary
Configuration for connecting to and interacting with OData services.Remarks
This configuration specifies how the MCP server discovers and communicates with the underlying OData service, including metadata endpoints, authentication, and operational parameters.Constructors
.ctor
Initializes a new instance of the ODataServiceConfiguration class.Syntax
.ctor Inherited
Inherited from
objectSyntax
Properties
Authentication
Gets or sets the authentication configuration for the OData service.Syntax
Property Value
Type:Microsoft.OData.Mcp.Core.Configuration.ODataAuthenticationConfiguration
Configuration for authenticating with the OData service.
Remarks
This configuration specifies how the MCP server authenticates with the underlying OData service when making requests on behalf of users.AutoDiscoverMetadata
Gets or sets a value indicating whether to automatically discover metadata.Syntax
Property Value
Type:bool
true to automatically fetch and parse metadata; otherwise, false.
Remarks
When enabled, the MCP server will automatically fetch metadata from the configured endpoint and generate tools based on the discovered schema.BaseUrl
Gets or sets the base URL of the OData service.Syntax
Property Value
Type:string?
The root URL of the OData service.
Remarks
For sidecar deployments, this is the external URL of the OData service. For middleware deployments, this can be null to use the host application’s base URL.CustomProperties
Gets or sets custom configuration properties.Syntax
Property Value
Type:System.Collections.Generic.Dictionary<string, object>
A dictionary of custom configuration values.
Remarks
Custom properties allow extending the configuration with service-specific settings that don’t fit into the standard configuration properties.DefaultHeaders
Gets or sets the default headers to include in OData requests.Syntax
Property Value
Type:System.Collections.Generic.Dictionary<string, string>
A dictionary of header name-value pairs to include in all requests.
Remarks
These headers will be added to all HTTP requests made to the OData service and can be used for custom authentication, tracing, or service identification.FollowNextLinks
Gets or sets a value indicating whether to follow next links in paged results.Syntax
Property Value
Type:bool
true to automatically follow next links; otherwise, false.
Remarks
When enabled, the MCP server will automatically follow OData next links to retrieve additional pages of results.MaxPages
Gets or sets the maximum number of pages to follow.Syntax
Property Value
Type:int
The maximum number of result pages to retrieve.
Remarks
This setting prevents infinite loops when following next links and limits the total amount of data retrieved in a single operation.MaxPageSize
Gets or sets the maximum page size for query results.Syntax
Property Value
Type:System.Nullable<int>
The maximum number of entities to return in a single query response.
Remarks
This setting helps prevent excessively large responses that could impact performance or memory usage. Set to null for no limit.MaxRetryAttempts
Gets or sets the maximum number of retry attempts for failed requests.Syntax
Property Value
Type:int
The number of retry attempts for failed HTTP requests.
Remarks
When requests to the OData service fail due to transient errors, the MCP server will retry up to this number of times.MetadataPath
Gets or sets the path to the OData metadata endpoint.Syntax
Property Value
Type:string
The relative path to the metadata endpoint (typically ”/$metadata”).
Remarks
This path is appended to the base URL to construct the full metadata endpoint URL. The metadata endpoint must return CSDL (Common Schema Definition Language) XML.RefreshInterval
Gets or sets the interval for refreshing metadata.Syntax
Property Value
Type:System.TimeSpan
The time interval between metadata refresh attempts.
Remarks
The MCP server will periodically refresh metadata to detect schema changes. Set to Zero to disable automatic refresh.RequestTimeout
Gets or sets the timeout for HTTP requests to the OData service.Syntax
Property Value
Type:System.TimeSpan
The maximum time to wait for HTTP responses.
Remarks
This timeout applies to all HTTP requests made to the OData service, including metadata discovery and data operations.RetryDelay
Gets or sets the base delay for retry attempts.Syntax
Property Value
Type:System.TimeSpan
The initial delay before the first retry attempt.
Remarks
Subsequent retries will use exponential backoff based on this initial delay.SupportedODataVersions
Gets or sets the supported OData versions.Syntax
Property Value
Type:System.Collections.Generic.List<string>
A list of OData versions supported by the service.
Remarks
This information helps the MCP server understand which OData features are available and how to construct appropriate requests.UseHostContext
Gets or sets a value indicating whether to use the host application context.Syntax
Property Value
Type:bool
true to use host context for middleware deployments; otherwise, false.
Remarks
When enabled in middleware deployments, the MCP server will use the host application’s HTTP context to make requests to the OData service.ValidateSSL
Gets or sets a value indicating whether to validate SSL certificates.Syntax
Property Value
Type:bool
true to validate SSL certificates; otherwise, false.
Remarks
For development environments, SSL validation can be disabled to work with self-signed certificates. This should always be enabled in production.Methods
AddCustomProperty
Adds a custom property to the configuration.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The property key. |
value | object | The property value. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when key is null or whitespace. |
AddDefaultHeader
Adds a default header to be included in all OData requests.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The header name. |
value | string | The header value. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when name is null or whitespace. |
Clone
Creates a copy of this configuration.Syntax
Returns
Type:Microsoft.OData.Mcp.Core.Configuration.ODataServiceConfiguration
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
GetCustomProperty
Gets a custom property value.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The property key. |
Returns
Type:T?
The property value if found and of the correct type; otherwise, the default value.
Type Parameters
T- The type of the property value.
GetEntitySetUrl
Gets the full URL for an OData entity set.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySetName | string | The name of the entity set. |
hostBaseUrl | string? | The host base URL for middleware deployments. |
Returns
Type:string
The complete URL to the entity set.
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when entitySetName is null or whitespace. |
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetMetadataUrl
Gets the full metadata URL for the OData service.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
hostBaseUrl | string? | The host base URL for middleware deployments. |
Returns
Type:string
The complete URL to the metadata endpoint.
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.ODataServiceConfiguration | 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
RemoveDefaultHeader
Removes a default header.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The header name to remove. |
Returns
Type:bool
true if the header was removed; otherwise, false.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Validate
Validates the OData service 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.