mpy-workbench 0.2.1__tar.gz → 0.2.3__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.
Files changed (20) hide show
  1. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/PKG-INFO +11 -1
  2. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/README.md +10 -0
  3. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/PKG-INFO +11 -1
  4. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/__init__.py +1 -1
  5. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/mcp_server.py +8 -4
  6. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/pyproject.toml +1 -1
  7. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/tests/test_mpywb.py +13 -0
  8. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/SOURCES.txt +0 -0
  9. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/dependency_links.txt +0 -0
  10. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/entry_points.txt +0 -0
  11. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/requires.txt +0 -0
  12. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpy_workbench.egg-info/top_level.txt +0 -0
  13. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/board.py +0 -0
  14. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/cli.py +0 -0
  15. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/codegen.py +0 -0
  16. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/deps.py +0 -0
  17. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/linkclient.py +0 -0
  18. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/sync.py +0 -0
  19. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/mpywb/tools.py +0 -0
  20. {mpy_workbench-0.2.1 → mpy_workbench-0.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpy-workbench
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Run, upload and debug MicroPython on a board over USB, from the terminal or any MCP client (Claude Code, Cursor…).
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/DanielBustillos/mpy-workbench/tree/main/plugin
@@ -28,6 +28,16 @@ In Claude Code:
28
28
  /plugin install mpy-workbench@mpy-workbench
29
29
  ```
30
30
 
31
+ Or only the board tools, in one line (needs [uv](https://docs.astral.sh/uv/getting-started/installation/)):
32
+
33
+ ```bash
34
+ claude mcp add mpy-workbench -- uvx mpy-workbench mcp
35
+ ```
36
+
37
+ In **Claude Desktop** (the chat app, not Claude Code): download `mpy-workbench-<version>.mcpb` from the newest
38
+ `plugin-v…` release on the [Releases page](https://github.com/DanielBustillos/mpy-workbench/releases), open it, pick
39
+ your project folder and click **Install**. Then ask Claude, for example, "blink the LED on my ESP32".
40
+
31
41
  ## What Claude can do
32
42
 
33
43
  | Tool | What it does |
@@ -15,6 +15,16 @@ In Claude Code:
15
15
  /plugin install mpy-workbench@mpy-workbench
16
16
  ```
17
17
 
18
+ Or only the board tools, in one line (needs [uv](https://docs.astral.sh/uv/getting-started/installation/)):
19
+
20
+ ```bash
21
+ claude mcp add mpy-workbench -- uvx mpy-workbench mcp
22
+ ```
23
+
24
+ In **Claude Desktop** (the chat app, not Claude Code): download `mpy-workbench-<version>.mcpb` from the newest
25
+ `plugin-v…` release on the [Releases page](https://github.com/DanielBustillos/mpy-workbench/releases), open it, pick
26
+ your project folder and click **Install**. Then ask Claude, for example, "blink the LED on my ESP32".
27
+
18
28
  ## What Claude can do
19
29
 
20
30
  | Tool | What it does |
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpy-workbench
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Run, upload and debug MicroPython on a board over USB, from the terminal or any MCP client (Claude Code, Cursor…).
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/DanielBustillos/mpy-workbench/tree/main/plugin
@@ -28,6 +28,16 @@ In Claude Code:
28
28
  /plugin install mpy-workbench@mpy-workbench
29
29
  ```
30
30
 
31
+ Or only the board tools, in one line (needs [uv](https://docs.astral.sh/uv/getting-started/installation/)):
32
+
33
+ ```bash
34
+ claude mcp add mpy-workbench -- uvx mpy-workbench mcp
35
+ ```
36
+
37
+ In **Claude Desktop** (the chat app, not Claude Code): download `mpy-workbench-<version>.mcpb` from the newest
38
+ `plugin-v…` release on the [Releases page](https://github.com/DanielBustillos/mpy-workbench/releases), open it, pick
39
+ your project folder and click **Install**. Then ask Claude, for example, "blink the LED on my ESP32".
40
+
31
41
  ## What Claude can do
32
42
 
33
43
  | Tool | What it does |
@@ -2,4 +2,4 @@
2
2
  or any MCP client, without VS Code. Only Python is needed: mpremote is installed on
3
3
  first use (see deps.py)."""
4
4
 
5
- __version__ = "0.2.1"
5
+ __version__ = "0.2.3"
@@ -56,7 +56,7 @@ TOOLS = [
56
56
  "description": "Run a few lines of MicroPython on the board (like typing them in the REPL) and return what they print, e.g. to check a pin, list I2C devices or try an expression.",
57
57
  "inputSchema": {
58
58
  "type": "object",
59
- "properties": {"code": {"type": "string"}, "port": PORT, "timeout": TIMEOUT},
59
+ "properties": {"code": {"type": "string", "description": "MicroPython code to run on the board."}, "port": PORT, "timeout": TIMEOUT},
60
60
  "required": ["code"],
61
61
  },
62
62
  "annotations": {"destructiveHint": False, "openWorldHint": False},
@@ -125,7 +125,7 @@ TOOLS = [
125
125
  {
126
126
  "name": "read_file",
127
127
  "description": "Read a text file from the board.",
128
- "inputSchema": {"type": "object", "properties": {"path": {"type": "string"}, "port": PORT}, "required": ["path"]},
128
+ "inputSchema": {"type": "object", "properties": {"path": {"type": "string", "description": "File on the board, e.g. /main.py (the leading / is optional)."}, "port": PORT}, "required": ["path"]},
129
129
  "annotations": {"readOnlyHint": True, "openWorldHint": False},
130
130
  },
131
131
  ]
@@ -138,9 +138,11 @@ def call_tool(name, a):
138
138
  if name == "board_info":
139
139
  return tools.tool_board_info(port)
140
140
  if name == "run_file":
141
- return tools.tool_run_file(a["path"], port, float(a.get("timeout") or 10), bool(a.get("stop_at_timeout")), a.get("device_path"))[0]
141
+ text, r = tools.tool_run_file(a["path"], port, float(a.get("timeout") or 10), bool(a.get("stop_at_timeout")), a.get("device_path"))
142
+ return text, bool(r["error"].strip()) # a traceback marks the call as an error
142
143
  if name == "run_code":
143
- return tools.tool_run_code(a["code"], port, float(a.get("timeout") or 10))[0]
144
+ text, r = tools.tool_run_code(a["code"], port, float(a.get("timeout") or 10))
145
+ return text, bool(r["error"].strip())
144
146
  if name == "read_output":
145
147
  return tools.tool_read_output(port, float(a.get("seconds") or 3))
146
148
  if name == "stop":
@@ -192,6 +194,8 @@ def handle(msg):
192
194
  try:
193
195
  with contextlib.redirect_stdout(stray): # stdout belongs to the protocol
194
196
  text, is_error = call_tool(name, args), False
197
+ if isinstance(text, tuple):
198
+ text, is_error = text
195
199
  except (BoardError, RuntimeError, KeyError, ValueError) as e:
196
200
  text, is_error = str(e), True
197
201
  except Exception as e:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mpy-workbench"
7
- version = "0.2.1"
7
+ version = "0.2.3"
8
8
  description = "Run, upload and debug MicroPython on a board over USB, from the terminal or any MCP client (Claude Code, Cursor…)."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -104,6 +104,19 @@ class McpTest(unittest.TestCase):
104
104
  self.assertEqual(t["inputSchema"]["type"], "object")
105
105
  for req in t["inputSchema"].get("required", []):
106
106
  self.assertIn(req, t["inputSchema"]["properties"])
107
+ for name, prop in t["inputSchema"]["properties"].items():
108
+ self.assertTrue(prop.get("description"), "%s.%s has no description" % (t["name"], name))
109
+
110
+ def test_a_traceback_marks_the_run_as_an_error(self):
111
+ real = tools.tool_run_code
112
+ try:
113
+ for err, expected in (("Traceback...\nValueError: boom\n", True), ("", False)):
114
+ tools.tool_run_code = lambda *a, **k: ("text", {"output": "", "error": err})
115
+ r = handle({"jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": {"name": "run_code", "arguments": {"code": "x", "port": "/dev/x"}}})
116
+ self.assertIs(r["result"]["isError"], expected)
117
+ self.assertEqual(r["result"]["content"][0]["text"], "text")
118
+ finally:
119
+ tools.tool_run_code = real
107
120
 
108
121
 
109
122
  class NoResetOnOpenTest(unittest.TestCase):
File without changes