Skip to content

Invalid LIBTMUX_SAFETY values fail open to mutating #71

Description

@tony

Problem

Invalid LIBTMUX_SAFETY values currently fall back to mutating. README also documents invalid values: read, read+send, and read+send+kill.

This can expose write tools when a user intends to restrict the server.

Minimal local reproduction

$ LIBTMUX_SAFETY=read uv run python - <<'PY'
import asyncio
from libtmux_mcp.server import build_mcp_server

async def main():
    tools = await build_mcp_server().list_tools()
    names = {tool.name for tool in tools}
    print("send_keys visible:", "send_keys" in names)
    print("kill_pane visible:", "kill_pane" in names)

asyncio.run(main())
PY

Expected today: send_keys visible: True.

Minimal fix

Fail closed.

Either:

  • refuse startup on invalid LIBTMUX_SAFETY, or
  • fall back to readonly.

Also fix README/server instructions to document only the actual values:

  • readonly
  • mutating
  • destructive

Acceptance criteria

  • LIBTMUX_SAFETY=read does not expose mutating tools.
  • Invalid safety values produce a clear error or readonly-only surface.
  • README, configuration docs, and server instructions use the same safety value names.
  • Tests cover invalid safety configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions