Skip to content

Commit 13e2032

Browse files
committed
mcp(fix): Guard entrypoint against missing fastmcp dependency
why: The `libtmux-mcp` console script is always installed via `[project.scripts]`, but `fastmcp` is only declared in `[project.optional-dependencies]`. A plain `pip install libtmux` installs the CLI entrypoint, but invoking it crashes with `ModuleNotFoundError`. what: - Catch `ImportError` in `main()` and print a helpful install message directing users to `pip install libtmux[mcp]`
1 parent bf056a5 commit 13e2032

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/libtmux/mcp/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55

66
def main() -> None:
77
"""Entry point for the libtmux MCP server."""
8-
from libtmux.mcp.server import run_server
8+
try:
9+
from libtmux.mcp.server import run_server
10+
except ImportError:
11+
import sys
12+
13+
print(
14+
"libtmux MCP server requires fastmcp. "
15+
"Install with: pip install libtmux[mcp]",
16+
file=sys.stderr,
17+
)
18+
raise SystemExit(1) from None
919

1020
run_server()

0 commit comments

Comments
 (0)