diff options
| author | Kevin King <[email protected]> | 2025-10-28 19:32:45 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-28 18:32:45 -0500 |
| commit | 0e60f666043910afb96e9de2f84b0b8a68c7e4d6 (patch) | |
| tree | 6ca20af712e2faca6262f029d6d8499c9888eb50 /packages/sdk/python/src/opencode_ai/models/mcp_local_config.py | |
| parent | fc8db6cdf9cb81e29c5dda69c8646aa52e453a9c (diff) | |
| download | opencode-0e60f666043910afb96e9de2f84b0b8a68c7e4d6.tar.gz opencode-0e60f666043910afb96e9de2f84b0b8a68c7e4d6.zip | |
ignore: python sdk (#2779)
Co-authored-by: Aiden Cline <[email protected]>
Diffstat (limited to 'packages/sdk/python/src/opencode_ai/models/mcp_local_config.py')
| -rw-r--r-- | packages/sdk/python/src/opencode_ai/models/mcp_local_config.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/packages/sdk/python/src/opencode_ai/models/mcp_local_config.py b/packages/sdk/python/src/opencode_ai/models/mcp_local_config.py new file mode 100644 index 000000000..ccaf813c3 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/models/mcp_local_config.py @@ -0,0 +1,83 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.mcp_local_config_environment import McpLocalConfigEnvironment + + +T = TypeVar("T", bound="McpLocalConfig") + + +@_attrs_define +class McpLocalConfig: + """ + Attributes: + type_ (Literal['local']): Type of MCP server connection + command (list[str]): Command and arguments to run the MCP server + environment (Union[Unset, McpLocalConfigEnvironment]): Environment variables to set when running the MCP server + enabled (Union[Unset, bool]): Enable or disable the MCP server on startup + """ + + type_: Literal["local"] + command: list[str] + environment: Union[Unset, "McpLocalConfigEnvironment"] = UNSET + enabled: Union[Unset, bool] = UNSET + + def to_dict(self) -> dict[str, Any]: + type_ = self.type_ + + command = self.command + + environment: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.environment, Unset): + environment = self.environment.to_dict() + + enabled = self.enabled + + field_dict: dict[str, Any] = {} + + field_dict.update( + { + "type": type_, + "command": command, + } + ) + if environment is not UNSET: + field_dict["environment"] = environment + if enabled is not UNSET: + field_dict["enabled"] = enabled + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.mcp_local_config_environment import McpLocalConfigEnvironment + + d = dict(src_dict) + type_ = cast(Literal["local"], d.pop("type")) + if type_ != "local": + raise ValueError(f"type must match const 'local', got '{type_}'") + + command = cast(list[str], d.pop("command")) + + _environment = d.pop("environment", UNSET) + environment: Union[Unset, McpLocalConfigEnvironment] + if isinstance(_environment, Unset): + environment = UNSET + else: + environment = McpLocalConfigEnvironment.from_dict(_environment) + + enabled = d.pop("enabled", UNSET) + + mcp_local_config = cls( + type_=type_, + command=command, + environment=environment, + enabled=enabled, + ) + + return mcp_local_config |
