computer-control-mcp 0.2.0__tar.gz → 0.2.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-control-mcp
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Computer control capabilities using PyAutoGUI through a Model Context Protocol (MCP) server
5
5
  Project-URL: Homepage, https://github.com/AB498/computer-control-mcp
6
6
  Project-URL: Issues, https://github.com/AB498/computer-control-mcp/issues
@@ -27,7 +27,7 @@ Description-Content-Type: text/markdown
27
27
 
28
28
  # Computer Control MCP
29
29
 
30
- A Python package that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI through a Model Context Protocol (MCP) server. With Zero External Dependencies.
30
+ MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. With Zero External Dependencies.
31
31
 
32
32
  ## Quick Usage (MCP Setup Using `uvx`)
33
33
 
@@ -1,6 +1,6 @@
1
1
  # Computer Control MCP
2
2
 
3
- A Python package that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI through a Model Context Protocol (MCP) server. With Zero External Dependencies.
3
+ MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. With Zero External Dependencies.
4
4
 
5
5
  ## Quick Usage (MCP Setup Using `uvx`)
6
6
 
@@ -149,7 +149,7 @@ def _find_matching_window(
149
149
  @mcp.tool()
150
150
  def tool_version() -> str:
151
151
  """Get the version of the tool."""
152
- return "0.2.0"
152
+ return "0.2.1"
153
153
 
154
154
 
155
155
  @mcp.tool()
@@ -268,24 +268,24 @@ def take_screenshot(
268
268
 
269
269
 
270
270
  @mcp.tool()
271
- def get_screenshot_with_ocr(
271
+ def get_ocr_from_screenshot(
272
272
  title_pattern: str = None,
273
273
  use_regex: bool = False,
274
274
  threshold: int = 60,
275
275
  scale_percent: int = 100,
276
- ) -> any:
276
+ ) -> List[Tuple[List[List[int]], str, float]]:
277
277
  """
278
- Get OCR text from the specified title pattern and save them to the downloads directory with absolute paths returned.
279
- If no title pattern is provided, get all Text on the screen.
278
+ Get OCR text with absolute coordinates (returned after adding the window offset from true (0, 0) of screen to the OCR coordinates, so clicking is on-point. Recommended to click in the middle of OCR Box) and confidence from window with the specified title pattern.
279
+ If no title pattern is provided, get all text on the screen.
280
280
 
281
281
  Args:
282
282
  title_pattern: Pattern to match window title, if None, get all UI elements on the screen
283
283
  use_regex: If True, treat the pattern as a regex, otherwise best match with fuzzy matching
284
- save_to_downloads: If True, save the screenshot to the downloads directory and return the absolute path
285
284
  threshold: Minimum score (0-100) required for a fuzzy match
285
+ scale_percent: Percentage to scale the image down before processing, you wont need this most of the time unless your pc is extremely old or slow
286
286
 
287
287
  Returns:
288
- List of UI elements as MCP Image objects
288
+ List of UI elements as [[4 corners of box], text, confidence]
289
289
  """
290
290
  try:
291
291
 
@@ -357,10 +357,10 @@ def get_screenshot_with_ocr(
357
357
 
358
358
  result, elapse_list = engine(resized_img)
359
359
  boxes, txts, scores = list(zip(*result))
360
-
360
+ boxes = [[[x + window.left, y + window.top] for x, y in box] for box in boxes]
361
361
  zipped_results = list(zip(boxes, txts, scores))
362
-
363
- return [image, *zipped_results]
362
+
363
+ return zipped_results
364
364
 
365
365
  except Exception as e:
366
366
  log(f"Error getting UI elements: {str(e)}")
@@ -208,7 +208,7 @@ def take_screenshot(
208
208
  return f"Error taking screenshot: {str(e)}"
209
209
 
210
210
 
211
- def get_screenshot_with_ocr(
211
+ def get_ocr_from_screenshot(
212
212
  title_pattern: str = None,
213
213
  use_regex: bool = False,
214
214
  threshold: int = 60,
@@ -297,10 +297,10 @@ def get_screenshot_with_ocr(
297
297
 
298
298
  result, elapse_list = engine(resized_img)
299
299
  boxes, txts, scores = list(zip(*result))
300
-
300
+ boxes = [[[x + window.left, y + window.top] for x, y in box] for box in boxes]
301
301
  zipped_results = list(zip(boxes, txts, scores))
302
- import json
303
- return json.dumps([*zipped_results])
302
+
303
+ return zipped_results
304
304
 
305
305
  except Exception as e:
306
306
  log(f"Error getting UI elements: {str(e)}")
@@ -310,4 +310,7 @@ def get_screenshot_with_ocr(
310
310
  log(f"Stack trace:\n{stack_trace}")
311
311
  return f"Error getting UI elements: {str(e)}\nStack trace:\n{stack_trace}"
312
312
 
313
- print(get_screenshot_with_ocr("chrome"))
313
+
314
+ import json
315
+
316
+ print(json.dumps(get_ocr_from_screenshot("chrome")))
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "computer-control-mcp"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Computer control capabilities using PyAutoGUI through a Model Context Protocol (MCP) server"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"