Coverage for src / mcp_server_langgraph / execution / __init__.py: 62%

16 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-03 00:43 +0000

1""" 

2Code execution module for MCP server 

3 

4Provides secure sandboxed code execution with resource limits and security controls. 

5""" 

6 

7from mcp_server_langgraph.execution.code_validator import CodeValidationError, CodeValidator, ValidationResult 

8from mcp_server_langgraph.execution.resource_limits import ResourceLimitError, ResourceLimits 

9from mcp_server_langgraph.execution.sandbox import ExecutionResult, Sandbox, SandboxError 

10 

11# Optional: KubernetesSandbox requires kubernetes package 

12# Import conditionally to avoid failures when kubernetes is not installed 

13try: 

14 from mcp_server_langgraph.execution.kubernetes_sandbox import KubernetesSandbox 

15 

16 _KUBERNETES_AVAILABLE = True 

17except ImportError: 

18 KubernetesSandbox = None # type: ignore 

19 _KUBERNETES_AVAILABLE = False 

20 

21# Optional: DockerSandbox requires docker package 

22# Import conditionally to avoid failures when docker is not installed 

23try: 

24 from mcp_server_langgraph.execution.docker_sandbox import DockerSandbox 

25 

26 _DOCKER_AVAILABLE = True 

27except ImportError: 

28 DockerSandbox = None # type: ignore 

29 _DOCKER_AVAILABLE = False 

30 

31__all__ = [ 

32 "CodeValidationError", 

33 "CodeValidator", 

34 "DockerSandbox", 

35 "ExecutionResult", 

36 "KubernetesSandbox", 

37 "ResourceLimitError", 

38 "ResourceLimits", 

39 "Sandbox", 

40 "SandboxError", 

41 "ValidationResult", 

42]