Summary
macos-mcp 0.3.6 (current PyPI latest) cannot be imported. Any client that spawns it dies immediately with a SyntaxError before serving a single tool call. 0.3.5 is unaffected.
Repro
$ uvx --from 'macos-mcp==0.3.6' macos-mcp --help
Traceback (most recent call last):
File ".../bin/macos-mcp", line 6, in <module>
from macos_mcp.__main__ import main
File ".../site-packages/macos_mcp/__main__.py", line 431
_SCRAPE_MAX_CHARS = 20_000
^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax
Root cause
The misleading carat points at the numeric literal, but the literal is fine. The actual problem is that an @mcp.tool(...) decorator is sitting on top of an assignment statement instead of on top of def scrape_tool(...). Python decorators can only decorate def and class.
Current macos_mcp/__main__.py around line 420:
@mcp.tool(
name=\"Scrape\",
description=\"Fetch content from a URL. ...\",
annotations=ToolAnnotations(
title=\"Scrape\",
readOnlyHint=True,
destructiveHint=False,
idempotentHint=True,
openWorldHint=True,
),
)
_SCRAPE_MAX_CHARS = 20_000 # <-- decorator lands here, breaks the module
def scrape_tool(url: str, ctx: Context = None) -> str:
...
Suggested fix
Move the constant above the decorator (or below the function):
_SCRAPE_MAX_CHARS = 20_000
@mcp.tool(
name=\"Scrape\",
...
)
def scrape_tool(url: str, ctx: Context = None) -> str:
...
Prevention
A one-line CI step would have caught this:
python -c \"import macos_mcp.__main__\"
Worth wiring into the publish workflow so a broken module cannot ship to PyPI again.
Environment
- macos-mcp 0.3.6 (broken), 0.3.5 (works)
- Python 3.11 (uvx-managed venv)
- macOS, Apple Silicon
- Client: Claude Desktop
Summary
macos-mcp0.3.6 (current PyPI latest) cannot be imported. Any client that spawns it dies immediately with aSyntaxErrorbefore serving a single tool call. 0.3.5 is unaffected.Repro
Root cause
The misleading carat points at the numeric literal, but the literal is fine. The actual problem is that an
@mcp.tool(...)decorator is sitting on top of an assignment statement instead of on top ofdef scrape_tool(...). Python decorators can only decoratedefandclass.Current
macos_mcp/__main__.pyaround line 420:Suggested fix
Move the constant above the decorator (or below the function):
Prevention
A one-line CI step would have caught this:
Worth wiring into the publish workflow so a broken module cannot ship to PyPI again.
Environment