Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/tmux-releases.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# https://github.com/tmux/tmux/releases

[releases]
"3.2a" = "551553a4f82beaa8dadc9256800bcc284d7c000081e47aa6ecbb6ff36eacd05f"
"3.3a" = "e4fd347843bd0772c4f48d6dde625b0b109b7a380ff15db21e97c11a4dcdf93f"
"3.4" = "551ab8dea0bf505c0ad6b7bb35ef567cdde0ccb84357df142c254f35a23e19aa"
"3.5" = "2fe01942e7e7d93f524a22f2c883822c06bc258a4d61dba4b407353d7081950f"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
python-version: ['3.15']
tmux-version: ['3.2a', '3.3a', '3.4', '3.5', '3.6', '3.8', 'master']
tmux-version: ['3.3a', '3.4', '3.5', '3.6', '3.8', 'master']
steps:
- uses: actions/checkout@v7

Expand Down
19 changes: 19 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ _Notes on upcoming releases will be added here_
`libtmux-mcp` requires Python 3.11 or newer. Python 3.10 reached end of life
in October 2026.

**tmux 3.3a is the minimum**

`libtmux-mcp` requires tmux 3.3a or newer, the minimum libtmux has required
since 0.65.0. (#162)

### Dependencies

**Minimum `libtmux>=0.67.0`** (was `>=0.62.0`). The fixes below come from
libtmux 0.64.0. (#162)

### What's new

**Kill tools ask the user first**
Expand All @@ -39,6 +49,15 @@ seconds while visible. Other clients receive the same result as before. See

The server advertises its logo as SVG and PNG for hosts that display one.

### Fixes

**Text that starts with `-` reaches tmux**

{tooliconl}`send-keys` types text that begins with `-`, such as `-n hello`,
into the pane. It previously typed nothing and reported success.
{tooliconl}`rename-window` accepts a name such as `-n`, which tmux previously
rejected as an unknown flag. (#162)

### Documentation

**The docs open with the libtmux.org top and documentation bars**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commands, read output, orchestrate panes.

## Quickstart

**Requirements:** Python 3.11+, tmux >= 3.2a on `$PATH`.
**Requirements:** Python 3.11+, tmux >= 3.3a on `$PATH`.

The distribution is `libtmux-mcp`, the import is `libtmux_mcp`, and the
installed executable is `libtmux-mcp`.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Requirements

- Python 3.11+
- tmux >= 3.2a
- tmux >= 3.3a
- [uv](https://github.com/astral-sh/uv) ([install](https://docs.astral.sh/uv/getting-started/installation/)) or [pipx](https://github.com/pypa/pipx) ([install](https://pipx.pypa.io/stable/installation/)) — for running without a persistent install

## Run without installing
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

| tmux | Status |
|------|--------|
| >= 3.2a | Supported |
| < 3.2a | Not supported (libtmux requirement) |
| >= 3.3a | Supported |
| < 3.3a | Not supported (libtmux requirement) |

## Dependencies

| Package | Required version |
|---------|-----------------|
| [libtmux](https://libtmux.git-pull.com/) | >= 0.62.0, < 1.0 |
| [libtmux](https://libtmux.git-pull.com/) | >= 0.67.0, < 1.0 |
| [FastMCP](https://github.com/jlowin/fastmcp) | >= 4.0.2, < 5.0.0 |
| [regex](https://github.com/mrabarnett/mrab-regex) | >= 2024.11.6 |

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include = [
]

dependencies = [
"libtmux>=0.62.0,<1.0",
"libtmux>=0.67.0,<1.0",
"fastmcp>=4.0.2,<5.0.0",
"regex>=2024.11.6",
]
Expand Down
14 changes: 7 additions & 7 deletions src/libtmux_mcp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ def escape_run(match: re.Match[str]) -> str:
def _prepare_start_directory(start_directory: str | None) -> str | None:
"""Resolve a caller path to the directory tmux will actually use.

tmux expands ``-c`` as a format before using it as a working
directory, then silently falls back to ``$HOME``, or ``/``, when the
result cannot be entered — so an unresolvable path starts the pane
somewhere else instead of failing. Resolving here leaves no format for
tmux to run and turns a bad path into an error the caller can correct.
tmux silently falls back to ``$HOME``, or ``/``, when a ``-c`` working
directory cannot be entered — so an unresolvable path starts the pane
somewhere else instead of failing. Resolving here turns a bad path into
an error the caller can correct. libtmux passes the path to tmux as
literal text, so a ``#`` in it needs no escaping.

Parameters
----------
Expand All @@ -496,7 +496,7 @@ def _prepare_start_directory(start_directory: str | None) -> str | None:
Returns
-------
str or None
Absolute path escaped for tmux, or ``None`` when none was given.
Absolute path, or ``None`` when none was given.

Raises
------
Expand All @@ -517,7 +517,7 @@ def _prepare_start_directory(start_directory: str | None) -> str | None:
if not resolved.is_dir():
msg = f"start_directory is not an existing directory: {str(resolved)!r}"
raise ExpectedToolError(msg)
return _escape_tmux_format(str(resolved))
return str(resolved)


def _tmux_argv(server: Server, *tmux_args: str) -> list[str]:
Expand Down
3 changes: 1 addition & 2 deletions src/libtmux_mcp/tools/pane_tools/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
ExpectedToolError,
_ask_before_teardown,
_caller_is_on_server,
_escape_tmux_format,
_get_caller_identity,
_get_server,
_prepare_start_directory,
Expand Down Expand Up @@ -233,7 +232,7 @@ def set_pane_title(
session_id=session_id,
window_id=window_id,
)
pane.set_title(_escape_tmux_format(title))
pane.set_title(title)
return _serialize_pane(pane)


Expand Down
5 changes: 2 additions & 3 deletions src/libtmux_mcp/tools/server_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
_apply_filters,
_ask_before_teardown,
_caller_is_on_server,
_escape_tmux_format,
_get_caller_identity,
_get_server,
_invalidate_server,
Expand Down Expand Up @@ -133,9 +132,9 @@ def create_session(
server = _get_server(socket_name=socket_name)
kwargs: dict[str, t.Any] = {}
if session_name is not None:
kwargs["session_name"] = _escape_tmux_format(session_name)
kwargs["session_name"] = session_name
if window_name is not None:
kwargs["window_name"] = _escape_tmux_format(window_name)
kwargs["window_name"] = window_name
prepared_start_directory = _prepare_start_directory(start_directory)
if prepared_start_directory is not None:
kwargs["start_directory"] = prepared_start_directory
Expand Down
5 changes: 2 additions & 3 deletions src/libtmux_mcp/tools/session_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
_apply_filters,
_ask_before_teardown,
_caller_is_on_server,
_escape_tmux_format,
_get_caller_identity,
_get_server,
_prepare_start_directory,
Expand Down Expand Up @@ -174,7 +173,7 @@ def create_window(
session = _resolve_session(server, session_name=session_name, session_id=session_id)
kwargs: dict[str, t.Any] = {}
if window_name is not None:
kwargs["window_name"] = _escape_tmux_format(window_name)
kwargs["window_name"] = window_name
prepared_start_directory = _prepare_start_directory(start_directory)
if prepared_start_directory is not None:
kwargs["start_directory"] = prepared_start_directory
Expand Down Expand Up @@ -226,7 +225,7 @@ def rename_session(
"""
server = _get_server(socket_name=socket_name)
session = _resolve_session(server, session_name=session_name, session_id=session_id)
session = session.rename_session(_escape_tmux_format(new_name))
session = session.rename_session(new_name)
return _serialize_session(session)


Expand Down
3 changes: 1 addition & 2 deletions src/libtmux_mcp/tools/window_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
_apply_filters,
_ask_before_teardown,
_caller_is_on_server,
_escape_tmux_format,
_get_caller_identity,
_get_server,
_prepare_start_directory,
Expand Down Expand Up @@ -303,7 +302,7 @@ def rename_window(
session_name=session_name,
session_id=session_id,
)
window.rename_window(_escape_tmux_format(new_name))
window.rename_window(new_name)
return _serialize_window(window)


Expand Down
14 changes: 7 additions & 7 deletions tests/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,11 @@ async def _exercise() -> None:
asyncio.run(_exercise())

assert calls == [
("cmd", ("send-keys", "C-c")),
("cmd", ("send-keys", "-l", "partial-TUI")),
("cmd", ("send-keys", "/needle")),
("cmd", ("send-keys", "--", "C-c")),
("cmd", ("send-keys", "-l", "--", "partial-TUI")),
("cmd", ("send-keys", "--", "/needle")),
("enter", ()),
("cmd", ("send-keys", "-l", " explicit-secret")),
("cmd", ("send-keys", "-l", "--", " explicit-secret")),
("enter", ()),
]

Expand Down Expand Up @@ -793,10 +793,10 @@ async def _exercise() -> None:
asyncio.run(_exercise())

assert calls == [
("cmd", ("send-keys", "C-c")),
("cmd", ("send-keys", "-l", "TUI_BATCH_DEFAULT")),
("cmd", ("send-keys", "--", "C-c")),
("cmd", ("send-keys", "-l", "--", "TUI_BATCH_DEFAULT")),
("enter", ()),
("cmd", ("send-keys", "-l", " batch-secret")),
("cmd", ("send-keys", "-l", "--", " batch-secret")),
("enter", ()),
]

Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.