@iaforged/context-code 2.3.3 → 2.3.6

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 (89) hide show
  1. package/context-bootstrap.js +7 -5
  2. package/dist/src/cli/handlers/auth.js +1 -1
  3. package/dist/src/cli/handlers/modelList.js +1 -1
  4. package/dist/src/commands/agent/agent.js +1 -1
  5. package/dist/src/commands/login/login.js +1 -1
  6. package/dist/src/commands/profile/profile.js +1 -1
  7. package/dist/src/commands/provider/index.js +1 -1
  8. package/dist/src/commands/provider/provider.js +1 -1
  9. package/dist/src/components/BaseTextInput.js +1 -1
  10. package/dist/src/components/LogoV2/AnimatedClawd.js +1 -1
  11. package/dist/src/components/LogoV2/Clawd.js +1 -1
  12. package/dist/src/components/LogoV2/LogoV2.js +1 -1
  13. package/dist/src/components/LogoV2/WelcomeV2.js +1 -1
  14. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +1 -1
  15. package/dist/src/components/SessionTokenFooter.js +1 -1
  16. package/dist/src/components/Spinner.js +1 -1
  17. package/dist/src/components/Stats.js +1 -1
  18. package/dist/src/components/TeleportProgress.js +1 -1
  19. package/dist/src/components/TextInput.js +1 -1
  20. package/dist/src/components/design-system/ThemeProvider.js +1 -1
  21. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +1 -1
  22. package/dist/src/core/auth/loginCore.js +1 -1
  23. package/dist/src/core/providers/llmCore.js +1 -1
  24. package/dist/src/core/providers/providerModelCompatibility.js +1 -1
  25. package/dist/src/main.js +1 -1
  26. package/dist/src/query/stopHooks.js +1 -1
  27. package/dist/src/screens/REPL.js +1 -1
  28. package/dist/src/services/PromptSuggestion/promptSuggestion.js +1 -1
  29. package/dist/src/services/analytics/config.js +1 -1
  30. package/dist/src/services/analytics/datadog.js +1 -1
  31. package/dist/src/services/api/openai.js +1 -1
  32. package/dist/src/services/mcp/config.js +1 -1
  33. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +1 -1
  34. package/dist/src/services/tips/tipRegistry.js +1 -1
  35. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +1 -1
  36. package/dist/src/tools/BriefTool/UI.js +1 -1
  37. package/dist/src/utils/computerControlMcp/mcpServer.js +1 -1
  38. package/dist/src/utils/computerControlMcp/server/.gitattributes +18 -0
  39. package/dist/src/utils/computerControlMcp/server/Dockerfile +25 -0
  40. package/dist/src/utils/computerControlMcp/server/LICENSE +21 -0
  41. package/dist/src/utils/computerControlMcp/server/MANIFEST.in +10 -0
  42. package/dist/src/utils/computerControlMcp/server/README.md +193 -0
  43. package/dist/src/utils/computerControlMcp/server/demonstration.gif +0 -0
  44. package/dist/src/utils/computerControlMcp/server/icon.png +0 -0
  45. package/dist/src/utils/computerControlMcp/server/pyproject.toml +52 -0
  46. package/dist/src/utils/computerControlMcp/server/smithery.yaml +13 -0
  47. package/dist/src/utils/computerControlMcp/server/src/README.md +12 -0
  48. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/FZYTK.TTF +0 -0
  49. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/__init__.py +11 -0
  50. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/__main__.py +21 -0
  51. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/cli.py +128 -0
  52. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/core.py +1008 -0
  53. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/gui.py +126 -0
  54. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/server.py +15 -0
  55. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/test.py +346 -0
  56. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/test_image.png +0 -0
  57. package/dist/src/utils/computerControlMcp/server/tests/README.md +22 -0
  58. package/dist/src/utils/computerControlMcp/server/tests/conftest.py +10 -0
  59. package/dist/src/utils/computerControlMcp/server/tests/rapidocr_test.py +21 -0
  60. package/dist/src/utils/computerControlMcp/server/tests/run_cli.py +9 -0
  61. package/dist/src/utils/computerControlMcp/server/tests/run_server.py +15 -0
  62. package/dist/src/utils/computerControlMcp/server/tests/setup.py +16 -0
  63. package/dist/src/utils/computerControlMcp/server/tests/test_computer_control.py +161 -0
  64. package/dist/src/utils/computerControlMcp/server/tests/test_screenshot.py +14 -0
  65. package/dist/src/utils/computerControlMcp/server/tests/test_wgc_env_var.py +42 -0
  66. package/dist/src/utils/computerControlMcp/server/tests/test_wgc_screenshot.py +67 -0
  67. package/dist/src/utils/computerControlMcp/server/uv.lock +4986 -0
  68. package/dist/src/utils/computerControlMcp/setup.js +1 -1
  69. package/dist/src/utils/logoV2Utils.js +1 -1
  70. package/dist/src/utils/model/configs.js +1 -1
  71. package/dist/src/utils/model/model.js +1 -1
  72. package/dist/src/utils/model/modelOptions.js +1 -1
  73. package/dist/src/utils/model/providerBaseUrls.js +1 -1
  74. package/dist/src/utils/model/providerCatalog.js +1 -1
  75. package/dist/src/utils/model/providerModels.js +1 -1
  76. package/dist/src/utils/model/providerProfiles.js +1 -1
  77. package/dist/src/utils/model/providerProfilesDb.js +1 -1
  78. package/dist/src/utils/sembleMcp/setup.js +1 -1
  79. package/dist/src/utils/status.js +1 -1
  80. package/dist/src/utils/theme.js +1 -1
  81. package/dist/src/utils/themes/bootstrap.js +1 -1
  82. package/dist/src/utils/themes/opencodeMapper.js +1 -1
  83. package/dist/webapp/chunk-OJZNEHPP.js +1 -1
  84. package/dist/webapp/chunk-VAB2VXFI.js +1 -1
  85. package/dist/webapp/main-MTQLKGXD.js +1 -1
  86. package/dist/webapp/ngsw-worker.js +1 -1
  87. package/dist/webapp/ngsw.json +1 -1
  88. package/dist/webapp/polyfills-7R4CRVNH.js +1 -1
  89. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ # Computer Control MCP
