iflow-mcp_modelcontextinterface-mcix 1.1.1.dev0__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.
Files changed (42) hide show
  1. iflow_mcp_modelcontextinterface_mcix-1.1.1.dev0.dist-info/METADATA +931 -0
  2. iflow_mcp_modelcontextinterface_mcix-1.1.1.dev0.dist-info/RECORD +42 -0
  3. iflow_mcp_modelcontextinterface_mcix-1.1.1.dev0.dist-info/WHEEL +4 -0
  4. iflow_mcp_modelcontextinterface_mcix-1.1.1.dev0.dist-info/entry_points.txt +2 -0
  5. iflow_mcp_modelcontextinterface_mcix-1.1.1.dev0.dist-info/licenses/LICENSE +21 -0
  6. mci/__init__.py +10 -0
  7. mci/assets/example_toolset.mci.json +37 -0
  8. mci/assets/example_toolset.mci.yaml +23 -0
  9. mci/assets/gitignore +1 -0
  10. mci/assets/mci.json +29 -0
  11. mci/assets/mci.yaml +19 -0
  12. mci/cli/__init__.py +8 -0
  13. mci/cli/add.py +108 -0
  14. mci/cli/envs.py +257 -0
  15. mci/cli/formatters/__init__.py +12 -0
  16. mci/cli/formatters/env_formatter.py +83 -0
  17. mci/cli/formatters/json_formatter.py +93 -0
  18. mci/cli/formatters/table_formatter.py +138 -0
  19. mci/cli/formatters/yaml_formatter.py +93 -0
  20. mci/cli/install.py +147 -0
  21. mci/cli/list.py +153 -0
  22. mci/cli/run.py +125 -0
  23. mci/cli/validate.py +113 -0
  24. mci/core/__init__.py +8 -0
  25. mci/core/config.py +144 -0
  26. mci/core/dynamic_server.py +187 -0
  27. mci/core/file_finder.py +105 -0
  28. mci/core/mci_client.py +196 -0
  29. mci/core/mcp_server.py +240 -0
  30. mci/core/schema_editor.py +284 -0
  31. mci/core/tool_converter.py +119 -0
  32. mci/core/tool_manager.py +118 -0
  33. mci/core/validator.py +162 -0
  34. mci/mci.py +39 -0
  35. mci/py.typed +0 -0
  36. mci/utils/__init__.py +8 -0
  37. mci/utils/dotenv.py +170 -0
  38. mci/utils/env_scanner.py +84 -0
  39. mci/utils/error_formatter.py +165 -0
  40. mci/utils/error_handler.py +174 -0
  41. mci/utils/timestamp.py +50 -0
  42. mci/utils/validation.py +92 -0
@@ -0,0 +1,92 @@
1
+ """
2
+ validation.py - File validation utilities for MCI
3
+
4
+ This module provides utility functions for file validation,
5
+ including file existence checks, format detection, and path validation.
6
+ """
7
+
8
+ import os
9
+ from pathlib import Path
10
+
11
+
12
+ def is_valid_path(path: str) -> bool:
13
+ """
14
+ Check if a path is valid and accessible.
15
+
16
+ Args:
17
+ path: The path to validate
18
+
19
+ Returns:
20
+ True if the path is valid, False otherwise
21
+
22
+ Example:
23
+ >>> is_valid_path("./mci.json")
24
+ True
25
+ >>> is_valid_path("")
26
+ False
27
+ """
28
+ if not path:
29
+ return False
30
+
31
+ try:
32
+ Path(path)
33
+ return True
34
+ except (ValueError, TypeError):
35
+ return False
36
+
37
+
38
+ def file_exists(path: str) -> bool:
39
+ """
40
+ Check if a file exists at the given path.
41
+
42
+ Args:
43
+ path: The file path to check
44
+
45
+ Returns:
46
+ True if the file exists and is a file, False otherwise
47
+
48
+ Example:
49
+ >>> file_exists("./mci.json")
50
+ True
51
+ """
52
+ try:
53
+ return Path(path).is_file()
54
+ except (OSError, ValueError):
55
+ return False
56
+
57
+
58
+ def is_readable(path: str) -> bool:
59
+ """
60
+ Check if a file is readable.
61
+
62
+ Args:
63
+ path: The file path to check
64
+
65
+ Returns:
66
+ True if the file is readable, False otherwise
67
+
68
+ Example:
69
+ >>> is_readable("./mci.json")
70
+ True
71
+ """
72
+ try:
73
+ return os.access(path, os.R_OK)
74
+ except (OSError, ValueError, TypeError):
75
+ return False
76
+
77
+
78
+ def get_absolute_path(path: str) -> str:
79
+ """
80
+ Get the absolute path from a relative or absolute path.
81
+
82
+ Args:
83
+ path: The path to resolve
84
+
85
+ Returns:
86
+ The absolute path
87
+
88
+ Example:
89
+ >>> get_absolute_path("./mci.json")
90
+ '/path/to/current/dir/mci.json'
91
+ """
92
+ return str(Path(path).resolve())