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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wrightty-0.2.4.tar.gz.
File metadata
- Download URL: wrightty-0.2.4.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3e2c8224e243e8ac2ce773994f96b6f6c133a1991ad3827b17532a9faffcb7c
|
|
| MD5 |
7499cb596377dd944d5a87baf6925cc5
|
|
| BLAKE2b-256 |
fea33f05caa90415dbac34f83dd1a660df80ca3fec47038de9d13626f9b18991
|
File details
Details for the file wrightty-0.2.4-py3-none-any.whl.
File metadata
- Download URL: wrightty-0.2.4-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4218731d77c63173978d3efa252df8a6ee18e091e37bdc8c6adbd6545dc792d6
|
|
| MD5 |
c60613e5346a92e9dc062f7583e3fc45
|
|
| BLAKE2b-256 |
d7362ab7ac344696e77d80cc5348d0ea7bc94c615fc951a65b602520714d2af3
|