2
+
3
+ ### MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. Similar to 'computer-use' by Anthropic. With Zero External Dependencies.
4
+
5
+ <div align="center" style="text-align:center;font-family: monospace; display: flex; align-items: center; justify-content: center; width: 100%; gap: 10px">
6
+ <a href="https://nextjs-boilerplate-ashy-nine-64.vercel.app/demo-computer-control"><img
7
+ src="https://komarev.com/ghpvc/?username=AB498&label=DEMO&style=for-the-badge&color=CC0000" /></a>
8
+ <a href="https://discord.gg/ZeeqSBpjU2"><img
9
+ src="https://img.shields.io/discord/1095854826786668545?style=for-the-badge&color=0000CC" alt="Discord"></a>
10
+ <a href="https://img.shields.io/badge/License-MIT-yellow.svg"><img
11
+ src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge&color=00CC00" alt="License: MIT"></a>
12
+ <a href="https://pypi.org/project/computer-control-mcp"><img
13
+ src="https://img.shields.io/pypi/v/computer-control-mcp?style=for-the-badge" alt="PyPi"></a>
14
+ </div>
15
+
16
+ ---
17
+
18
+ ![MCP Computer Control Demo](https://github.com/AB498/computer-control-mcp/blob/main/demonstration.gif?raw=true)
19
+
20
+ ## Quick Usage (MCP Setup Using `uvx`)
21
+
22
+ ***Note:** Running `uvx computer-control-mcp@latest` for the first time will download python dependencies (around 70MB) which may take some time. Recommended to run this in a terminal before using it as MCP. Subsequent runs will be instant.*
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "computer-control-mcp": {
28
+ "command": "uvx",
29
+ "args": ["computer-control-mcp@latest"]
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ OR install globally with `pip`:
36
+ ```bash
37
+ pip install computer-control-mcp
38
+ ```
39
+ Then run the server with:
40
+ ```bash
41
+ computer-control-mcp # instead of uvx computer-control-mcp, so you can use the latest version, also you can `uv cache clean` to clear the cache and `uvx` again to use latest version.
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - Control mouse movements and clicks
47
+ - Type text at the current cursor position
48
+ - Take screenshots of the entire screen or specific windows with optional saving to downloads directory
49
+ - Extract text from screenshots using OCR (Optical Character Recognition)
50
+ - List and activate windows
51
+ - Press keyboard keys
52
+ - Drag and drop operations
53
+ - Enhanced screenshot capture for GPU-accelerated windows (Windows only)
54
+
55
+ ## Note on GPU-accelerated Windows
56
+
57
+ Traditional screenshot methods like GDI/PrintWindow fail to capture GPU-accelerated windows, resulting in black screens. This impacts games, media players, Electron apps, browsers with GPU acceleration, streaming software, and CAD tools. Use WGC through `take_screenshot` tool's flag or `ENV` variable
58
+
59
+ ## Configuration
60
+
61
+ ### Custom Screenshot Directory
62
+
63
+ By default, screenshots are saved to the OS downloads directory. You can customize this by setting the `COMPUTER_CONTROL_MCP_SCREENSHOT_DIR` environment variable:
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "computer-control-mcp": {
69
+ "command": "uvx",
70
+ "args": ["computer-control-mcp@latest"],
71
+ "env": {
72
+ "COMPUTER_CONTROL_MCP_SCREENSHOT_DIR": "C:\\Users\\YourName\\Pictures\\Screenshots"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Or set it system-wide:
80
+ ```bash
81
+ # Windows (PowerShell)
82
+ $env:COMPUTER_CONTROL_MCP_SCREENSHOT_DIR = "C:\Users\YourName\Pictures\Screenshots"
83
+
84
+ # macOS/Linux
85
+ export COMPUTER_CONTROL_MCP_SCREENSHOT_DIR="/home/yourname/Pictures/Screenshots"
86
+ ```
87
+
88
+ If the specified directory doesn't exist, the server will fall back to the default downloads directory.
89
+
90
+ ### Automatic WGC for Specific Windows
91
+
92
+ You can configure the system to automatically use Windows Graphics Capture (WGC) for specific windows by setting the `COMPUTER_CONTROL_MCP_WGC_PATTERNS` environment variable. This variable should contain comma-separated patterns that match window titles:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "computer-control-mcp": {
98
+ "command": "uvx",
99
+ "args": ["computer-control-mcp@latest"],
100
+ "env": {
101
+ "COMPUTER_CONTROL_MCP_WGC_PATTERNS": "obs, discord, game, steam"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ Or set it system-wide:
109
+ ```bash
110
+ # Windows (PowerShell)
111
+ $env:COMPUTER_CONTROL_MCP_WGC_PATTERNS = "obs, discord, game, steam"
112
+
113
+ # macOS/Linux
114
+ export COMPUTER_CONTROL_MCP_WGC_PATTERNS="obs, discord, game, steam"
115
+ ```
116
+
117
+ When this variable is set, any window whose title contains any of the specified patterns will automatically use WGC for screenshot capture, eliminating black screens for GPU-accelerated applications.
118
+
119
+ ## Available Tools
120
+
121
+ ### Mouse Control
122
+ - `click_screen(x: int, y: int)`: Click at specified screen coordinates
123
+ - `move_mouse(x: int, y: int)`: Move mouse cursor to specified coordinates
124
+ - `drag_mouse(from_x: int, from_y: int, to_x: int, to_y: int, duration: float = 0.5)`: Drag mouse from one position to another
125
+ - `mouse_down(button: str = "left")`: Hold down a mouse button ('left', 'right', 'middle')
126
+ - `mouse_up(button: str = "left")`: Release a mouse button ('left', 'right', 'middle')
127
+
128
+ ### Keyboard Control
129
+ - `type_text(text: str)`: Type the specified text at current cursor position
130
+ - `press_key(key: str)`: Press a specified keyboard key
131
+ - `key_down(key: str)`: Hold down a specific keyboard key until released
132
+ - `key_up(key: str)`: Release a specific keyboard key
133
+ - `press_keys(keys: Union[str, List[Union[str, List[str]]]])`: Press keyboard keys (supports single keys, sequences, and combinations)
134
+
135
+ ### Screen and Window Management
136
+ - `take_screenshot(title_pattern: str = None, use_regex: bool = False, threshold: int = 60, scale_percent_for_ocr: int = None, save_to_downloads: bool = False, use_wgc: bool = False)`: Capture screen or window
137
+ - `take_screenshot_with_ocr(title_pattern: str = None, use_regex: bool = False, threshold: int = 10, scale_percent_for_ocr: int = None, save_to_downloads: bool = False)`: Extract adn return text with coordinates using OCR from screen or window
138
+ - `get_screen_size()`: Get current screen resolution
139
+ - `list_windows()`: List all open windows
140
+ - `activate_window(title_pattern: str, use_regex: bool = False, threshold: int = 60)`: Bring specified window to foreground
141
+ - `wait_milliseconds(milliseconds: int)`: Wait for a specified number of milliseconds
142
+
143
+ ## Development
144
+
145
+ ### Setting up the Development Environment
146
+
147
+ ```bash
148
+ # Clone the repository
149
+ git clone https://github.com/AB498/computer-control-mcp.git
150
+ cd computer-control-mcp
151
+
152
+ # Build/Run:
153
+
154
+ # 1. Install in development mode | Meaning that your edits to source code will be reflected in the installed package.
155
+ pip install -e .
156
+
157
+ # Then Start server | This is equivalent to `uvx computer-control-mcp@latest` just the local code is used
158
+ computer-control-mcp
159
+
160
+ # -- OR --
161
+
162
+ # 2. Build after `pip install hatch` | This needs version increment in orer to reflect code changes
163
+ hatch build
164
+
165
+ # Windows
166
+ $latest = Get-ChildItem .\dist\*.whl | Sort-Object LastWriteTime -Descending | Select-Object -First 1
167
+ pip install $latest.FullName --upgrade
168
+
169
+ # Non-windows
170
+ pip install dist/*.whl --upgrade
171
+
172
+ # Run
173
+ computer-control-mcp
174
+ ```
175
+
176
+ ### Running Tests
177
+
178
+ ```bash
179
+ python -m pytest
180
+ ```
181
+
182
+ ## API Reference
183
+
184
+ See the [API Reference](docs/api.md) for detailed information about the available functions and classes.
185
+
186
+ ## License
187
+
188
+ MIT
189
+
190
+ ## For more information or help
191
+
192
+ - [Email (abcd49800@gmail.com)](mailto:abcd49800@gmail.com)
193
+ - [Discord (CodePlayground)](https://discord.gg/ZeeqSBpjU2)
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "computer-control-mcp"
7
+ version = "0.3.10"
8
+ description = "MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. Similar to 'computer-use' by Anthropic. With Zero External Dependencies."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [{name = "AB498", email = "abcd49800@gmail.com"}]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Topic :: Software Development :: Libraries",
20
+ "Topic :: Utilities"
21
+ ]
22
+ dependencies = [
23
+ "pyautogui==0.9.54",
24
+ "mcp[cli]==1.13.0",
25
+ "pillow==11.3.0",
26
+ "pygetwindow==0.0.9; sys_platform=='win32'",
27
+ "pywinctl==0.4.1",
28
+ "fuzzywuzzy==0.18.0",
29
+ "rapidocr==3.3.1",
30
+ "onnxruntime==1.22.0",
31
+ "rapidocr_onnxruntime==1.2.3",
32
+ "opencv-python==4.12.0.88",
33
+ "python-Levenshtein>=0.20.9",
34
+ "mss>=7.0.0",
35
+ "windows-capture>=1.0.0; sys_platform=='win32'"
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/AB498/computer-control-mcp"
40
+ Issues = "https://github.com/AB498/computer-control-mcp/issues"
41
+ Documentation = "https://github.com/AB498/computer-control-mcp#readme"
42
+
43
+ [project.scripts]
44
+ computer-control-mcp = "computer_control_mcp.cli:main"
45
+ computer-control-mcp-server = "computer_control_mcp.server:main"
46
+
47
+ [tool.hatch.build]
48
+ sources = ["src"]
49
+ packages = ["src/computer_control_mcp"]
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/computer_control_mcp"]
@@ -0,0 +1,13 @@
1
+ # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
2
+
3
+ startCommand:
4
+ type: stdio
5
+ configSchema:
6
+ # JSON Schema defining the configuration options for the MCP.
7
+ type: object
8
+ description: Empty config
9
+ commandFunction:
10
+ # A JS function that produces the CLI command based on the given config to start the MCP on stdio.
11
+ |-
12
+ (config) => ({ command: 'python', args: ['src/computer_control_mcp/core.py'] })
13
+ exampleConfig: {}
@@ -0,0 +1,12 @@
1
+ # Computer Control MCP Source Code
2
+
3
+ This directory contains the source code for the Computer Control MCP package.
4
+
5
+ ## Structure
6
+
7
+ - `computer_control_mcp/`: Main package directory
8
+ - `__init__.py`: Package initialization
9
+ - `__main__.py`: Entry point for running as a module
10
+ - `core.py`: Core functionality
11
+ - `cli.py`: Command-line interface
12
+ - `gui.py`: Graphical user interface for testing
@@ -0,0 +1,11 @@
1
+ """
2
+ Computer Control MCP - Python package for computer control via MCP.
3
+
4
+ This package provides computer control capabilities using PyAutoGUI through a
5
+ Model Context Protocol (MCP) server.
6
+ """
7
+
8
+ from computer_control_mcp.core import mcp, main
9
+
10
+ __version__ = "0.1.2"
11
+ __all__ = ["mcp", "main"]
@@ -0,0 +1,21 @@
1
+ """
2
+ Entry point for running the Computer Control MCP as a module.
3
+
4
+ This module serves as the main entry point for the package.
5
+ When executed directly (e.g., with `python -m computer_control_mcp`),
6
+ it will run the CLI interface.
7
+
8
+ For CLI functionality, use:
9
+ computer-control-mcp <command>
10
+ python -m computer_control_mcp <command>
11
+ """
12
+
13
+ from computer_control_mcp.cli import main as cli_main
14
+
15
+ def main():
16
+ """Main entry point for the package."""
17
+ # Run the CLI when the module is executed directly
18
+ cli_main()
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,128 @@
1
+ """
2
+ Command-line interface for Computer Control MCP.
3
+
4
+ This module provides a command-line interface for interacting with the Computer Control MCP.
5
+ """
6
+
7
+ import argparse
8
+ import sys
9
+ from computer_control_mcp.core import mcp, main as run_server
10
+
11
+ def parse_args():
12
+ """Parse command-line arguments."""
13
+ parser = argparse.ArgumentParser(description="Computer Control MCP CLI")
14
+
15
+ subparsers = parser.add_subparsers(dest="command", help="Command to run")
16
+
17
+ # Server command
18
+ server_parser = subparsers.add_parser("server", help="Run the MCP server")
19
+
20
+ # Click command
21
+ click_parser = subparsers.add_parser("click", help="Click at specified coordinates")
22
+ click_parser.add_argument("x", type=int, help="X coordinate")
23
+ click_parser.add_argument("y", type=int, help="Y coordinate")
24
+
25
+ # Type text command
26
+ type_parser = subparsers.add_parser("type", help="Type text at current cursor position")
27
+ type_parser.add_argument("text", help="Text to type")
28
+
29
+ # Screenshot command
30
+ screenshot_parser = subparsers.add_parser("screenshot", help="Take a screenshot")
31
+ screenshot_parser.add_argument("--mode", choices=["all_windows", "single_window", "whole_screen"],
32
+ default="whole_screen", help="Screenshot mode")
33
+ screenshot_parser.add_argument("--title", help="Window title pattern (for single_window mode)")
34
+ screenshot_parser.add_argument("--regex", action="store_true", help="Use regex for title matching")
35
+ screenshot_parser.add_argument("--output", help="Output file path (if not provided, saves to downloads directory)")
36
+ screenshot_parser.add_argument("--no-save", action="store_true", help="Don't save images to downloads directory")
37
+
38
+ # List windows command
39
+ subparsers.add_parser("list-windows", help="List all open windows")
40
+
41
+ # GUI command
42
+ subparsers.add_parser("gui", help="Launch the GUI test harness")
43
+
44
+ return parser.parse_args()
45
+
46
+ def main():
47
+ """Main entry point for the CLI."""
48
+ args = parse_args()
49
+
50
+ if args.command == "server":
51
+ run_server()
52
+
53
+ elif args.command == "click":
54
+ # Call the tool using the call_tool method
55
+ import asyncio
56
+ result = asyncio.run(mcp.call_tool("click_screen", {"x": args.x, "y": args.y}))
57
+ print(result)
58
+
59
+ elif args.command == "type":
60
+ # Call the tool using the call_tool method
61
+ import asyncio
62
+ result = asyncio.run(mcp.call_tool("type_text", {"text": args.text}))
63
+ print(result)
64
+
65
+ elif args.command == "screenshot":
66
+ if args.mode == "single_window" and not args.title:
67
+ print("Error: --title is required for single_window mode")
68
+ sys.exit(1)
69
+
70
+ # Call the tool using the call_tool method
71
+ import asyncio
72
+ result = asyncio.run(mcp.call_tool("take_screenshot", {
73
+ "mode": args.mode,
74
+ "title_pattern": args.title,
75
+ "use_regex": args.regex,
76
+ "save_to_downloads": not args.no_save
77
+ }))
78
+
79
+ if args.output:
80
+ # Save the screenshot to a specific file path provided by user
81
+ with open(args.output, "wb") as f:
82
+ f.write(result.image.data)
83
+ print(f"Screenshot saved to {args.output}")
84
+ elif hasattr(result, 'file_path'):
85
+ # If image was saved to downloads, show the path
86
+ print(f"Screenshot saved to {result.file_path}")
87
+ else:
88
+ print("Screenshot taken successfully")
89
+
90
+ # If we have multiple results (all_windows mode)
91
+ if args.mode == "all_windows" and isinstance(result, list):
92
+ print("\nAll screenshots:")
93
+ for i, item in enumerate(result):
94
+ if hasattr(item, 'file_path'):
95
+ window_title = item.window_info.title if hasattr(item, 'window_info') else f"Window {i+1}"
96
+ print(f"{i+1}. {window_title}: {item.file_path}")
97
+
98
+ elif args.command == "list-windows":
99
+ # Call the tool using the call_tool method
100
+ import asyncio
101
+ result = asyncio.run(mcp.call_tool("list_windows", {}))
102
+
103
+ # Parse the result
104
+ windows = []
105
+ for item in result:
106
+ if hasattr(item, 'text'):
107
+ try:
108
+ import json
109
+ window_info = json.loads(item.text)
110
+ windows.append(window_info)
111
+ except json.JSONDecodeError:
112
+ print(f"Failed to parse window info: {item.text}")
113
+
114
+ # Display the windows
115
+ for i, window in enumerate(windows):
116
+ print(f"{i+1}. {window.get('title')} ({window.get('width')}x{window.get('height')})")
117
+
118
+ elif args.command == "gui":
119
+ from computer_control_mcp.gui import main as run_gui
120
+ run_gui()
121
+
122
+ else:
123
+ # When no command is specified, run the server by default
124
+ print("MCP server started!")
125
+ run_server()
126
+
127
+ if __name__ == "__main__":
128
+ main()