nat.plugins.mcp.client.client_config#

Classes#

MCPToolOverrideConfig

Configuration for overriding tool properties when exposing from MCP server.

MCPServerConfig

Server connection details for MCP client.

MCPClientBaseConfig

Base configuration shared by MCP client variants.

MCPClientConfig

Configuration for connecting to an MCP server as a client and exposing selected tools.

PerUserMCPClientConfig

MCP Client configuration for per-user workflows that are registered with @register_per_user_function,

Module Contents#

class MCPToolOverrideConfig(/, **data: Any)#

Bases: pydantic.BaseModel

Configuration for overriding tool properties when exposing from MCP server.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

alias: str | None = None#
description: str | None = None#
class MCPServerConfig(/, **data: Any)#

Bases: pydantic.BaseModel

Server connection details for MCP client. Supports stdio, sse, and streamable-http transports. streamable-http is the recommended default for HTTP-based connections.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

transport: Literal['stdio', 'sse', 'streamable-http'] = None#
url: pydantic.HttpUrl | None = None#
command: str | None = None#
args: list[str] | None = None#
env: dict[str, str] | None = None#
auth_provider: str | nat.data_models.component_ref.AuthenticationRef | None = None#
validate_model()#

Validate that stdio and SSE/Streamable HTTP properties are mutually exclusive.

class MCPClientBaseConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionGroupBaseConfig

Base configuration shared by MCP client variants.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

server: MCPServerConfig = None#
tool_call_timeout: datetime.timedelta = None#
auth_flow_timeout: datetime.timedelta = None#
reconnect_enabled: bool = None#
reconnect_max_attempts: int = None#
reconnect_initial_backoff: float = None#
reconnect_max_backoff: float = None#
tool_overrides: dict[str, MCPToolOverrideConfig] | None = None#
_validate_reconnect_backoff() MCPClientBaseConfig#

Validate reconnect backoff values.

class MCPClientConfig(/, **data: Any)#

Bases: MCPClientBaseConfig

Configuration for connecting to an MCP server as a client and exposing selected tools.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

session_aware_tools: bool = None#
max_sessions: int = None#
session_idle_timeout: datetime.timedelta = None#
class PerUserMCPClientConfig(/, **data: Any)#

Bases: MCPClientBaseConfig

MCP Client configuration for per-user workflows that are registered with @register_per_user_function,

and each user gets their own MCP client instance.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.