mcp-virtual-computer 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kilntainers/__init__.py +3 -0
- kilntainers/__main__.py +6 -0
- kilntainers/auth.py +34 -0
- kilntainers/backends/__init__.py +17 -0
- kilntainers/backends/base.py +380 -0
- kilntainers/backends/docker.py +1498 -0
- kilntainers/backends/test___init__.py +37 -0
- kilntainers/backends/test_base.py +355 -0
- kilntainers/backends/test_docker.py +841 -0
- kilntainers/backends/test_docker_integration.py +310 -0
- kilntainers/backends/test_docker_management.py +122 -0
- kilntainers/backends/test_utils.py +152 -0
- kilntainers/backends/test_virtual_docker.py +387 -0
- kilntainers/cli.py +375 -0
- kilntainers/computers.py +284 -0
- kilntainers/config.py +71 -0
- kilntainers/dashboard.html +4263 -0
- kilntainers/dashboard.py +23 -0
- kilntainers/desktop.py +47 -0
- kilntainers/desktop_control.py +105 -0
- kilntainers/desktop_image/Dockerfile +67 -0
- kilntainers/desktop_image/desktop-control.py +661 -0
- kilntainers/desktop_image/start-desktop.sh +206 -0
- kilntainers/desktop_image/visual-action.py +185 -0
- kilntainers/desktop_image/wsproxy.py +218 -0
- kilntainers/errors.py +36 -0
- kilntainers/file_tools.py +320 -0
- kilntainers/server.py +1760 -0
- kilntainers/test_cli.py +704 -0
- kilntainers/test_cli_integration.py +213 -0
- kilntainers/test_computers.py +122 -0
- kilntainers/test_config.py +135 -0
- kilntainers/test_dashboard.py +113 -0
- kilntainers/test_desktop_control.py +109 -0
- kilntainers/test_e2e_mcp.py +310 -0
- kilntainers/test_errors.py +62 -0
- kilntainers/test_file_tools.py +175 -0
- kilntainers/test_http_lifecycle.py +353 -0
- kilntainers/test_lifecycle_integration.py +389 -0
- kilntainers/test_server.py +849 -0
- kilntainers/test_windows_docker.py +300 -0
- kilntainers/windows_docker.py +565 -0
- mcp_virtual_computer-0.2.3.dist-info/METADATA +179 -0
- mcp_virtual_computer-0.2.3.dist-info/RECORD +48 -0
- mcp_virtual_computer-0.2.3.dist-info/WHEEL +5 -0
- mcp_virtual_computer-0.2.3.dist-info/entry_points.txt +5 -0
- mcp_virtual_computer-0.2.3.dist-info/licenses/LICENSE +7 -0
- mcp_virtual_computer-0.2.3.dist-info/top_level.txt +1 -0
kilntainers/config.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Configuration dataclasses for the single-computer Docker server."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
Transport = Literal["stdio", "http"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def env_flag(name: str, *, default: bool = False) -> bool:
|
|
11
|
+
"""Read a strict, human-friendly boolean environment variable."""
|
|
12
|
+
value = os.getenv(name)
|
|
13
|
+
if value is None:
|
|
14
|
+
return default
|
|
15
|
+
normalized = value.strip().casefold()
|
|
16
|
+
if normalized in {"1", "true", "yes", "on"}:
|
|
17
|
+
return True
|
|
18
|
+
if normalized in {"0", "false", "no", "off"}:
|
|
19
|
+
return False
|
|
20
|
+
raise ValueError(
|
|
21
|
+
f"{name} must be one of true/false, 1/0, yes/no, or on/off; got {value!r}"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True, slots=True, kw_only=True)
|
|
26
|
+
class BackendConfig:
|
|
27
|
+
"""Base class for all backend configurations.
|
|
28
|
+
|
|
29
|
+
Contains fields shared across all backends. Backend-specific
|
|
30
|
+
config classes inherit from this.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# Passed through for tool description generation
|
|
34
|
+
default_timeout: int = 120
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True, slots=True, kw_only=True)
|
|
38
|
+
class ServerConfig:
|
|
39
|
+
"""Core server configuration from CLI arguments.
|
|
40
|
+
|
|
41
|
+
Consumed by the MCP server layer (Phase 4) and the startup
|
|
42
|
+
orchestration logic. Does not contain backend-specific config.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
# Transport
|
|
46
|
+
transport: Transport = "stdio"
|
|
47
|
+
host: str = "127.0.0.1" # HTTP bind address
|
|
48
|
+
port: int = 8435 # HTTP listen port
|
|
49
|
+
|
|
50
|
+
# Exec defaults
|
|
51
|
+
default_timeout: int = 120 # seconds
|
|
52
|
+
output_limit: int = 2_097_152 # bytes (2 MiB)
|
|
53
|
+
file_text_limit: int = 1_048_576 # bytes (1 MiB)
|
|
54
|
+
workspace_directory: str = "/workspace"
|
|
55
|
+
|
|
56
|
+
# A server process owns exactly one persistent computer. The CLI replaces
|
|
57
|
+
# this programmatic default with the required COMPUTER_ID environment value.
|
|
58
|
+
computer_id: str = "virtual-computer"
|
|
59
|
+
desktop_environment: bool = False
|
|
60
|
+
network_access: bool = True
|
|
61
|
+
|
|
62
|
+
# Tool description
|
|
63
|
+
tool_instruction_override: str | None = None
|
|
64
|
+
extended_tool_instruction: str | None = None
|
|
65
|
+
|
|
66
|
+
# Session management (HTTP only)
|
|
67
|
+
session_timeout: int = 300 # seconds (5 minutes)
|
|
68
|
+
|
|
69
|
+
# Remote HTTP protection
|
|
70
|
+
auth_token: str | None = None
|
|
71
|
+
allow_unauthenticated_http: bool = False
|