Skip to main content

Python SDK for the Wrightty terminal automation protocol

Project description

wrightty (Python SDK)

Python SDK for the Wrightty terminal automation protocol.

Control any terminal emulator programmatically — send keystrokes, read the screen, take screenshots, and run commands over WebSocket JSON-RPC.

Install

pip install wrightty
# with MCP server:
pip install wrightty[mcp]

You also need a wrightty server running. Install it via:

curl -fsSL https://raw.githubusercontent.com/moejay/wrightty/main/install.sh | sh
# or
cargo install wrightty

Quick start

from wrightty import Terminal

# Connect to a running wrightty server (auto-discovers)
term = Terminal.connect()

# Run a command and get its output
output = term.run("cargo test")
print(output)

# Read the screen
screen = term.read_screen()

# Send keystrokes
term.send_keys("Ctrl+c")
term.send_keys("Escape", ":", "w", "q", "Enter")

# Wait for text to appear
term.wait_for("BUILD SUCCESS", timeout=60)

# Screenshots
svg = term.screenshot("svg")

# Recording
rec_id = term.start_session_recording()
term.run("make build")
result = term.stop_session_recording(rec_id)
open("build.cast", "w").write(result["data"])  # asciinema play

term.close()

Starting a server

First start a wrightty terminal server:

wrightty term --headless                 # virtual PTY, no GUI
wrightty term --bridge-tmux              # attach to tmux
wrightty term --bridge-wezterm           # attach to WezTerm
wrightty term --bridge-kitty             # attach to Kitty
wrightty term --bridge-zellij            # attach to Zellij
wrightty term --bridge-ghostty           # attach to Ghostty

Then connect from Python as shown above.

MCP server (for Claude, Cursor, etc.)

pip install wrightty[mcp]

Add to your MCP config:

{
  "mcpServers": {
    "wrightty": {
      "command": "python3",
      "args": ["-m", "wrightty.mcp_server"],
      "env": { "WRIGHTTY_SOCKET": "ws://127.0.0.1:9420" }
    }
  }
}

See the main repository for full docs.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrightty-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wrightty-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file wrightty-0.1.0.tar.gz.

File metadata

  • Download URL: wrightty-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wrightty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5f08320dc354071a4e0b2dd8bc31c26882066f34326cf4fc022a0c2264fddfd
MD5 4c476ee8905adec3f230ccd7d76e491d
BLAKE2b-256 2a292d1b5e213ce9d6d2f3a3544c8426dd637d4da6b7a7509ea5d0b060bde81f

See more details on using hashes here.

File details

Details for the file wrightty-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wrightty-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wrightty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77c8ab69c59cc696bd02bdf6d04c549009cfef97e486723b4bd1452d9b8aed02
MD5 1b3348060c8530d3b5e5fe8948b923a2
BLAKE2b-256 64a2ae91e99b9b14519e5fff9790da78a40f88e546a081acc90467df96d839d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page